Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Alignment format on JTable

 
May Wong
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm working on GUI part now. I created my own TableModel class say, FlightTableModel, by extending AbstractTableModel interface. Since I use DataInfo[] to hold the data in FlightTableModel and DataInfo holds a String array. So, all the data display on JTable will be String type and will be left aligned. I feel uncomfortable everytime I saw the Price and AvailableSeats data are left aligned.
Could you please tell me what did you realize the right alignment? Or just let it be left?
Thank you for your help.
May
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't see any alignment code in my sources. So I don't think it is really important. I hadn't noticed it before.
Mark
 
Bal Sharma
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did not use any alignment code ethier. It does not make any difference, because all columns are left alligned. If you really do not like it, you can fix it. Go to SUN JTable tutorial in depth. Have fun.
-Bal
 
Sri Addanki
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mark Spritzler:
I didn't see any alignment code in my sources. So I don't think it is really important. I hadn't noticed it before.
Mark

Do you still feel the same, Mark?
Because even i haven't used any alignment in the code. And the 2 columns-Price and Available seats, are left aligned.
Is that ok?
thanks,
sri
 
Stephane Weber
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Personnally, I did right align the two numeric columns (price and available seats).
I did it using this whent building my JTable :

Hope this helps
Stephane
 
Sri Addanki
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks St�phane Weber.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic