|
-
January 8th, 2003, 04:01 AM
#1
How to set the size of a column in a Table?
-
January 8th, 2003, 06:42 AM
#2
Get the desired TableColumn and then you can set the max width, min width, preferred width, and width:
Code:
TableColumn column = myTable.getColumn(foo);
// or
// TableColumn column = myTable.getColumnModel().getColumn(index);
column.setMaxWidth(...);
column.setMinWidth(...);
column.setWidth(...);
column.setPreferredWidth(...);
// etc.
There are no 'accidents', only human errors and failings...
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
-
January 8th, 2003, 11:59 AM
#3
-
January 8th, 2003, 12:12 PM
#4
The identifier object for your Column.
Which one getColumn should return.
-
January 8th, 2003, 02:26 PM
#5
cntomcom - the first thing you should do when you have a question about a class method is look at the JavaDoc for that class method, e.g. JTable.getColumn(...). In some cases (like this one), it may still not be clear what is meant, so you follow (where possible) the clues to related classes, e.g. TableColumn. A little persistence and common sense will generally lead you to an explanation, e.g. TableColumn.getIdentifier().
This process is absolutely essential if you want to be a successful Java programmer, so it is important that you become familiar with the JavaDocs. Knowing how and where to find the information you need is probably the single most important aspect of practical programming.
There's no doubt that cowardice can be a life saver...
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|