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);
}
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);
}
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));
}
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);
}
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);
}
Aggregations