setRowHeight(int) works but not setRowHeight(int, int) with JXTable

164 Views Asked by At

I have a problem to update JXTable's rows height. I have tested an example from this post (Setting the height of a row in a JTable in java) :

import javax.swing.*;
import javax.swing.table.DefaultTableModel;

public class DemoTable {
    private static void createAndShowGUI() {
        JFrame frame = new JFrame("DemoTable");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        DefaultTableModel model = new DefaultTableModel();
        model.setColumnIdentifiers(new Object[] {
                "Column 1", "Column 2", "Column 3" });

        JTable table = new JTable(model);
        for (int count = 0; count < 3; count++){
            model.insertRow(count, new Object[] { count, "name", "age"});
        }
        table.setRowHeight(1, 30);

        frame.add(new JScrollPane(table));
        frame.setLocationByPlatform(true);
        frame.pack();
        frame.setVisible(true);
    }

    public static void main(String args[]) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }
}

This demo works perfectly, but if I change JTable to JXTable (and I need it for my project), the second row is not updated, the size is 15 for all. If I use setRowHeight(30) instead of setRowHeight(1, 30) with JXTable, it works but all the rows are updated.

Is this a bug ? How can I solve this problem ? I'm using the library swingx-0.9.2.jar

Thanks

0

There are 0 best solutions below