当前位置: 首页>>代码示例>>Java>>正文


Java TableCellEditor类代码示例

本文整理汇总了Java中javax.swing.table.TableCellEditor的典型用法代码示例。如果您正苦于以下问题:Java TableCellEditor类的具体用法?Java TableCellEditor怎么用?Java TableCellEditor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TableCellEditor类属于javax.swing.table包,在下文中一共展示了TableCellEditor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCellEditor

import javax.swing.table.TableCellEditor; //导入依赖的package包/类
@Override
public TableCellEditor getCellEditor(int row, int column) {
    if (column == 2){
        if (getModel() instanceof TableClassNamesModel) {
            TableClassNamesModel model = (TableClassNamesModel)getModel();
            Table table = model.getTableAt(row);
            DisabledReason dr = table.getDisabledReason();
            boolean existing = dr instanceof Table.ExistingDisabledReason;
            if (existing){
                return new DefaultCellEditor(new JComboBox(new UpdateType[]{UpdateType.UPDATE, UpdateType.RECREATE}));
            } else {
                return new DefaultCellEditor(new JComboBox(new UpdateType[]{UpdateType.NEW}));
            }
        }
    } 
    return super.getCellEditor(row, column);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:TableUISupport.java

示例2: getCellEditor

import javax.swing.table.TableCellEditor; //导入依赖的package包/类
@Override
public TableCellEditor getCellEditor(int row, int column) {
    if(showParamTypes) {
        String paramName = (String) tableModel.getValueAt(row, 0);
        Class type = (column == 2) ? (Class) tableModel.getValueAt(row, 1) : Boolean.class;

        if (Enum.class.isAssignableFrom(type)) {
            JComboBox combo = new JComboBox(type.getEnumConstants());
            return new DefaultCellEditor(combo);
        } else if (type == Boolean.class || type == Boolean.TYPE) {
            JCheckBox cb = new JCheckBox();
            cb.setHorizontalAlignment(JLabel.CENTER);
            cb.setBorderPainted(true);
            return new DefaultCellEditor(cb);
        } else if (paramName.toLowerCase().contains(Constants.PASSWORD)) {
            return new DefaultCellEditor(new JPasswordField());
        }
    }

    return super.getCellEditor(row, column);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:CodeSetupPanel.java

示例3: getCellEditor

import javax.swing.table.TableCellEditor; //导入依赖的package包/类
/**
 * Returns an appropriate editor for the cell specified by
 * <code>row</code> and <code>column</code>. If the
 * <code>TableColumn</code> for this column has a non-null editor,
 * returns that.  If not, finds the class of the data in this
 * column (using <code>getColumnClass</code>)
 * and returns the default editor for this type of data.
 *
 * @param row    the row of the cell to edit, where 0 is the first row
 * @param column the column of the cell to edit,
 *               where 0 is the first column
 * @return the editor for this cell;
 *         if <code>null</code> return the default editor for
 *         this type of cell
 */
@Override
public TableCellEditor getCellEditor(int row, int column) {
	switch (column) {
		case 0:
			return new BlockingTableEditor();
		case 1:
			return super.getDefaultEditor(String.class);
		case 2:
			return super.getDefaultEditor(Boolean.class);
		case 3:
			return new ButtonCellEditor(delete);
		default:
			return null;
	}
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:31,代码来源:AllBlockingRegionsPanel.java

示例4: getEditor

import javax.swing.table.TableCellEditor; //导入依赖的package包/类
/**
 * Returns an instance of editor, given search key for elements to be shown
 * @param data vector with search's key for elements to be shown
 */
public TableCellEditor getEditor(List data) {
	if (editor == null) {
		editor = new ImagedComboEditor();
	}
	LabelRenderer[] rend;
	if (allowsNull) {
		rend = new LabelRenderer[data.size() + 1];
		rend[0] = getDrawComponent(null);
		for (int i = 1; i < rend.length; i++) {
			rend[i] = getDrawComponent(data.get(i - 1));
		}
	} else {
		rend = new LabelRenderer[data.size()];
		for (int i = 0; i < data.size(); i++) {
			rend[i] = getDrawComponent(data.get(i));
		}
	}
	editor.setData(rend);
	return editor;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:25,代码来源:ImagedComboBoxCellEditorFactory.java

示例5: addColumn

import javax.swing.table.TableCellEditor; //导入依赖的package包/类
public TableColumn addColumn(Object columnIdentifier, int width,
                             TableCellRenderer renderer,
                             TableCellEditor editor, List columnData) {
    checkDefaultTableModel();

    // Set up the model side first
    DefaultTableModel m = (DefaultTableModel)getModel();
    m.addColumn(columnIdentifier, columnData.toArray());

    // The column will have been added to the end, so the index of the
    // column in the model is the last element.
    TableColumn newColumn = new TableColumn(
            m.getColumnCount()-1, width, renderer, editor);
    super.addColumn(newColumn);
    return newColumn;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:OldJTable.java

示例6: renameDomainInComponents

import javax.swing.table.TableCellEditor; //导入依赖的package包/类
/**
 * Rename domain in components.
 *
 * @param oldDomainName the old domain name
 * @param newDomainName the new domain name
 */
public void renameDomainInComponents(String oldDomainName, String newDomainName) {
	
	DefaultTableModel dtmComponents = this.getTableModel4ComponentTypes();
	int column = getColumnHeaderIndexComponents(COL_Domain);
	
	// --- Get the component type definitions from table ----
	JTable jtComponents = this.getJTable4ComponentTypes();
	// --- Confirm, apply changes in table ------------------						
	TableCellEditor tceComponents = jtComponents.getCellEditor();
	if (tceComponents!=null) {
		tceComponents.stopCellEditing();
	}
	for(int row=0; row<dtmComponents.getRowCount(); row++){
		String currValue = (String) dtmComponents.getValueAt(row, column);
		if (currValue.equals(oldDomainName)) {
			dtmComponents.setValueAt(newDomainName, row, column);	
		}
	}
	this.setTableCellEditor4DomainsInComponents(null);
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:27,代码来源:ComponentTypeDialog.java

示例7: getEditor

import javax.swing.table.TableCellEditor; //导入依赖的package包/类
/**
 * Returns an instance of editor, given search key for elements to be shown
 * @param data array with search's key for elements to be shown
 */
public TableCellEditor getEditor(Object[] data) {
	if (editor == null) {
		editor = new ImagedComboEditor();
	}
	LabelRenderer[] rend;
	if (allowsNull) {
		rend = new LabelRenderer[data.length + 1];
		rend[0] = getDrawComponent(null);
		for (int i = 1; i < rend.length; i++) {
			rend[i] = getDrawComponent(data[i - 1]);
		}
	} else {
		rend = new LabelRenderer[data.length];
		for (int i = 0; i < data.length; i++) {
			rend[i] = getDrawComponent(data[i]);
		}
	}
	editor.setData(rend);
	return editor;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:25,代码来源:ImagedComboBoxCellEditorFactory.java

示例8: editCellAt

import javax.swing.table.TableCellEditor; //导入依赖的package包/类
@Override
public final boolean editCellAt(final int row, final int column, EventObject e) {
    if (LOGGER.isLoggable(Level.FINER)) {
        LOGGER.finer("editCellAt(row="+row+", col="+column+
                ", e="+e+")");
    }
    if (JConsole.isDebug()) {
        System.err.println("edit: "+getValueName(row)+"="+getValue(row));
    }
    boolean retVal = super.editCellAt(row, column, e);
    if (retVal) {
        final TableCellEditor tableCellEditor =
                getColumnModel().getColumn(column).getCellEditor();
        if (tableCellEditor == valueCellEditor) {
            ((JComponent) tableCellEditor).requestFocus();
        }
    }
    return retVal;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:XMBeanAttributes.java

示例9: removeEditor

import javax.swing.table.TableCellEditor; //导入依赖的package包/类
public void removeEditor() {
	TableCellEditor editor = getCellEditor();
	if (editor != null) {
		editor.removeCellEditorListener(this);

		requestFocus();
		remove(editorComp);

		int index = getEditingColumn();
		Rectangle cellRect = getHeaderRect(index);

		setCellEditor(null);
		setEditingColumn(-1);
		editorComp = null;

		repaint(cellRect);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:19,代码来源:EditableTableHeader.java

示例10: editingStopped

import javax.swing.table.TableCellEditor; //导入依赖的package包/类
public void editingStopped(ChangeEvent e) {
    synchronized(mutex) {
        if (recursion) return;
        recursion = true;
    }
    try {
        // Take in the new value
        TableCellEditor editor = getCellEditor();
        if (editor != null) {
            editor.stopCellEditing();
            Object value = editor.getCellEditorValue();
            setValueAt(value, editingRow, editingColumn);
            removeEditor();
        }
    } finally {
        recursion = false;
    }
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:19,代码来源:VariableTable.java

示例11: getCellEditor

import javax.swing.table.TableCellEditor; //导入依赖的package包/类
/**
 * Returns an appropriate editor for the cell specified by
 * <code>row</code> and <code>column</code>. If the
 * <code>TableColumn</code> for this column has a non-null editor,
 * returns that.  If not, finds the class of the data in this
 * column (using <code>getColumnClass</code>)
 * and returns the default editor for this type of data.
 * <p/>
 *
 * @param row    the row of the cell to edit, where 0 is the first row
 * @param column the column of the cell to edit,
 *               where 0 is the first column
 * @return the editor for this cell;
 *         if <code>null</code> return the default editor for
 *         this type of cell
 * @see javax.swing.DefaultCellEditor
 */
@Override
public TableCellEditor getCellEditor(int row, int column) {
	LinesTableColumn columnType = getColumnType(column);
	switch (columnType) {
		case CLASS:
			return classEditor;
		case STATION:
			if (currentIndex.equals(ExactConstants.INDICES_TYPES[3])) {
				return uStationsEditor;
			} else {
				return stationsEditor;
			}
		case ALGORITHM:
			return algorithmEditor;
	}
	return null;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:35,代码来源:GraphPanel.java

示例12: getOkButton

import javax.swing.table.TableCellEditor; //导入依赖的package包/类
/**
 * Lazily creates and returns a button labelled OK that signals the editors
 * to stop editing. This makes sure that any partially edited result is not
 * lost.
 */
JButton getOkButton() {
    if (this.okButton == null) {
        this.okButton = new JButton("OK");
        this.okButton.addActionListener(new CloseListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                TableCellEditor editor = getInnerTable().getCellEditor();
                if (editor == null || editor.stopCellEditing()) {
                    super.actionPerformed(e);
                }
            }
        });
    }
    return this.okButton;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:21,代码来源:PropertiesDialog.java

示例13: TestsetComponent

import javax.swing.table.TableCellEditor; //导入依赖的package包/类
public TestsetComponent(TestExecution testExecution) {
    this.testExecution = testExecution;
    testSetTable = new XTable() {

        @Override
        public Component prepareEditor(TableCellEditor editor, int row, int column) {
            Component c = super.prepareEditor(editor, row, column);
            if (c instanceof JCheckBox) {
                JCheckBox b = (JCheckBox) c;
                b.setBackground(getSelectionBackground());
                b.setBorderPainted(true);
            }
            return c;
        }

    };
    toolBar = new TestSetToolBar(this);
    validator = new TestSetValidator(testSetTable);
    popupMenu = new TestSetPopupMenu(this);
    quickSettings = new QuickSettings(this);
    executePopupMenu = new ExecutePopupMenu();
    init();
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:24,代码来源:TestsetComponent.java

示例14: getCellEditor

import javax.swing.table.TableCellEditor; //导入依赖的package包/类
/**
 * Returns an appropriate editor for the cell specified by
 * <code>row</code> and <code>column</code>. If the
 * <code>TableColumn</code> for this column has a non-null editor,
 * returns that.  If not, finds the class of the data in this
 * column (using <code>getColumnClass</code>)
 * and returns the default editor for this type of data.
 *
 * @param row    the row of the cell to edit, where 0 is the first row
 * @param column the column of the cell to edit,
 *               where 0 is the first column
 * @return the editor for this cell;
 *         if <code>null</code> return the default editor for
 *         this type of cell
 */
@Override
public TableCellEditor getCellEditor(int row, int column) {
	switch (column) {
		case 0:
			return new BlockingTableEditor();
		case 1:
			return super.getDefaultEditor(String.class);
		case 2:
			return super.getDefaultEditor(Boolean.class);
		case 3:
			return super.getDefaultEditor(String.class);
		case 4:
			return super.getDefaultEditor(Boolean.class);
		case 5:
			return super.getDefaultEditor(String.class);
		case 6:
			return super.getDefaultEditor(Boolean.class);
		case 7:
			return new ButtonCellEditor(delete);
		default:
			return null;
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:39,代码来源:AllBlockingRegionsPanel.java

示例15: getCellEditor

import javax.swing.table.TableCellEditor; //导入依赖的package包/类
@Override
public TableCellEditor getCellEditor(int row, int column) {
	if (column == 1) {
		return comboEditor.getEditor(classTypes);
	} else if (column == 5) {
		if (getValueAt(row, 4) != null) {
			return new ButtonCellEditor(new JButton(editDistribution));
		} else {
			return getDefaultEditor(String.class);
		}
	} else if (column == 6) {
		return new ButtonCellEditor(new JButton(deleteClass));
	} else {
		return getDefaultEditor(getModel().getColumnClass(column));
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:17,代码来源:ClassesPanel.java


注:本文中的javax.swing.table.TableCellEditor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。