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 Swing / AWT / SWT and the fly likes How Can I Get the Column Names and Widths (in pixels)  from a JTable 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 » Java » Swing / AWT / SWT
Bookmark "How Can I Get the Column Names and Widths (in pixels)  from a JTable" Watch "How Can I Get the Column Names and Widths (in pixels)  from a JTable" New topic
Author

How Can I Get the Column Names and Widths (in pixels) from a JTable

Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 688

I want to save the column names and the column widths to disk and restore them for a JTable.

I don't see how to do this. Can somebody help me out?

-- Kaydell
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10167
    
    8

One way might be the preference API
An example can be found at http://www.devdaily.com/blog/post/java/simple-java-preferences-api-example


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
your subject title says how do I get..., but the message say how do I save...

if you want to 'get' the info, here's a simple demo
run the demo, click button, drag one of the column widths wider, click button,
drag the columns around (different order), click button

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How Can I Get the Column Names and Widths (in pixels) from a JTable
 
Similar Threads
jtable
JTable
JTable
JTable
jtable