當前位置: 首頁>>代碼示例>>Java>>正文


Java CellEditor類代碼示例

本文整理匯總了Java中javax.swing.CellEditor的典型用法代碼示例。如果您正苦於以下問題:Java CellEditor類的具體用法?Java CellEditor怎麽用?Java CellEditor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CellEditor類屬於javax.swing包,在下文中一共展示了CellEditor類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: mouseDragged

import javax.swing.CellEditor; //導入依賴的package包/類
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); 
       }
   }
 
開發者ID:nomencurator,項目名稱:taxonaut,代碼行數:19,代碼來源:BasicHeaderEditableTableUI.java

示例2: actionPerformed

import javax.swing.CellEditor; //導入依賴的package包/類
@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();
    }
}
 
開發者ID:ZenHarbinger,項目名稱:l2fprod-properties-editor,代碼行數:20,代碼來源:PropertySheetTable.java

示例3: actionPerformed

import javax.swing.CellEditor; //導入依賴的package包/類
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();
  }
}
 
開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:17,代碼來源:PropertySheetTable.java

示例4: focusLost

import javax.swing.CellEditor; //導入依賴的package包/類
@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();
}
 
開發者ID:botelhojp,項目名稱:apache-jmeter-2.10,代碼行數:20,代碼來源:TableEditor.java

示例5: TableEditorTable

import javax.swing.CellEditor; //導入依賴的package包/類
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);
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:32,代碼來源:TableEditorTable.java

示例6: mousePressed

import javax.swing.CellEditor; //導入依賴的package包/類
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, column, e)) {
               setDispatchComponent(e); 
               repostEvent(e); 
           } 
    else { 
	table.requestFocus();
    }
       	
           CellEditor editor = table.getCellEditor(); 
           if (editor == null || editor.shouldSelectCell(e)) { 
               setValueIsAdjusting(true);
               table.changeSelection(row, column, e.isControlDown(), e.isShiftDown());  
    }
       }
 
開發者ID:nomencurator,項目名稱:taxonaut,代碼行數:32,代碼來源:BasicHeaderEditableTableUI.java

示例7: CellEditorProxy

import javax.swing.CellEditor; //導入依賴的package包/類
public CellEditorProxy(CellEditor editor)
   {
setCellEditor(editor);
   }
 
開發者ID:nomencurator,項目名稱:taxonaut,代碼行數:5,代碼來源:CellEditorProxy.java

示例8: setCellEditor

import javax.swing.CellEditor; //導入依賴的package包/類
public void setCellEditor(CellEditor editor)
   {
this.editor = editor;
   }
 
開發者ID:nomencurator,項目名稱:taxonaut,代碼行數:5,代碼來源:CellEditorProxy.java

示例9: getCellEditor

import javax.swing.CellEditor; //導入依賴的package包/類
public CellEditor getCellEditor()
   {
return editor;
   }
 
開發者ID:nomencurator,項目名稱:taxonaut,代碼行數:5,代碼來源:CellEditorProxy.java

示例10: getCellEditor

import javax.swing.CellEditor; //導入依賴的package包/類
public CellEditor getCellEditor()
   {
return cellEditor;
   }
 
開發者ID:nomencurator,項目名稱:taxonaut,代碼行數:5,代碼來源:NamedObjectPanel.java

示例11: CellEditorComboBoxModel

import javax.swing.CellEditor; //導入依賴的package包/類
public CellEditorComboBoxModel(CellEditor ce, ComboBoxModel<T> m) {
	editor = ce;
	model = m;
}
 
開發者ID:CA-IRIS,項目名稱:ca-iris,代碼行數:5,代碼來源:CellEditorComboBoxModel.java

示例12: FunctionCellEditor

import javax.swing.CellEditor; //導入依賴的package包/類
public FunctionCellEditor(CellEditor wrapped, Function valueToEditor, Function editorToValue) {
	super();
	this.wrapped = wrapped;
	this.valueToEditor = valueToEditor;
	this.editorToValue = editorToValue;
}
 
開發者ID:jedwards1211,項目名稱:breakout,代碼行數:7,代碼來源:FunctionCellEditor.java

示例13: getEditor

import javax.swing.CellEditor; //導入依賴的package包/類
private CellEditor getEditor() {
	return defaultEditor != null ? defaultEditor : treeTableEditor;
}
 
開發者ID:Sciss,項目名稱:TreeTable,代碼行數:4,代碼來源:BasicTreeTableUI.java

示例14: saveToCSV

import javax.swing.CellEditor; //導入依賴的package包/類
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());
				
			}
			
		}
		
	}
	
}
 
開發者ID:FRC-Team2655,項目名稱:Autonomous-Script-Manager,代碼行數:72,代碼來源:Manager.java


注:本文中的javax.swing.CellEditor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。