微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javax.swing.CellEditor的实例源码

项目:taxonaut    文件BasicHeaderEditableTableuI.java   
public void mouseDragged(MouseEvent e) {
if (shouldIgnore(e)) {
    return;
}

       repostEvent(e); 

       CellEditor editor = table.getCellEditor();         
       if (editor == null || editor.shouldSelectCell(e)) {
           Point p = e.getPoint();
           int row = table.rowAtPoint(p);
           int column = table.columnAtPoint(p);

           if (row < 0)
               return;
    table.changeSelection(row,column,false,true); 
       }
   }
项目:l2fprod-properties-editor    文件propertysheetTable.java   
@Override
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();
    }
}
项目: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();
  }
}
项目:cn1    文件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();
  }
}
项目:apache-jmeter-2.10    文件TableEditor.java   
@Override
public void focusLost(FocusEvent e) {
    final int editingRow = table.getEditingRow();
    final int editingColumn = table.getEditingColumn();
    CellEditor ce = null;
    if (editingRow != -1 && editingColumn != -1){
        ce = table.getCellEditor(editingRow,editingColumn);
    }
    Component editor = table.getEditorComponent();
    if(ce != null && (editor == null || editor != e.getoppositeComponent()))
    {
        ce.stopCellEditing();
    }
    else if(editor != null)
    {
        editor.addFocusListener(this);
    }
    this.firePropertyChange();
}
项目: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,"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);
}
项目:taxonaut    文件BasicHeaderEditableTableuI.java   
public void mousepressed(MouseEvent e)
{
    if (shouldIgnore(e)) {
        return;
    }

           Point p = e.getPoint();
           int row = table.rowAtPoint(p);
           int column = table.columnAtPoint(p);
           if (column >  -1) {
    super.mousepressed(e);
               return;
           }

           if (row < 0) 
    return;

           if (table.editCellAt(row,e)) {
               setdispatchComponent(e); 
               repostEvent(e); 
           } 
    else { 
    table.requestFocus();
    }

           CellEditor editor = table.getCellEditor(); 
           if (editor == null || editor.shouldSelectCell(e)) { 
               setValueIsAdjusting(true);
               table.changeSelection(row,e.isControlDown(),e.isShiftDown());  
    }
       }
项目:taxonaut    文件CellEditorProxy.java   
public CellEditorProxy(CellEditor editor)
   {
setCellEditor(editor);
   }
项目:taxonaut    文件CellEditorProxy.java   
public void setCellEditor(CellEditor editor)
   {
this.editor = editor;
   }
项目:taxonaut    文件CellEditorProxy.java   
public CellEditor getCellEditor()
   {
return editor;
   }
项目:taxonaut    文件NamedobjectPanel.java   
public CellEditor getCellEditor()
   {
return cellEditor;
   }
项目:ca-iris    文件CellEditorComboBoxModel.java   
public CellEditorComboBoxModel(CellEditor ce,ComboBoxModel<T> m) {
    editor = ce;
    model = m;
}
项目:breakout    文件FunctionCellEditor.java   
public FunctionCellEditor(CellEditor wrapped,Function valuetoEditor,Function editorTovalue) {
    super();
    this.wrapped = wrapped;
    this.valuetoEditor = valuetoEditor;
    this.editorTovalue = editorTovalue;
}
项目:TreeTable    文件BasicTreeTableuI.java   
private CellEditor getEditor() {
    return defaultEditor != null ? defaultEditor : treeTableEditor;
}
项目:Autonomous-Script-Manager    文件Manager.java   
private void savetoCSV(){

    if(canSave){

        if(!fileSelector.getSelectedItem().toString().equals("null")){

            table.clearSelection();
            table.getSelectionModel().clearSelection();

            CellEditor editor = table.getCellEditor();
            editor.stopCellEditing();

            try{

                String fileName = (String) fileSelector.getSelectedItem(); //Get file name

                DefaultTableModel model = (DefaultTableModel) table.getModel();

                File outFile = new File(routinesFolder.getAbsolutePath() + "/" + fileName + ".csv"); //Create file

                //Clear the file
                outFile.delete();           
                outFile.createNewFile();

                BufferedWriter writer = new BufferedWriter(new FileWriter(outFile));

                //Write data to the file from the table
                for(int row = 0; row < model.getRowCount(); row++){

                    for(int column = 0; column < model.getColumnCount(); column++){

                        Object toWrite = model.getValueAt(row,column);

                        if(toWrite == null || !(toWrite instanceof String)){

                            toWrite = " ";

                        }

                        writer.write((String)toWrite);

                        if(column != model.getColumnCount() - 1){

                            writer.write(",");

                        }

                    }

                    if(row != model.getRowCount() - 1){

                        writer.newLine();

                    }

                }

                writer.close();

            }catch(Exception e){

                e.printstacktrace();
                System.out.println(e.getSuppressed());

            }

        }

    }

}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。