use of javax.swing.JComboBox in project n2a by frothga.
the class RoundedPanel method main.
public static void main(String[] args) {
JFrame f = new EscapeFrame();
RoundedPanel r;
r = new RoundedPanel();
// r.setLayout(new BorderLayout());
// r.add(new JLabel("asdfasf"), BorderLayout.NORTH);
// r.add(new JButton("afds"), BorderLayout.CENTER);
Lay.BLtg(r, "N", Lay.BL("C", Lay.GL(2, 1, Lay.lb("Group #"), new JComboBox(new Object[] { "Mixed", "Latin Hypercube", "Monte Carlo" }), "opaque=false"), "E", Lay.BL("C", Lay.BL("W", Lay.lb("#"), "C", new JTextField(10)), "E", new IconButton(ImageUtil.getImage("cancel.gif"), "remove group!"), "opaque=false"), "bg=yellow,eb=10,opaque=false"), "C", Lay.BxL("Y", Lay.lb("adfasdf" + " Const(" + 3333 + ")"), "eb=10,opaque=false"));
Lay.BLtg(f, "C", r, "size=[500,500],center=2,visible");
}
use of javax.swing.JComboBox in project cayenne by apache.
the class ObjEntityRelationshipPanel method rebuildTable.
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);
}
}
});
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));
// Default to the first value
deleteRulesCombo.setSelectedIndex(0);
col.setCellEditor(Application.getWidgetFactory().createCellEditor(deleteRulesCombo));
tablePreferences.bind(table, null, null, null, ObjRelationshipTableModel.REL_NAME, true);
}
use of javax.swing.JComboBox in project cayenne by apache.
the class ProcedureParameterTab method rebuildTable.
protected void rebuildTable(Procedure procedure) {
ProcedureParameterTableModel model = new ProcedureParameterTableModel(procedure, eventController, this);
table.setModel(model);
table.setRowHeight(25);
table.setRowMargin(3);
// number column tweaking
TableColumn numberColumn = table.getColumnModel().getColumn(ProcedureParameterTableModel.PARAMETER_NUMBER);
DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
renderer.setHorizontalAlignment(SwingConstants.CENTER);
numberColumn.setCellRenderer(renderer);
TableColumn typesColumn = table.getColumnModel().getColumn(ProcedureParameterTableModel.PARAMETER_TYPE);
JComboBox typesEditor = Application.getWidgetFactory().createComboBox(TypesMapping.getDatabaseTypes(), true);
AutoCompletion.enable(typesEditor);
typesColumn.setCellEditor(Application.getWidgetFactory().createCellEditor(typesEditor));
// direction column tweaking
TableColumn directionColumn = table.getColumnModel().getColumn(ProcedureParameterTableModel.PARAMETER_DIRECTION);
JComboBox directionEditor = Application.getWidgetFactory().createComboBox(ProcedureParameterTableModel.PARAMETER_DIRECTION_NAMES, false);
directionEditor.setEditable(false);
directionColumn.setCellEditor(new CayenneCellEditor(directionEditor));
moveUp.setEnabled(false);
moveDown.setEnabled(false);
tablePreferences.bind(table, null, null, null);
}
use of javax.swing.JComboBox in project cayenne by apache.
the class DbEntityAttributePanel method rebuildTable.
protected void rebuildTable(DbEntity ent) {
if (table.getEditingRow() != -1 && table.getEditingColumn() != -1) {
TableCellEditor cellEditor = table.getCellEditor(table.getEditingRow(), table.getEditingColumn());
cellEditor.stopCellEditing();
}
DbAttributeTableModel model = new DbAttributeTableModel(ent, mediator, this);
table.setModel(model);
table.setRowHeight(25);
table.setRowMargin(3);
TableColumn col = table.getColumnModel().getColumn(model.typeColumnInd());
String[] types = TypesMapping.getDatabaseTypes();
JComboBox comboBox = Application.getWidgetFactory().createComboBox(types, true);
// Types.NULL makes no sense as a column type
comboBox.removeItem("NULL");
AutoCompletion.enable(comboBox);
col.setCellEditor(Application.getWidgetFactory().createCellEditor(comboBox));
tablePreferences.bind(table, null, null, null, model.nameColumnInd(), true);
}
use of javax.swing.JComboBox in project cayenne by apache.
the class EmbeddableAttributeTab method setUpTableStructure.
private void setUpTableStructure(EmbeddableAttributeTableModel model) {
TableColumn typeColumn = table.getColumnModel().getColumn(EmbeddableAttributeTableModel.OBJ_ATTRIBUTE_TYPE);
JComboBox javaTypesCombo = Application.getWidgetFactory().createComboBox(ModelerUtil.getRegisteredTypeNames(), false);
AutoCompletion.enable(javaTypesCombo, false, true);
typeColumn.setCellEditor(Application.getWidgetFactory().createCellEditor(javaTypesCombo));
tablePreferences.bind(table, null, null, null, EmbeddableAttributeTableModel.OBJ_ATTRIBUTE, true);
}
Aggregations