public void actionPerformed(ActionEvent e) {
   JListMutable list = (JListMutable) e.getSource();
   if (!list.hasFocus()) {
     CellEditor cellEditor = list.getListCellEditor();
     if (cellEditor != null && !cellEditor.stopCellEditing()) {
       return;
     }
     list.requestFocus();
     return;
   }
   ListSelectionModel rsm = list.getSelectionModel();
   int anchorRow = rsm.getAnchorSelectionIndex();
   list.editCellAt(anchorRow, null);
   Component editorComp = list.getEditorComponent();
   if (editorComp != null) {
     editorComp.requestFocus();
   }
 }
 public void actionPerformed(ActionEvent e) {
   JGrid grid = (JGrid) e.getSource();
   if (!grid.hasFocus()) {
     CellEditor cellEditor = grid.getCurrentCellEditor();
     if (cellEditor != null && !cellEditor.stopCellEditing()) {
       return;
     }
     grid.requestFocus();
   }
   SelectionModel selectionModel = grid.getSelectionModel();
   int anchorRow = selectionModel.getAnchorRow();
   int anchorColumn = selectionModel.getAnchorColumn();
   grid.editCellAt(anchorRow, anchorColumn, null);
   Component editorComp = grid.getEditorComponent();
   if (editorComp != null) {
     editorComp.requestFocus();
   }
 }
 public void actionPerformed(ActionEvent e) {
   JTable table = (JTable) e.getSource();
   if (!table.hasFocus()) {
     CellEditor cellEditor = table.getCellEditor();
     if (cellEditor != null && !cellEditor.stopCellEditing()) {
       return;
     }
     table.requestFocus();
     return;
   }
   ListSelectionModel rsm = table.getSelectionModel();
   int anchorRow = rsm.getAnchorSelectionIndex();
   table.editCellAt(anchorRow, PropertySheetTableModel.VALUE_COLUMN);
   Component editorComp = table.getEditorComponent();
   if (editorComp != null) {
     editorComp.requestFocus();
   }
 }
 public void actionPerformed(ActionEvent event) {
   JGrid grid = (JGrid) event.getSource();
   if (!grid.hasFocus()) {
     CellEditor cellEditor = grid.getCurrentCellEditor();
     if ((cellEditor != null) && !cellEditor.stopCellEditing()) {
       return;
     }
     grid.requestFocus();
   }
   SelectionModel selectionModel = grid.getSelectionModel();
   Cell selectedCell = selectionModel.getSelectedCell();
   int row = selectedCell.getRow();
   int column = selectedCell.getColumn();
   grid.editCellAt(row, column, null);
   Component editorComponent = grid.getEditorComponent();
   if (editorComponent != null) {
     editorComponent.requestFocus();
   }
 }
Пример #5
0
 @Override
 public void focusLost(FocusEvent e) {
   editor.stopCellEditing();
 }