• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Column Names

 
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gurpreet,


... Do I trim the column names ?.


Yep.

Michael Morris
 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

https://coderanch.com/t/181953/java-developer-SCJD/certification/JTable-Help
thanks.
harcharan
 
Gurpreet Saini
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can refresh your data, when user perform next search
 
harcharan kanwal
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it is useful to refresh the data after booking by clicking at refresh button and doing new search .
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic