File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Column Names

 
Gurpreet Saini
Ranch Hand
Posts: 295
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi reader,
The schema provided in db.db file does not get fit in JTable column header. Do I trim the column names ?. Or there is any other way out to display column names without trimming it ?. I am using AbstractTableModel
Please comply as soon as possible.
Thank you,
 
Michael Morris
Ranch Hand
Posts: 3451
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gurpreet,

... Do I trim the column names ?.

Yep.

Michael Morris
 
Samual Harvey
Ranch Hand
Posts: 119
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alternatively you can create your own column model and set the column headers and column class types. I used this.
 
harcharan kanwal
Ranch Hand
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Gurpreet,
try one of these examples in this site would solve your problem
http://www2.gol.com/users/tame/swing/examples/JTableExamples1.html
btw ,i have a current thread active about JTable suddenly displaying the old data.Since you are working on the same area of the project.please take a look into it and see if you could have any idea what is wrong with my code.

http://www.coderanch.com/t/181953/java-developer-SCJD/certification/JTable-Help
thanks.
harcharan
 
Gurpreet Saini
Ranch Hand
Posts: 295
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi harcharan,
Firstly, I should let you know about my JTable. It's very simple and very basic. I had used FlowLayout. The problem I encountered was the column names were very big and adament to fix in thier houses. So, I chopped them. and used class TableColumn to hit them with a stick such that they do not misbehave when user tries to resize them and also to remain in thier rooms by using setPrefferedWidth() method. Moreover, I let the previous data to remain in JTable. But, I will plan to refresh the data when user wishes to do so. What do you say over this ?.
Thank you,
 
harcharan kanwal
Ranch Hand
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you sounds like no mercy to me man!if it is working for you, Great!
btw,i took the code from the site i mentioned above to render my column headers
[ September 15, 2002: Message edited by: harcharan kanwal ]
 
harcharan kanwal
Ranch Hand
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can refresh your data, when user perform next search
 
harcharan kanwal
Ranch Hand
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is useful to refresh the data after booking by clicking at refresh button and doing new search .
 
Sarita Gupta
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Harcharan
Originally posted by harcharan kanwal:
it is useful to refresh the data after booking by clicking at refresh button and doing new search .


It's better that the table gets updated automatically upon successful booking.
Just my suggestion... take it if u like it
Sarita
 
Gurpreet Saini
Ranch Hand
Posts: 295
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
It's better that the table gets updated automatically upon successful booking.
Just my suggestion... take it if u like it

I do hope that you are not reading the available seats of selected flight on client side ie retrieving available Seats from table model. Otherwise OK.
Thank's
 
Sarita Gupta
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gurpreet Saini:
I do hope that you are not reading the available seats of selected flight on client side ie retrieving available Seats from table model. Otherwise OK.

Of course not Gurpreet. It's the updated info from the db after successful booking.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic