akbiggs akbiggs - 3 years ago 140
Java Question

How do I resize table columns individually using Netbean's GUI Builder?

In making a quick mockup of a project's end design using Netbeans' GUI Builder, I've run into a problem with the options given to me for the Table object. It seems that I can't resize columns individually, only the whole table. Am I wrong, and is there a way to resize columns using the GUI Builder? If not, could I accomplish this using Swing code? How?

Answer Source

SInce the default JColumnModel created by Netbeans GUI builder is hidden and cannot be customized in Properties plalette, you will have to do it programatically.

Go the `Source view' (there is a small button above the editor pane to switch between Source View and Design View) and put the following code in the constructor

/** Creates new form NewJFrame */
public NewJFrame() {
    // Insert this line into your code

Fore more details, read here or google for "jtable set column size".

Here is another useful information.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download