my dog learned polymorphism*
The moose likes Swing / AWT / SWT and the fly likes Aligning components in a Renderer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Aligning components in a Renderer" Watch "Aligning components in a Renderer" New topic
Author

Aligning components in a Renderer

Karthick Dharani Vidhya
Ranch Hand

Joined: Feb 23, 2008
Posts: 88
Hi All,

I have User Details (User Name / Age / Sex / Location). Lets say we need to display all these details in a Table Column.

For e.g.,

Row1 => Karthick 25 Male ABC
Row2 => Arun 26 Male DEF
Row3 => Sharadha 30 Female GHI


In the above column you can see that elements are not ordered properly. All these are displayed in one column named User Details in different row.

What I am trying to achieve is

Row1 => Karthick 25 Male ABC
Row2 => Arun 26 Male DEF
Row3 => Sharadha 30 Female GHI

{HTML does not align properly. Please find attached image}


In a single column, I am trying to Order the details to make sure all the names/ages/sex and location comes properly as shown above.

Any help on this would be appreciated.

I have tried by creating my own renderer and placing four JLabels (one for each above) inside them in Flow Layout and setting Minimum size for all JLabels in them. It did not work.



[Thumbnail for Post.jpg]



Karthick D V
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4370
    
    8

Try setting the preferred size, rather than the minimum size. I don't think FlowLayout takes any notice of the minimum size.

(Using a GridLayout would also work, but obviously that would give you columns the same width, and that's probably not what you want).
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
what's the problem in using 4 columns?
Karthick Dharani Vidhya
Ranch Hand

Joined: Feb 23, 2008
Posts: 88
@ MathewBrown: I will try that for sure.

@Michael Dunn: We do already show so many columns in that table. Business does not want to increase four or five more columns by splitting them in different columns.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Aligning components in a Renderer