This week's book giveaways are in the Cloud/Virtualization and Go forums.
We're giving away four copies each of Cloud Native Transformation: Practical Patterns for Innovation and The Go Workshop and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native Transformation: Practical Patterns for InnovationE this week in the Cloud/Virtualization forum
or The Go Workshop in the Go forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

Non-default rendering of columns necessary ?

 
Ranch Hand
Posts: 111
PHP Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Klaas van Gelder
Ranch Hand
Posts: 111
PHP Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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'm gonna teach you a lesson! Start by looking at this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!