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


Java DefaultCellEditor類代碼示例

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


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

示例1: getCellEditor

import javax.swing.DefaultCellEditor; //導入依賴的package包/類
public TableCellEditor getCellEditor(int row, int col) 
{
	TableCellEditor ed;
	if(col == TREE_COLUMN)
	{
		treeEditor.setBaseEditor(super.getCellEditor(row, col));
		ed = treeEditor;
	}
	else
	{
		ed = super.getCellEditor(row, col);
	}
	
	// FIX does not help: first typed symbol gets eaten

	// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4222149
	if(ed instanceof DefaultCellEditor)
	{
		((DefaultCellEditor)ed).setClickCountToStart(0);
	}

	return ed;
}
 
開發者ID:andy-goryachev,項目名稱:PasswordSafe,代碼行數:24,代碼來源:CTreeTable.java

示例2: getCellEditor

import javax.swing.DefaultCellEditor; //導入依賴的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

示例3: getCellEditor

import javax.swing.DefaultCellEditor; //導入依賴的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

示例4: getCellEditor

import javax.swing.DefaultCellEditor; //導入依賴的package包/類
@Override
public TableCellEditor getCellEditor(int row, int column) {
	List<String> usedTypes = new LinkedList<String>();
	for (int i = 0; i < Ontology.VALUE_TYPE_NAMES.length; i++) {
		if ((i != Ontology.ATTRIBUTE_VALUE) && (i != Ontology.FILE_PATH)
				&& (!Ontology.ATTRIBUTE_VALUE_TYPE.isA(i, Ontology.DATE_TIME))) {
			usedTypes.add(Ontology.ATTRIBUTE_VALUE_TYPE.mapIndex(i));
		}
	}
	String[] valueTypes = new String[usedTypes.size()];
	int vCounter = 0;
	for (String type : usedTypes) {
		valueTypes[vCounter++] = type;
	}
	JComboBox typeBox = new JComboBox(valueTypes);
	typeBox.setBackground(javax.swing.UIManager.getColor("Table.cellBackground"));
	return new DefaultCellEditor(typeBox);
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:19,代碼來源:ExampleSourceConfigurationWizardValueTypeTable.java

示例5: gotFocus

import javax.swing.DefaultCellEditor; //導入依賴的package包/類
@Override
public void gotFocus() {				
	
	this.sync();			
	this.refreshComponents();		
	stTable.update();
	stTable.updateStructure();
	StationCombo = new ComboBoxCell(stationNames);			
	JComboBox stationBox = new JComboBox(stationNames);	
	stationBox.setEditable(false);
	ComboBoxRenderer renderer = new ComboBoxRenderer(stationBox);
	renderer.setColors(colors);
       renderer.setStrings(stationNames);
       stationBox.setRenderer(renderer);
       
	stationEditor = new DefaultCellEditor(stationBox);
									
}
 
開發者ID:max6cn,項目名稱:jmt,代碼行數:19,代碼來源:ReferenceStationPanel.java

示例6: setUpSportColumn

import javax.swing.DefaultCellEditor; //導入依賴的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

示例7: setupVariationFunctionComboBoxColumn

import javax.swing.DefaultCellEditor; //導入依賴的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

示例8: createEditors

import javax.swing.DefaultCellEditor; //導入依賴的package包/類
protected void createEditors() {
	setDefaultEditor(Boolean.class, new DefaultCellEditor(new JCheckBox()) {
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;

		@Override
		public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
			Component c = super.getTableCellEditorComponent(table, value, isSelected, row, column);
			if (value instanceof Boolean) {
				c.setBackground(Color.WHITE);
				c.setVisible(false);
			}
			return c;
		}
	});
}
 
開發者ID:HOMlab,項目名稱:QN-ACTR-Release,代碼行數:19,代碼來源:ConnectionsPanel.java

示例9: createBaseQualifierEditor

import javax.swing.DefaultCellEditor; //導入依賴的package包/類
private TableCellEditor createBaseQualifierEditor() {
    List<Qualifier> qualifiers = engine.getQualifiers();
    Collections.sort(qualifiers, new Comparator<Qualifier>() {
        @Override
        public int compare(Qualifier o1, Qualifier o2) {
            return collator.compare(o1.getName(), o2.getName());
        }
    });

    JComboBox box = new JComboBox();

    box.addItem(null);
    for (Qualifier qualifier : qualifiers)
        box.addItem(qualifier);

    return new DefaultCellEditor(box);
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:18,代碼來源:TableCellEditorFactory.java

示例10: Test6505027

import javax.swing.DefaultCellEditor; //導入依賴的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

示例11: fillPlan

import javax.swing.DefaultCellEditor; //導入依賴的package包/類
public void fillPlan(SelfSituation plan) {
    this.plan = plan;
    // запомним старые значения на случай отката
    oldValues.clear();
    for (SelfService service : plan.getSelfservices()) {
        if (service.isFlexy()) {
            oldValues.put(service.getId(), service.getPriority());
        }
    }

    tablePlan.setModel(new FlexPriorityMableModel(plan));

    JComboBox<String> cb = new JComboBox<>();
    /*
     cb.addItem(Uses.get_COEFF_WORD().get(Uses.SERVICE_REMAINS));
     cb.addItem(Uses.get_COEFF_WORD().get(Uses.SERVICE_NORMAL));
     cb.addItem(Uses.get_COEFF_WORD().get(Uses.SERVICE_VIP));
     */
    Uses.get_COEFF_WORD().values().forEach(pr -> cb.addItem(pr));
    TableCellEditor editor = new DefaultCellEditor(cb);
    TableColumnModel cm = tablePlan.getColumnModel();
    TableColumn tc = cm.getColumn(1);
    tc.setCellEditor(editor);

    tablePlan.setDefaultRenderer(SelfService.class, new FlexPriorityCell());
}
 
開發者ID:bcgov,項目名稱:sbc-qsystem,代碼行數:27,代碼來源:FServicePriority.java

示例12: editingStopped

import javax.swing.DefaultCellEditor; //導入依賴的package包/類
public void editingStopped(ChangeEvent e) {  
   TrackModel model = (TrackModel) getModel();
  	    int row = getSelectedRow();
  	    int col = getSelectedColumn();
  	    try {
  	        DefaultCellEditor ce = (DefaultCellEditor) e.getSource();
  	        JTextField c = (JTextField) ce.getComponent();

// Extract value from cell and convert to double.
       double time = Double.valueOf(c.getText()).doubleValue();

Track track = model.getTrackList().getTrack(row);

// Playing time can not be longer than duration.
time = Math.min(time, track.getDuration().getSeconds());

  	        model.setPlayingTime(row, time);
  	    } catch (Exception ex) {
  	        ex.printStackTrace();
  	        System.out.println(ex.getClass().getName());
  	    }
      }
 
開發者ID:champtar,項目名稱:fmj-sourceforge-mirror,代碼行數:23,代碼來源:TrackTable.java

示例13: createColumn

import javax.swing.DefaultCellEditor; //導入依賴的package包/類
private TableColumn createColumn(int colIndex, boolean defaultWidth) {
	TableColumn column = new SpreadsheetColumn(defaultWidth);
	column.setModelIndex(colIndex);
	column.setHeaderValue(getColumnHeaderValue(colIndex));
	column.setHeaderRenderer(renderer);
	
	// TASK:UNEDITCOM
	String name = getColumnId(colIndex);
	if (name.equals(propertiesCommentsColumn)) {
		column.setCellEditor(new DefaultCellEditor(new JTextField()){
			public boolean isCellEditable(EventObject anEvent) {
				return false;
			}
		});
	}
	
	return column;
}
 
開發者ID:epics-extensions,項目名稱:VisualDCT,代碼行數:19,代碼來源:SpreadsheetColumnViewModel.java

示例14: setSkeleton

import javax.swing.DefaultCellEditor; //導入依賴的package包/類
public void setSkeleton(SkeletonBean skel)
{
	m_name.setText(skel.getShortName());
	m_description.setText(skel.getDescription());
	m_categoryName.setText(skel.getResourceCategory());
	m_jarId.setText(new Integer(skel.getResourceJarId()).toString());
	m_propsId.setText(new Integer(skel.getResourcePropsId()).toString());
	m_exeName.setText(skel.getExecutableName());
               m_cbDebug.setSelected(skel.isDebug());
	
	m_model = new SkeletonPropertyTableModel(skel.getSkeletonProperties());
	TableColumn type = m_propTable.getColumnModel().getColumn(3);
	JComboBox typeCombo = new JComboBox();
	typeCombo.addItem(SkeletonProperty.TYPE_STRING);
	typeCombo.addItem(SkeletonProperty.TYPE_TEXTAREA);
	typeCombo.addItem(SkeletonProperty.TYPE_BOOLEAN);
	type.setCellEditor(new DefaultCellEditor(typeCombo));
	
	m_propTable.setModel(m_model);
}
 
開發者ID:BisonSchweizAG,項目名稱:JSmooth,代碼行數:21,代碼來源:SkeletonEditor.java

示例15: ChannelRoutingTable

import javax.swing.DefaultCellEditor; //導入依賴的package包/類
ChannelRoutingTable() {
	super(new ChannelRoutingTableModel());
	
	JComboBox cb = new JComboBox();
	int devId = channel.getAudioOutputDevice();
	AudioDeviceModel adm = CC.getSamplerModel().getAudioDeviceById(devId);
	
	if(adm == null) {
		setEnabled(false);
	} else {
		int chns = adm.getDeviceInfo().getAudioChannelCount();
		for(Integer i = 0; i < chns; i++) cb.addItem(i);
	}

	TableColumn column = getColumnModel().getColumn(1);
	column.setCellEditor(new DefaultCellEditor(cb));
}
 
開發者ID:lxlxlo,項目名稱:LS-jsampler,代碼行數:18,代碼來源:JSChannelOutputRoutingDlg.java


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