I am working on the table that contains the rows to suit the content. I establish a table-modell listener in the table model So whenever a new line is added, the height of the newly added row is automatically changed. Here is my test code: I hope that when the "add add" button is clicked, a new row is added to the table and it has a height of 100 pixels, but it does not work - Never change the height of the row. One of the mentioned things is that if the Of course, I can not trust this "solution" because the table model can be changed from other places. Am I using How about using EventQueue.invokeLater (...) Final DefaultTableModel Model = New DefaultTableModel (0, 1); Final jetty table = new jetty (model); Model.addTableModelListener (New TableLodelListener) {@Override Public Zero Table Changed (TableModelEvent E) {// TO DO: Replace 100 with actual favorite height. Table.setRowHeight (e.getFirstRow (), 100);}}) ; Jebton Button = New Pocket ("Add Row"); Button.addActionListener (New Executioner) {@ Override Public Voice ActionPerfed (Action Event E) {model.addRow (New String [] {"abc"})}}});
JTable.setRowHeight method can work correctly, I take the action listener's button in such a way as to call:
button.addActionListener {@ Override Public Voice ActionPerfed (Action Event e) {model.addRow (New String [] {"abc"}); Talbe.setRowHeight (table.getRowCount () - 1, 100);}});
TableModelListener correctly or is it a bug?
model.addTableModelListener {new overlapping table listing} {@ Override Public Zero Table Changed (Last Table Model Event E) {// TO: Replace 100 with actual favorites. EventQueue.invokeLater (New Runnabal) {@ Override Public Wired Run ({{table.setRowHeight (e.getFirstRow (), 100);}}}}}});
Comments
Post a Comment