Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Aligning components in a Renderer

 
Karthick Dharani Vidhya
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Post.jpg
Expected Alignment
[Thumbnail for Post.jpg]
 
Matthew Brown
Bartender
Posts: 4565
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what's the problem in using 4 columns?
 
Karthick Dharani Vidhya
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@ 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic