Article View: borland.public.jbuilder.java.swing
Article #11899Re: JTable and JLabel justification problem.
From: Vasudevan Srinivasan
Date: Thu, 11 Mar 1999 00:00
Date: Thu, 11 Mar 1999 00:00
34 lines
1444 bytes
1444 bytes
Try this one: instead of label.setHorizontalAlignment(JLabel.LEFT) use label.setHorizontalAlignment(SwingConstants.LEFT) //or RIGHT or whatever you want Vasu Andy Jeffrey wrote: > Hi, > > I'm using a JTable and a JLabel as my TableCellRenderer and have set 'left' > justification. When I go to the table, the number is 'left' justified. On > the first mouse click, the integer jumps to the right and then back to left > justified on the second mouse click or a key stroke. > > This code is in the 'getTableCellRendererComponent' method as part of my > TableTableCellRenderer: > > String text = dataValues == null ? "" : dataValues.toString(); > label.setText(text); > label.setOpaque(true); > label.setHorizontalAlignment(JLabel.LEFT); > //label.setHorizontalTextPosition(JLabel.LEFT); > > Has anybody seen this behaviour and know of a workaround? > > Regards, > > Andy.
Technical Details
Message-ID:
<36E83E57.2FA73AE7@netrisk.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7c8tk7$lmn27@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,160106612556f3ca X-Google-Attributes: gid111d45,public From: Vasudevan Srinivasan <vasudevan@netrisk.com> Subject: Re: JTable and JLabel justification problem. Date: 1999/03/11 Message-ID: <36E83E57.2FA73AE7@netrisk.com> X-Deja-AN: 453955668 Content-Transfer-Encoding: 7bit References: <7c8tk7$lmn27@forums.borland.com> Content-Type: text/plain; charset=us-ascii Organization: NetRisk Inc Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing