Search in sources :

Example 71 with JComboBox

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");
}
Also used : EscapeFrame(replete.gui.windows.EscapeFrame) JComboBox(javax.swing.JComboBox) IconButton(replete.gui.controls.IconButton) JFrame(javax.swing.JFrame) JTextField(javax.swing.JTextField)

Example 72 with JComboBox

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);
}
Also used : ObjRelationship(org.apache.cayenne.map.ObjRelationship) DbRelationshipPathComboBoxEditor(org.apache.cayenne.modeler.util.DbRelationshipPathComboBoxEditor) JComboBox(javax.swing.JComboBox) TableModelEvent(javax.swing.event.TableModelEvent) JComponent(javax.swing.JComponent) TableColumn(javax.swing.table.TableColumn) DefaultTableCellRenderer(javax.swing.table.DefaultTableCellRenderer) TableModelListener(javax.swing.event.TableModelListener) JTable(javax.swing.JTable) Component(java.awt.Component) JComponent(javax.swing.JComponent)

Example 73 with JComboBox

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);
}
Also used : JComboBox(javax.swing.JComboBox) TableColumn(javax.swing.table.TableColumn) DefaultTableCellRenderer(javax.swing.table.DefaultTableCellRenderer) CayenneCellEditor(org.apache.cayenne.modeler.util.CayenneCellEditor)

Example 74 with JComboBox

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);
}
Also used : JComboBox(javax.swing.JComboBox) TableCellEditor(javax.swing.table.TableCellEditor) TableColumn(javax.swing.table.TableColumn)

Example 75 with JComboBox

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);
}
Also used : JComboBox(javax.swing.JComboBox) TableColumn(javax.swing.table.TableColumn)

Aggregations

JComboBox (javax.swing.JComboBox)226 JLabel (javax.swing.JLabel)97 JPanel (javax.swing.JPanel)88 ActionEvent (java.awt.event.ActionEvent)69 ActionListener (java.awt.event.ActionListener)66 JButton (javax.swing.JButton)55 GridBagLayout (java.awt.GridBagLayout)42 GridBagConstraints (java.awt.GridBagConstraints)41 Insets (java.awt.Insets)40 Dimension (java.awt.Dimension)39 JScrollPane (javax.swing.JScrollPane)37 JTextField (javax.swing.JTextField)36 BoxLayout (javax.swing.BoxLayout)34 JCheckBox (javax.swing.JCheckBox)33 DefaultCellEditor (javax.swing.DefaultCellEditor)27 JTable (javax.swing.JTable)26 BorderLayout (java.awt.BorderLayout)25 Component (java.awt.Component)25 TableColumn (javax.swing.table.TableColumn)23 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)22