Path: csiph.com!news.redatomik.org!aioe.org!.POSTED!not-for-mail From: "Dr.UgoGagliardelli" Newsgroups: it.comp.java Subject: Re: Domande su JTextField e JLabel Date: Sat, 24 Jun 2017 14:22:04 +0200 Organization: Aioe.org NNTP Server Lines: 12 Message-ID: References: NNTP-Posting-Host: QfBUYkOXEXPxI+DHSnWpiA.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 X-Antivirus-Status: Clean X-Notice: Filtered by postfilter v. 0.8.2 Content-Language: it-IT X-Antivirus: Avast (VPS 170623-4, 23/06/2017), Outbound message Xref: csiph.com it.comp.java:9090 Il 24.06.2017 13.01, Oliviero ha scritto: > Ho due domande: > > 1) come si fa a sapere la lunghezza di un JTextField o di una JLabel? Una volta che e' visible, getSize().width Altrimenti in base alle colonne del JTextField o alla lunghezza del text dell JLabel. In ogni caso, se sono state impostate le proprieta' minimumSize, preferredSize e maximumSize, il layout manager potrebbe utilizzarle. > > 2) come si fa a colorare un JTextField o una JLabel? In tutti i JComponent c'e' setForeground e setBackground.