예제 #1
0
 public void resetDefaultFocusTraversalKeys() {
   KeyboardFocusManager m = KeyboardFocusManager.getCurrentKeyboardFocusManager();
   for (Integer each :
       Arrays.asList(
           KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
           KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
           KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS,
           KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS)) {
     setFocusTraversalKeys(each, m.getDefaultFocusTraversalKeys(each));
   }
 }
예제 #2
0
 public void removeNotify() {
   final KeyboardFocusManager keyboardFocusManager =
       KeyboardFocusManager.getCurrentKeyboardFocusManager();
   //noinspection HardCodedStringLiteral
   keyboardFocusManager.removePropertyChangeListener("permanentFocusOwner", myEditorRemover);
   //noinspection HardCodedStringLiteral
   keyboardFocusManager.removePropertyChangeListener("focusOwner", myEditorRemover);
   super.removeNotify();
   if (myBusyIcon != null) {
     remove(myBusyIcon);
     Disposer.dispose(myBusyIcon);
     myBusyIcon = null;
   }
 }
예제 #3
0
  public boolean editCellAt(final int row, final int column, final EventObject e) {
    if (cellEditor != null && !cellEditor.stopCellEditing()) {
      return false;
    }

    if (row < 0 || row >= getRowCount() || column < 0 || column >= getColumnCount()) {
      return false;
    }

    if (!isCellEditable(row, column)) {
      return false;
    }

    if (myEditorRemover == null) {
      final KeyboardFocusManager keyboardFocusManager =
          KeyboardFocusManager.getCurrentKeyboardFocusManager();
      myEditorRemover = new MyCellEditorRemover();
      //noinspection HardCodedStringLiteral
      keyboardFocusManager.addPropertyChangeListener("focusOwner", myEditorRemover);
      //noinspection HardCodedStringLiteral
      keyboardFocusManager.addPropertyChangeListener("permanentFocusOwner", myEditorRemover);
    }

    final TableCellEditor editor = getCellEditor(row, column);
    if (editor != null && editor.isCellEditable(e)) {
      editorComp = prepareEditor(editor, row, column);
      // ((JComponent)editorComp).setBorder(null);
      if (editorComp == null) {
        removeEditor();
        return false;
      }
      editorComp.setBounds(getCellRect(row, column, false));
      add(editorComp);
      editorComp.validate();

      IdeFocusManager.findInstanceByComponent(this).requestFocus(editorComp, false);

      setCellEditor(editor);
      setEditingRow(row);
      setEditingColumn(column);
      editor.addCellEditorListener(this);
      if (isTypeAhead) {
        JTableCellEditorHelper.typeAhead(this, e, row, column);
      }
      return true;
    }
    return false;
  }