Search in sources :

Example 91 with DefaultComboBoxModel

use of javax.swing.DefaultComboBoxModel in project pcgen by PCGen.

the class NotesView method initEditingComponents.

private void initEditingComponents() {
    bulletButton.setIcon(Icons.stock_list_bulet.getImageIcon());
    bulletButton.setToolTipText("Bulleted List");
    enumButton.setIcon(Icons.stock_list_enum.getImageIcon());
    enumButton.setToolTipText("Numbered List");
    enumButton.setText("");
    bulletButton.setText("");
    Vector<String> fontVector = new Vector<>();
    fontVector.add("8");
    fontVector.add("10");
    fontVector.add("12");
    fontVector.add("14");
    fontVector.add("16");
    fontVector.add("18");
    fontVector.add("24");
    fontVector.add("36");
    fontVector.add("48");
    DefaultComboBoxModel cbModel = new DefaultComboBoxModel(fontVector);
    sizeCB.setModel(cbModel);
    sizeCB.setBorder(new EtchedBorder(EtchedBorder.LOWERED));
    stdButton(boldButton);
    stdButton(italicButton);
    stdButton(underlineButton);
    stdButton(colorButton);
    stdButton(leftJustifyButton);
    stdButton(centerJustifyButton);
    stdButton(rightJustifyButton);
    stdButton(newButton);
    stdButton(saveButton);
    stdButton(deleteButton);
    stdButton(cutButton);
    stdButton(copyButton);
    stdButton(pasteButton);
}
Also used : EtchedBorder(javax.swing.border.EtchedBorder) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) Vector(java.util.Vector)

Example 92 with DefaultComboBoxModel

use of javax.swing.DefaultComboBoxModel in project pcgen by PCGen.

the class OverPanel method initData.

private void initData() {
    //This will display other numbers
    nf.setMaximumFractionDigits(2);
    //This will correctly display currency
    gp.setMaximumFractionDigits(3);
    aModel = new DefaultComboBoxModel(tms);
    cmbFile.setModel(aModel);
    cmbFile.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.DESELECTED)
                return;
            changedTM();
        }
    });
    cmbFile.setSelectedItem(tms.get(0));
    // For some reason the panel is not updated by calling setSelectedItem
    changedTM();
    txtPeop.setValue(1);
    txtAnim.setValue(1);
    txtDays.setValue(1);
    //the data is loaded into the data structures, now just load the combo boxes
    for (int i = 0; i < rb.getInns().getCount(); i++) {
        cmbInn.addItem(rb.getInns().get(i).getName());
    }
    cmbInn.setSelectedIndex(0);
    for (int i = 0; i < rb.getFoods().getCount(); i++) {
        cmbFood.addItem(rb.getFoods().get(i).getName());
    }
    cmbFood.setSelectedIndex(0);
    for (int i = 0; i < rb.getAnimals().getCount(); i++) {
        cmbAnimal.addItem(rb.getAnimals().get(i).getName());
    }
    cmbAnimal.setSelectedIndex(0);
}
Also used : ItemEvent(java.awt.event.ItemEvent) ItemListener(java.awt.event.ItemListener) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel)

Example 93 with DefaultComboBoxModel

use of javax.swing.DefaultComboBoxModel in project vcell by virtualcell.

the class StructureMappingTableModel method updateSubdomainComboBox.

@SuppressWarnings({ "rawtypes", "unchecked" })
private void updateSubdomainComboBox() {
    GeometryClass[] geometryClasses = getGeometryContext().getGeometry().getGeometryClasses();
    DefaultComboBoxModel aModel = new DefaultComboBoxModel();
    for (GeometryClass gc : geometryClasses) {
        aModel.addElement(gc);
    }
    JComboBox subdomainComboBoxCellEditor = new JComboBox();
    subdomainComboBoxCellEditor.setRenderer(new DefaultListCellRenderer() {

        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            setHorizontalTextPosition(SwingConstants.LEFT);
            if (value instanceof GeometryClass) {
                GeometryClass gc = (GeometryClass) value;
                setText(gc.getName());
                if (value instanceof SubVolume) {
                    SubVolume subVolume = (SubVolume) value;
                    java.awt.Color handleColor = new java.awt.Color(colormap[subVolume.getHandle()]);
                    // small square icon with subdomain color
                    Icon icon = new ColorIcon(10, 10, handleColor, true);
                    setHorizontalTextPosition(SwingConstants.RIGHT);
                    setIcon(icon);
                } else if (value instanceof SurfaceClass) {
                    SurfaceClass sc = (SurfaceClass) value;
                    Set<SubVolume> sv = sc.getAdjacentSubvolumes();
                    Iterator<SubVolume> iterator = sv.iterator();
                    SubVolume sv1 = iterator.next();
                    SubVolume sv2 = iterator.next();
                    java.awt.Color c1 = new java.awt.Color(colormap[sv2.getHandle()]);
                    java.awt.Color c2 = new java.awt.Color(colormap[sv1.getHandle()]);
                    Icon icon = new ColorIconEx(10, 10, c1, c2);
                    setIcon(icon);
                    setHorizontalTextPosition(SwingConstants.RIGHT);
                }
            }
            return this;
        }
    });
    subdomainComboBoxCellEditor.setModel(aModel);
    ownerTable.getColumnModel().getColumn(SPATIAL_COLUMN_SUBDOMAIN).setCellEditor(new DefaultCellEditor(subdomainComboBoxCellEditor));
}
Also used : GeometryClass(cbit.vcell.geometry.GeometryClass) ColorIcon(org.vcell.util.gui.ColorIcon) JComboBox(javax.swing.JComboBox) SurfaceClass(cbit.vcell.geometry.SurfaceClass) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) DefaultCellEditor(javax.swing.DefaultCellEditor) DefaultListCellRenderer(javax.swing.DefaultListCellRenderer) SubVolume(cbit.vcell.geometry.SubVolume) ColorIcon(org.vcell.util.gui.ColorIcon) Icon(javax.swing.Icon) Component(java.awt.Component) ColorIconEx(org.vcell.util.gui.ColorIconEx) JList(javax.swing.JList)

Example 94 with DefaultComboBoxModel

use of javax.swing.DefaultComboBoxModel in project vcell by virtualcell.

the class ParameterEstimationRunTaskPanel method initialize.

private void initialize() {
    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weighty = 1.0;
    gbc.insets = new java.awt.Insets(4, 4, 4, 4);
    add(getSolverPanel(), gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.insets = new Insets(4, 4, 4, 4);
    add(getSolutionPanel(), gbc);
    JPanel panel = new JPanel(new BorderLayout());
    copasiLinkLabel.setFont(new Font("Tahoma", Font.PLAIN, 12));
    panel.add(copasiLinkLabel, BorderLayout.CENTER);
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridwidth = 2;
    gbc.anchor = GridBagConstraints.LINE_END;
    gbc.insets = new Insets(0, 8, 4, 0);
    add(panel, gbc);
    DefaultComboBoxModel model = new DefaultComboBoxModel();
    for (CopasiOptimizationMethodType com : CopasiOptimizationMethodType.values()) {
        model.addElement(com);
    }
    getOptimizationMethodComboBox().setModel(model);
    getOptimizationMethodComboBox().addActionListener(eventHandler);
    getOptimizationMethodComboBox().setSelectedItem(CopasiOptimizationMethodType.EvolutionaryProgram);
    getOptimizationMethodComboBox().setRenderer(new DefaultListCellRenderer() {

        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            if (value instanceof CopasiOptimizationMethodType) {
                setText(((CopasiOptimizationMethodType) value).getDisplayName());
            }
            return this;
        }
    });
    getNumberOfRunComboBox().addActionListener(eventHandler);
    getSolveButton().addActionListener(eventHandler);
    helpButton.addActionListener(eventHandler);
    getPlotButton().addActionListener(eventHandler);
    getSaveSolutionAsNewSimButton().addActionListener(eventHandler);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) Font(java.awt.Font) BorderLayout(java.awt.BorderLayout) DefaultListCellRenderer(javax.swing.DefaultListCellRenderer) CopasiOptimizationMethodType(cbit.vcell.opt.CopasiOptimizationMethod.CopasiOptimizationMethodType) EventObject(java.util.EventObject) Component(java.awt.Component) JList(javax.swing.JList)

Example 95 with DefaultComboBoxModel

use of javax.swing.DefaultComboBoxModel in project vcell by virtualcell.

the class BioModelEditorConversionTableModel method updateStructureComboBox.

protected void updateStructureComboBox() {
    JComboBox structureComboBoxCellEditor = (JComboBox) getStructureComboBoxEditor().getComponent();
    if (structureComboBoxCellEditor == null) {
        structureComboBoxCellEditor = new JComboBox();
    }
    Structure[] structures = bioModel.getModel().getStructures();
    DefaultComboBoxModel aModel = new DefaultComboBoxModel();
    for (Structure s : structures) {
        aModel.addElement(s);
    }
    DefaultListCellRenderer defaultListCellRenderer = new DefaultListCellRenderer() {

        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            setHorizontalTextPosition(SwingConstants.LEFT);
            if (value instanceof Structure) {
                setText(((Structure) value).getName());
            }
            return this;
        }
    };
    structureComboBoxCellEditor.setRenderer(defaultListCellRenderer);
    structureComboBoxCellEditor.setModel(aModel);
    structureComboBoxCellEditor.setSelectedIndex(0);
}
Also used : JComboBox(javax.swing.JComboBox) DefaultListCellRenderer(javax.swing.DefaultListCellRenderer) BioPaxObject(org.vcell.pathway.BioPaxObject) RelationshipObject(org.vcell.relationship.RelationshipObject) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) Structure(cbit.vcell.model.Structure) JList(javax.swing.JList)

Aggregations

DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)119 JComboBox (javax.swing.JComboBox)22 JPanel (javax.swing.JPanel)21 JLabel (javax.swing.JLabel)17 ActionEvent (java.awt.event.ActionEvent)15 ActionListener (java.awt.event.ActionListener)15 JButton (javax.swing.JButton)15 Insets (java.awt.Insets)14 GridBagConstraints (java.awt.GridBagConstraints)13 GridBagLayout (java.awt.GridBagLayout)12 Dimension (java.awt.Dimension)11 JTextField (javax.swing.JTextField)11 JCheckBox (javax.swing.JCheckBox)10 JScrollPane (javax.swing.JScrollPane)10 ArrayList (java.util.ArrayList)9 Vector (java.util.Vector)9 JList (javax.swing.JList)9 DataColumnSpec (org.knime.core.data.DataColumnSpec)9 BorderLayout (java.awt.BorderLayout)8 ItemEvent (java.awt.event.ItemEvent)8