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


Java TableColumn.setCellEditor方法代码示例

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


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

示例1: updateViewerTable

import javax.swing.table.TableColumn; //导入方法依赖的package包/类
private void updateViewerTable() {
    // Set the data in the GUI and select the first entry in the table

    // Tell the node model which column is the class column
    m_classViewerTable.setClassColumn(m_nodeModel.getClassColumnName(),
            m_nodeModel.getClassColumnIndex());

    m_classViewerTable.updateEntries(m_classMap.keySet(),
            m_nodeModel.getRowMap(), m_nodeModel.getColNames());
    m_gui.m_hiliteTable.changeSelection(0, 0, false, false); // Select first
    // entry

    // Set the CellEditor
    final int classColumnIndex = m_classViewerTable.getClassColumnIndex();

    final TableColumn classColumn = m_gui.m_hiliteTable.getColumnModel()
            .getColumn(classColumnIndex); // get the column with
    // that index
    classColumn.setCellEditor(m_classCellEditor);
    classColumn.setCellRenderer(m_classCellRenderer);
}
 
开发者ID:knime,项目名称:knime-activelearning,代码行数:22,代码来源:ActiveLearnLoopEndNodeViewListener.java

示例2: setUpSportColumn

import javax.swing.table.TableColumn; //导入方法依赖的package包/类
public void setUpSportColumn(JTable table, TableColumn sportColumn) {
    // Set up the editor for the sport cells.
    JComboBox comboBox = new JComboBox();
    comboBox.addItem("Snowboarding");
    comboBox.addItem("Rowing");
    comboBox.addItem("Knitting");
    comboBox.addItem("Speed reading");
    comboBox.addItem("Pool");
    comboBox.addItem("None of the above");
    sportColumn.setCellEditor(new DefaultCellEditor(comboBox));

    // Set up tool tips for the sport cells.
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setToolTipText("Click for combo box");
    sportColumn.setCellRenderer(renderer);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:17,代码来源:TableRenderDemo.java

示例3: Test6505027

import javax.swing.table.TableColumn; //导入方法依赖的package包/类
public Test6505027(JFrame main) {
    Container container = main;
    if (INTERNAL) {
        JInternalFrame frame = new JInternalFrame();
        frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT);
        frame.setVisible(true);

        JDesktopPane desktop = new JDesktopPane();
        desktop.add(frame, new Integer(1));

        container.add(desktop);
        container = frame;
    }
    if (TERMINATE) {
        this.table.putClientProperty(KEY, Boolean.TRUE);
    }
    TableColumn column = this.table.getColumn(COLUMNS[1]);
    column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS)));

    container.add(BorderLayout.NORTH, new JTextField());
    container.add(BorderLayout.CENTER, new JScrollPane(this.table));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:Test6505027.java

示例4: setupVariationFunctionComboBoxColumn

import javax.swing.table.TableColumn; //导入方法依赖的package包/类
public void setupVariationFunctionComboBoxColumn() {

		if (parentController.getMainPanel().getVariationPerParameterTable().getColumnModel() != null) {

			JComboBox comboBox = new JComboBox();
			JComboBox comboBoxRender = new JComboBox();
			this.populateTypeComboBox(comboBox);
			this.populateTypeComboBox(comboBoxRender);

            TableColumn column = parentController.getMainPanel()
						.getVariationPerParameterTable()
						.getColumnModel()
						.getColumn(
								VariationPerParameterTableModel.COLUMN_VARIATION_TYPE);

			column.setCellEditor(new DefaultCellEditor(comboBox));
			TableRenderer cellRenderer = new TableRenderer(comboBoxRender);
			column.setCellRenderer(cellRenderer);
		}
	}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:21,代码来源:VariationPerParameterTableController.java

示例5: RunPortBindingsVisual

import javax.swing.table.TableColumn; //导入方法依赖的package包/类
/**
 * Creates new form RunNetworkVisual
 */
public RunPortBindingsVisual(DockerImageDetail info) {
    initComponents();
    this.info = info;

    addExposedButton.setEnabled(info != null && !info.getExposedPorts().isEmpty());
    portMappingTable.setModel(model);
    UiUtils.configureRowHeight(portMappingTable);

    TableColumn typeColumn = portMappingTable.getColumnModel().getColumn(0);
    JComboBox typeCombo = new JComboBox(ExposedPort.Type.values());
    typeColumn.setCellEditor(new DefaultCellEditor(typeCombo));
    typeColumn.setPreferredWidth(typeColumn.getPreferredWidth() / 2);

    TableColumn portColumn = portMappingTable.getColumnModel().getColumn(2);
    portColumn.setCellRenderer(new CellRenderer("<random>", false));

    TableColumn addressColumn = portMappingTable.getColumnModel().getColumn(3);
    JComboBox addressCombo = new JComboBox(UiUtils.getAddresses(false, false).toArray());
    addressCombo.setEditable(true);
    addressColumn.setCellEditor(new DefaultCellEditor(addressCombo));
    addressColumn.setCellRenderer(new CellRenderer("<any>", false));
    addressColumn.setPreferredWidth(addressColumn.getPreferredWidth() * 2);

    portMappingTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
    model.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            changeSupport.fireChange();
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:RunPortBindingsVisual.java

示例6: setCellEditors

import javax.swing.table.TableColumn; //导入方法依赖的package包/类
public void setCellEditors(JTable tbl) {
    TableColumn thisCol;

    JComboBox descEditor = new JComboBox(strDesc);
    descEditor.setEditable(true);
    thisCol = tbl.getColumnModel().getColumn(1);
    thisCol.setCellEditor(new DefaultCellEditor(descEditor));

    JComboBox nameEditor = new JComboBox(strUTF);
    nameEditor.setEditable(true);
    thisCol = tbl.getColumnModel().getColumn(2);
    thisCol.setCellEditor(new DefaultCellEditor(nameEditor));
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:14,代码来源:LocalVariableTableAttribTableModel.java

示例7: refreshRenderEditorTblSeriesSettings

import javax.swing.table.TableColumn; //导入方法依赖的package包/类
/**
 * Refreshes renderer and editors of the series table.
 */
private void refreshRenderEditorTblSeriesSettings() {
	
	TableColumnModel tcm = this.getTblSeriesSettings().getColumnModel();
	
	TableColumn colorColumn = tcm.getColumn(1);
	colorColumn.setCellEditor(this.getCellEditorColor());
	colorColumn.setCellRenderer(this.getCellRenderer4Color());
	
	TableColumn columnWidth = tcm.getColumn(2);
	columnWidth.setCellEditor(this.getCellEditorSpinner());
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:15,代码来源:ChartSettingsTab.java

示例8: setColumnEditors

import javax.swing.table.TableColumn; //导入方法依赖的package包/类
private void setColumnEditors() {
    TableColumnModel tcm = getColumnModel();
    for (int i = 0; i < columnNames.length; i++) {
        TableColumn tc = tcm.getColumn(i);
        if (isColumnEditable(i)) {
            tc.setCellEditor(valueCellEditor);
        } else {
            tc.setCellEditor(editor);
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:XMBeanAttributes.java

示例9: updateVariationFunctionParametersTable

import javax.swing.table.TableColumn; //导入方法依赖的package包/类
/**
    * Update the PDFDefinition Parameters Table.
    */
private void updateVariationFunctionParametersTable() {
	// Populate the correlation model parameters table.
	FunctionParameterTableModel parameterTableModel = new FunctionParameterTableModel(this.currentVariationFunctionContext);

	parentController.getMainPanel().getvariationPerParameterSidePanel().getParametersTable()
	        .setModel(parameterTableModel);

	//setup cell editor.
   	TableColumn columnValue = parentController.getMainPanel().getvariationPerParameterSidePanel()
   	    .getParametersTable().getColumnModel().getColumn(FunctionParameterTableModel.COLUMN_VALUE);
   	columnValue.setCellEditor(new TextCellEditor());
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:16,代码来源:VariationPerParameterTableController.java

示例10: initTable

import javax.swing.table.TableColumn; //导入方法依赖的package包/类
private void initTable() {
	String[] columnNames = {"��Ʒ����", "��Ʒ���", "��Ӧ��", "����", "��λ", "���", "����",
			"����", "��װ", "����", "��׼�ĺ�"};
	((DefaultTableModel) table.getModel())
			.setColumnIdentifiers(columnNames);
	TableColumn column = table.getColumnModel().getColumn(0);
	final DefaultCellEditor editor = new DefaultCellEditor(sp);
	editor.setClickCountToStart(2);
	column.setCellEditor(editor);
}
 
开发者ID:Edward7Zhang,项目名称:SuperMarketManageSystem,代码行数:11,代码来源:XiaoShouTuiHuo.java

示例11: setCellEditors

import javax.swing.table.TableColumn; //导入方法依赖的package包/类
/**
 * Sets appropriate editors for the columns.
 *
 * @param tbl The table for which to set column editors.
 */
public void setCellEditors(JTable tbl) {
    TableColumn thisCol;

    final JButton btnEditor = new JButton();
    final AccessFlagEditor flgEditor = new AccessFlagEditor(btnEditor);
    final AccessFlagEditorDialog flgEditorDlg = new AccessFlagEditorDialog(getFrameFrom(tbl), true);
    flgEditorDlg.setValidAccessFlags(AccessFlags.getValidFlags(AccessFlags.METHOD_VALID_FLAGS));

    thisCol = tbl.getColumnModel().getColumn(1);
    thisCol.setCellEditor(flgEditor);

    btnEditor.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            flgEditorDlg.setAccessFlags(flgEditor.currFlags);
            flgEditorDlg.setLocationRelativeTo((Component) btnEditor);
            flgEditorDlg.show();
        }
    });

    JComboBox nameEditor = new JComboBox(strUTF);
    nameEditor.setEditable(true);
    thisCol = tbl.getColumnModel().getColumn(2);
    thisCol.setCellEditor(new DefaultCellEditor(nameEditor));

    JComboBox descEditor = new JComboBox(strDesc);
    descEditor.setEditable(true);
    thisCol = tbl.getColumnModel().getColumn(3);
    thisCol.setCellEditor(new DefaultCellEditor(descEditor));
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:35,代码来源:MethodTableModel.java

示例12: setCellEditors

import javax.swing.table.TableColumn; //导入方法依赖的package包/类
/**
 * Sets appropriate editors for the columns.
 *
 * @param tbl The table for which to set column editors.
 */
public void setCellEditors(JTable tbl) {
    TableColumn thisCol;

    JComboBox descEditor = new JComboBox(strDesc);
    descEditor.setEditable(true);
    thisCol = tbl.getColumnModel().getColumn(1);
    thisCol.setCellEditor(new DefaultCellEditor(descEditor));
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:14,代码来源:CodeExceptionsListTableModel.java

示例13: QueryBuilderInputTable

import javax.swing.table.TableColumn; //导入方法依赖的package包/类
public QueryBuilderInputTable(QueryBuilder queryBuilder) {

        super();

	Log.getLogger().entering("QueryBuilderInputTable", "constructor"); // NOI18N

        _queryBuilder = queryBuilder;

        QueryBuilderInputTableModel queryBuilderInputTableModel = new QueryBuilderInputTableModel();

        super.setModel( queryBuilderInputTableModel );

        TableColumn column = this.getColumnModel().getColumn(Column_COLUMN);
        column.setPreferredWidth(Column_COLUMN_WIDTH);

        column = this.getColumnModel().getColumn(Alias_COLUMN);
        column.setPreferredWidth(Alias_COLUMN_WIDTH);
        column.setCellEditor(new FocusCellEditor(new JTextField()));

        column = this.getColumnModel().getColumn(Table_COLUMN);
        column.setPreferredWidth(Table_COLUMN_WIDTH);

        column = this.getColumnModel().getColumn(SortType_COLUMN);
        column.setPreferredWidth(SortType_COLUMN_WIDTH);

        column = this.getColumnModel().getColumn(SortOrder_COLUMN);
        column.setPreferredWidth(SortOrder_COLUMN_WIDTH);

        column = this.getColumnModel().getColumn(Criteria_COLUMN);
        column.setPreferredWidth(Criteria_COLUMN_WIDTH);
        column.setCellEditor(new FocusCellEditor(new JTextField()));

        column = this.getColumnModel().getColumn(CriteriaOrder_COLUMN);
        column.setPreferredWidth(CriteriaOrder_COLUMN_WIDTH);

        this.getColumnModel().getColumn(0).setCellEditor(
            new FocusCellEditor(new JTextField()));

        final Object[] sortTypeItems = {
            "", 
            NbBundle.getMessage(QueryBuilderInputTable.class, "ASCENDING"), // NOI18N
            NbBundle.getMessage(QueryBuilderInputTable.class, "DESCENDING") // NOI18N
        }; 
        TableColumn sortTypeColumn = this.getColumnModel().getColumn(SortType_COLUMN);
        JComboBox sortTypeComboBox = new JComboBox(sortTypeItems);
        sortTypeColumn.setCellEditor(new DefaultCellEditor(sortTypeComboBox));
        sortTypeComboBox.addItemListener(this);

        final Object[] sortOrderItems = {""};       // NOI18N
        TableColumn sortOrderColumn = this.getColumnModel().getColumn(SortOrder_COLUMN);
        _sortOrderComboBox = new JComboBox(sortOrderItems);
        sortOrderColumn.setCellEditor(new DefaultCellEditor(_sortOrderComboBox));
        _sortOrderComboBox.addItemListener(this);

        final Object[] criteriaOrderItems = {""};       // NOI18N
        TableColumn criteriaOrderColumn = this.getColumnModel().getColumn(CriteriaOrder_COLUMN);
        _criteriaOrderComboBox = new JComboBox(criteriaOrderItems);
        criteriaOrderColumn.setCellEditor(new DefaultCellEditor(_criteriaOrderComboBox));
//        _criteriaOrderComboBox.addItemListener(this);

        this.setAutoResizeMode (JTable.AUTO_RESIZE_OFF);
        _inputTablePopup = createInputTablePopup();
        MouseListener inputTablePopupListener = new InputTablePopupListener();
        super.addMouseListener(inputTablePopupListener);
        this.setMinimumSize(new Dimension (200, 200) );
        this.setBackground(Color.white);
        this.getTableHeader().setReorderingAllowed (false);

        addKeyListener(this);

//        this.getModel().addTableModelListener(this);

// Listen for checkbox selections in output column; handled by tableChange event instead
//          TableColumn outputColumn = this.getColumnModel().getColumn(Output_COLUMN);
//          JCheckBox outputCheckBox = new JCheckBox();
//          outputColumn.setCellEditor(new DefaultCellEditor(outputCheckBox));
//          outputCheckBox.addItemListener(this);
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:79,代码来源:QueryBuilderInputTable.java

示例14: generateTableWhere

import javax.swing.table.TableColumn; //导入方法依赖的package包/类
void generateTableWhere (QueryModel query) {

        if (DEBUG) 
            System.out.println(
                "Entering QueryBuilderInputTable.generateTableWhere"); // NOI18N

        boolean needsCriteriaOrder = false;
        int criteriaCount=0;
        String[] criteriaOrderItems = null;
        Where where=query.getWhere();
        if (where!=null) {

            // Iterate through the where condition list
            // For each one
            //     - get the tableSpec.columnName
            //     - find it in the list, and update the criteria column
            //     - if not found, insert a row  (shouldn't happen)
            Expression expr = where.getExpression();
            if (expr != null) {
                criteriaCount = 1; // there is something, if it's not an AND it's a 1 expression item in terms of criteria count
                if (expr instanceof Predicate) {
                    needsCriteriaOrder = true;
                    generatePredicateInTableWhere((Predicate)expr, 0, needsCriteriaOrder);                    
                }
                else if (expr instanceof And) {
                    needsCriteriaOrder = true;
                    ExpressionList andExpr = (ExpressionList)expr;
                    criteriaCount=andExpr.size();
                    for (int i=0; i<criteriaCount; i++) {
                        expr = andExpr.getExpression(i);
                        if (expr instanceof Predicate) {
                            Predicate pred = (Predicate)expr;
                            generatePredicateInTableWhere(pred, i, needsCriteriaOrder);
                        }
                    }
                }
            }
        }

        // Update the Criteria Order combobox if necessary
        //if (_criteriaOrderComboBox.getItemCount() != criteriaCount+1) {
            criteriaOrderItems = new String[criteriaCount+1];
            criteriaOrderItems[0]="";       // NOI18N
            TableColumn criteriaOrderColumn = this.getColumnModel().getColumn(CriteriaOrder_COLUMN);
            if (needsCriteriaOrder) {
                for (int i=0; i<criteriaCount; i++) 
                    criteriaOrderItems[i+1]=String.valueOf(i+1);
            }
            _criteriaOrderComboBox = new JComboBox(criteriaOrderItems);
            criteriaOrderColumn.setCellEditor(new DefaultCellEditor(_criteriaOrderComboBox));
            // _criteriaOrderComboBox.addItemListener(this);
        //}
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:54,代码来源:QueryBuilderInputTable.java

示例15: setTableCellEditor4DomainsInComponents

import javax.swing.table.TableColumn; //导入方法依赖的package包/类
/**
 * Sets the table CellEditor for domains in components.
 * @param domainVector the string vector of the current domains
 */
public void setTableCellEditor4DomainsInComponents(Vector<String> domainVector){
	TableColumnModel tcm = this.getJTable4ComponentTypes().getColumnModel();
	TableColumn domainColumn = tcm.getColumn(getColumnHeaderIndexComponents(COL_Domain));
	domainColumn.setCellEditor(new TableCellEditor4Combo(this.getJComboBoxDomains(domainVector)));
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:10,代码来源:ComponentTypeDialog.java


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