Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable Help

 
Hasnain Javed
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I have some problems to be solved with JTable
1) The column names do not appear completely
2) I have a field called Remarks and consists of atmost 255 words. I can only see a few words.
3) One of the tables has alot of fields which means a big table and the big table will not be shown completely ( as the frame will be smaller then the size of the table in width ). will a horizontal scroll bar do ???
An early response will be highly appreciated.
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Not sure, normally I write my own TableModel.

2) Get the TableColumnModel and then the individual TableColumn. Then use the setPreferredWidth, setMinWidth, and setMaxWidth methods to adjust the column width:


3) Adding your table to a JScrollPane should do it.
 
Hasnain Javed
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Sir, I still have the same problem. I still see a few words and no horizontal scroll bar is added ?? what should I do?
[ August 13, 2005: Message edited by: Hasnain Javed ]
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you change the width of the columns? By default JScrollPanes only show the scrollbars when their contents is bigger than the display area. Trying making the columns very wide and it should stretch the table enough to invoke the scrollbars.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic