Article View: borland.public.jbuilder.java.swing
Article #11559Re: JTable cell formatting
From: Frans van Duinen
Date: Wed, 05 May 1999 00:00
Date: Wed, 05 May 1999 00:00
34 lines
2097 bytes
2097 bytes
When your renderer is called, its third parameter (isSelected) indicates whether to paint using table.getSelectionBackground() or table.getBackground(). Just set your label's background accordingly. 't Beste. =========================== Mike Wolterink wrote: > > Thanx all, > it works fine, except for the selectionbar ! ;-) > when I select this row, this double column (new renderer) doesn't show the > selectionbar. > I tried to set the colors, but it doesn't work ?! (the renderer inherits > from JLabel) > I read the background of JLabel cannot be set other than white; > so I have to paint it myself !? > > any idea ? > > Mike > > Christian Kaufhold wrote in message ... > >In comp.lang.java.gui Mike Wolterink <m.wolterink@nedap.nl> wrote: > >> I want to 'format' my Double that I put in the JTable, > >> i.e.: 400.3000000 becomes 400.3 (I don't want that !!!) > >> I want to give a precision to the Double (400.30). > >> When I make a String of it, it aligns to the left and I don't want that > >> either ! > > > >Use a custom TableCellRenderer, and have a look at java.text.NumberFormat/ > >java.text.DecimalFormat to format your numbers. > > > >Christian
Technical Details
Message-ID:
<3730581E.BB0FEFB0@myna.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7gmp1e$opi$1@news.worldonline.nl> <t61ng7.uf.ln@nandus.uni-bremen.de> <7goq3d$mgb$1@news.worldonline.nl>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,61d4beeaae1dc2c3 X-Google-Attributes: gid111d45,public X-Google-Thread: 10a146,61d4beeaae1dc2c3 X-Google-Attributes: gid10a146,public X-Google-Thread: 10fd6d,61d4beeaae1dc2c3 X-Google-Attributes: gid10fd6d,public From: Frans van Duinen <frans_van_duinen@myna.com> Subject: Re: JTable cell formatting Date: 1999/05/05 Message-ID: <3730581E.BB0FEFB0@myna.com> X-Deja-AN: 474332273 Content-Transfer-Encoding: 7bit References: <7gmp1e$opi$1@news.worldonline.nl> <t61ng7.uf.ln@nandus.uni-bremen.de> <7goq3d$mgb$1@news.worldonline.nl> To: Mike Wolterink <m.wolterink@nedap.nl> Content-Type: text/plain; charset=us-ascii Organization: Master Programmer Group Inc. MIME-Version: 1.0 Reply-To: frans_van_duinen@myna.com Newsgroups: borland.public.jbuilder.java.swing,comp.lang.java.gui,comp.lang.java.programmer