This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Column Names Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Column Names " Watch "Column Names " New topic
Author

Column Names

Gurpreet Saini
Ranch Hand

Joined: Jun 09, 2002
Posts: 295
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

Joined: Jan 30, 2002
Posts: 3451
Hi Gurpreet,

... Do I trim the column names ?.

Yep.

Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Samual Harvey
Ranch Hand

Joined: Aug 06, 2002
Posts: 119
Alternatively you can create your own column model and set the column headers and column class types. I used this.


Samual Harvey<br />SCJP2<br />SCJD2
harcharan kanwal
Ranch Hand

Joined: Jul 02, 2001
Posts: 64
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

Joined: Jun 09, 2002
Posts: 295
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

Joined: Jul 02, 2001
Posts: 64
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

Joined: Jul 02, 2001
Posts: 64
you can refresh your data, when user perform next search
harcharan kanwal
Ranch Hand

Joined: Jul 02, 2001
Posts: 64
it is useful to refresh the data after booking by clicking at refresh button and doing new search .
Sarita Gupta
Ranch Hand

Joined: Aug 12, 2002
Posts: 43
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


There are no great people in this world, only great challenges which ordinary people rise to meet.
Gurpreet Saini
Ranch Hand

Joined: Jun 09, 2002
Posts: 295
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

Joined: Aug 12, 2002
Posts: 43
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.
 
jQuery in Action, 2nd edition
 
subject: Column Names
 
Similar Threads
Need help in find the text from 1000 Records
Complex SQL Query
JTable row header or?
B&S Column Names
Retrieve MySQL table column names