List of usage examples for javax.swing JComboBox setFocusable
public void setFocusable(boolean focusable)
From source file:org.apache.cayenne.modeler.editor.ObjEntityRelationshipPanel.java
protected void rebuildTable(ObjEntity entity) { final ObjRelationshipTableModel model = new ObjRelationshipTableModel(entity, mediator, this); model.addTableModelListener(new TableModelListener() { public void tableChanged(TableModelEvent e) { if (table.getSelectedRow() >= 0) { ObjRelationship rel = model.getRelationship(table.getSelectedRow()); enabledResolve = rel.getSourceEntity().getDbEntity() != null; resolveMenu.setEnabled(enabledResolve); }/*from w ww .j ava 2 s . c o m*/ } }); table.setModel(model); table.setRowHeight(25); table.setRowMargin(3); TableColumn col = table.getColumnModel().getColumn(ObjRelationshipTableModel.REL_TARGET_PATH); col.setCellEditor(new DbRelationshipPathComboBoxEditor()); col.setCellRenderer(new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); setToolTipText( "To choose relationship press enter two times.To choose next relationship press dot."); return this; } }); col = table.getColumnModel().getColumn(ObjRelationshipTableModel.REL_DELETE_RULE); JComboBox deleteRulesCombo = Application.getWidgetFactory().createComboBox(DELETE_RULES, false); deleteRulesCombo.setFocusable(false); deleteRulesCombo.setEditable(true); ((JComponent) deleteRulesCombo.getEditor().getEditorComponent()).setBorder(null); deleteRulesCombo.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); deleteRulesCombo.setSelectedIndex(0); // Default to the first value col.setCellEditor(Application.getWidgetFactory().createCellEditor(deleteRulesCombo)); tablePreferences.bind(table, null, null, null, ObjRelationshipTableModel.REL_NAME, true); }