Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2007

Tip: Looking for answers? Try searching our database.

Column resizing problem in JTable

Thread view: 
AimsLife - 12 Sep 2007 07:29 GMT
Hi,

I am using jdk1.5 kit for development. I developed a JFrame window
which has JTable in view. JTable columns and rows created using Custom
"TableModel" with the name of "InfoTableModel" extended by
"AbstractTableModel". InfoTableModel contain list of data to be
display. I need customize my table column, can you please guide me how
I can give column width for proper column width?

Regards,
-aimslife
RedGrittyBrick - 12 Sep 2007 19:37 GMT
> Hi,
>
[quoted text clipped - 4 lines]
> display. I need customize my table column, can you please guide me how
> I can give column width for proper column width?

JTable table;
int column, width;
...
table.getColumnModel().getColumn(column).setPreferredWidth(width);

Usually I have the table in a JScrollPane in a layout that allows it to
resize to the max size allowed by window size & other components. In
this case the preferred widths of the columns is used to set the widths
of the columns RELATIVE to one another. As a rule of thumb I set the
width to 10 x the number of characters I expect the column to contain.
AimsLife - 13 Sep 2007 07:56 GMT
Thanks

Regards,
-aimslife

On Sep 12, 11:37 pm, RedGrittyBrick <RedGrittyBr...@SpamWeary.foo>
wrote:
> > Hi,
>
[quoted text clipped - 15 lines]
> of the columns RELATIVE to one another. As a rule of thumb I set the
> width to 10 x the number of characters I expect the column to contain.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.