本文整理匯總了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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;
}
});
}
示例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);
}
示例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));
}
示例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());
}
示例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());
}
}
示例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;
}
示例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);
}
示例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));
}