This is how my JTable is reconstructed from the serialized data:
table = new JTable(){
public boolean isCellEditable(int arg0, int arg1) {
return true;
}
};
table.addMouseListener(this);
table.addFocusListener(this);
int width = HCAConstants.hcaGuiFuzzyTableWidth;
int tableRowHeight = HCAConstants.hcaGuiFuzzyTableRowHeight;
table.putClientProperty("cancelEditOnFocusLost", Boolean.TRUE);
table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
table.setModel(new MBFTableModel(data[currentH.Int][currentF.Int]));
TableColumn col = table.getColumnModel().getColumn(0);
col.setPreferredWidth(width);}
table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "none");
table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_DOWN_MASK), "none");
table.setCellSelectionEnabled(true);
KeyStroke tab = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0);
InputMap map = table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
map.put(tab, "selectNextRowCell");
table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "none");
table.setEnabled(true);
table.setDefaultRenderer(FuzzyDat.class,new FuzzyDatRender());
table.setDefaultEditor(FuzzyDat.class, new FuzzyDatEditor(currentF,(LoadToTable)this));
table.setDefaultRenderer(MinMax.class, new MinMaxRender());
table.setDefaultEditor(MinMax.class, new MinMaxEditor());
table.setRowSelectionAllowed(true);
table.setColumnSelectionAllowed(true);
table.setRowHeight(tableRowHeight);
My Scenario is this: Whenever I click on the cell’s slider for the first time, it does not respond; on the second click, the component responds and thereafter the slider responds to the first click.
How can make the slider interactive with the first click only rather than clicking twice initially.
The DefaultCellEditor has three default constructors: JCheckBox, JComboBox and JTextField; but I need to override this constructor for JSlider. How can I achieve this? Is this necessary? It was suggested that I use setClickCountToStart(1).
Maybe one of
SliderColumnorSpinnerColumnmay help:SliderColumn:
SpinnerColumn: