wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Non-default rendering of columns necessary ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Non-default rendering of columns necessary ?" Watch "Non-default rendering of columns necessary ?" New topic
Author

Non-default rendering of columns necessary ?

Klaas van Gelder
Ranch Hand

Joined: Jul 08, 2004
Posts: 100
Hi all,

In my nearly completed GUI, I still use the default rendering. And because all fields are Strings, they are all shown in the same, left-aligned way.

I read here that many people use custom cell renderers to right-aliign some columns and show a currency sign in the price column.

My first question is: shound we really spend efforts on these rendering issues ? It is pretty complicated stuff to create and register your custom renderers, and not really trivial for junior users, who should after all be able to maintain the application... :-)

And my second, if i DO use a default renderer, i notice that the font is changed to bold ! This is the code I use now in my currency renderer:


It is copied from a tutorial, so dont look at the strange variable names.. :-)
But why does it show the currencies in bold ? And how can i choose the same font as the original field ?

Regards, Klaas
[ September 28, 2004: Message edited by: Klaas van Gelder ]

"What you don't know, can't help you"
SCJP (81%), SCWCD (81%), SCJD (354/400), SCBCD (85%)
Klaas van Gelder
Ranch Hand

Joined: Jul 08, 2004
Posts: 100
The extra line:
testLabel.setFont(table.getFont());

does the trick of making the font the same as the rest of the table !

Additional issue is that there is no space between the now right-alignment of the Price field and subsequent (left aligned) Day field. Maybe the JTextfield should get a right margin ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Non-default rendering of columns necessary ?
 
Similar Threads
Cannot uncheck JCheckBox in JTable
setting up JCheckBox in JTable
Setting renderers on JTable
JTable and Custom TableCellRenderer - selection problem
Globally replacing BooleanTableCellRenderer