hello,
I need a dialog where the user can select a column to use the columns data later in process.
The data in the table is read only.
in Swing I'd simply call
| jTable.setColumnSelectionAllowed(true); |
| jTable.setRowSelectionAllowed(false); |
but how du I get the same behavior in JavaFX-8 as with this swing-SSCCE?
public class TableSelectTest {
public static void main(String[] args) {
TableModel myModel = new DefaultTableModel(5, 5) {
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
@Override
public Object getValueAt(int row, int column) {
return String.format("%s-%s", Character.valueOf((char) (0x41
+ row)), column);
}
};
JTable jTable = new JTable(myModel);
jTable.setColumnSelectionAllowed(true);
jTable.setRowSelectionAllowed(false);
while (4 > jTable.getSelectedColumn()) {
JOptionPane.showMessageDialog(null, jTable, "select a column", JOptionPane.QUESTION_MESSAGE);
JOptionPane.showMessageDialog(null,
String.format("column %s selected", jTable.getSelectedColumn()),
"result",
JOptionPane.INFORMATION_MESSAGE);
}
}
}
bye
TPD