Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting empty array back from getSelectedRows()  RSS feed

 
Ken Rubin
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

First thank you for reading this!

I have code where the table.getSelectedRows() is returning an
empty array, but the lone table row appears to be selected. The other
strange thing is that the tablecellrenderer shows a row to be
selected in the debugger!

The code for how I setup the table is shown below and also the
funtion prototype for the tablecellrenderer. Any insight would be
greatly appreciated.

Thank you,

Ken

public void setStyle(String style) {
this.style = style;
this.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
this.setRowSelectionAllowed(true);
this.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
this.setShowHorizontalLines(true);
this.setShowVerticalLines(false);
this.setRowHeight(RowEditorTable.DEFAULT_ROW_HEIGHT);
this.setRowMargin(UIManager.getInt("Table.Row.Margin"));
this.setTableHeader(null);
Color bg_color = UIManager.getColor(style + ".Table.Background");
this.setBackground(bg_color);
this.setDefaultRenderer(Object.class,
new ReportRejectTableCellRenderer());

public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int col) { ...}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!