类javax.swing.CellEditor源码实例Demo

下面列出了怎么用javax.swing.CellEditor的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: CodenameOne   文件: PropertySheetTable.java
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();
  }
}
 
源代码2 项目: ramus   文件: TableEditorTable.java
public TableEditorTable(List<Attribute> attributes, GUIFramework framework) {
    this.framework = framework;
    this.attributes = attributes;
    plugins = new AttributePlugin[attributes.size()];
    cellEditors = new TableCellEditor[plugins.length];
    cellRenderers = new TableCellRenderer[plugins.length];
    setHorizontalScrollEnabled(true);
    setShowVerticalLines(true);

    getInputMap(JInternalFrame.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
            KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
            "RamusENTER_Action");
    getInputMap(JInternalFrame.WHEN_FOCUSED).put(
            KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
            "RamusENTER_Action");
    AbstractAction ramusEnterAction = new AbstractAction() {

        /**
         *
         */
        private static final long serialVersionUID = 4745861738845278043L;

        public void actionPerformed(ActionEvent ae) {
            CellEditor editor = getCellEditor();
            if (editor != null)
                editor.stopCellEditing();
        }
    };

    getActionMap().put("RamusENTER_Action", ramusEnterAction);
}
 
 类所在包
 类方法
 同包方法