use of javax.swing.JComboBox in project zookeeper by apache.
the class ZooInspectorConnectionPropertiesDialog method getConnectionProps.
private Properties getConnectionProps() {
Properties connectionProps = new Properties();
for (Entry<String, JComponent> entry : components.entrySet()) {
String value = null;
JComponent component = entry.getValue();
if (component instanceof JTextField) {
value = ((JTextField) component).getText();
} else if (component instanceof JComboBox) {
value = ((JComboBox) component).getSelectedItem().toString();
}
connectionProps.put(entry.getKey(), value);
}
return connectionProps;
}
use of javax.swing.JComboBox in project checkstyle by checkstyle.
the class MainFrame method createButtonsPanel.
/**
* Create buttons panel.
* @return buttons panel.
*/
private JPanel createButtonsPanel() {
final JButton openFileButton = new JButton(new FileSelectionAction());
openFileButton.setMnemonic(KeyEvent.VK_S);
openFileButton.setText("Open File");
reloadAction.setEnabled(false);
final JButton reloadFileButton = new JButton(reloadAction);
reloadFileButton.setMnemonic(KeyEvent.VK_R);
reloadFileButton.setText("Reload File");
final JComboBox<ParseMode> modesCombobox = new JComboBox<>(ParseMode.values());
modesCombobox.setSelectedIndex(0);
modesCombobox.addActionListener(e -> {
model.setParseMode((ParseMode) modesCombobox.getSelectedItem());
reloadAction.actionPerformed(null);
});
final JLabel modesLabel = new JLabel("Modes:", SwingConstants.RIGHT);
final int leftIndentation = 10;
modesLabel.setBorder(BorderFactory.createEmptyBorder(0, leftIndentation, 0, 0));
final JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(1, 2));
buttonPanel.add(openFileButton);
buttonPanel.add(reloadFileButton);
final JPanel modesPanel = new JPanel();
modesPanel.add(modesLabel);
modesPanel.add(modesCombobox);
final JPanel mainPanel = new JPanel();
mainPanel.setLayout(new BorderLayout());
mainPanel.add(buttonPanel);
mainPanel.add(modesPanel, BorderLayout.LINE_END);
return mainPanel;
}
use of javax.swing.JComboBox in project Fling by entertailion.
the class FlingFrame method actionPerformed.
/**
* Event handler for device dropdown list selection
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent e) {
JComboBox cb = (JComboBox) e.getSource();
int pos = cb.getSelectedIndex();
// when device is selected, attempt to connect
if (servers != null && pos > 0) {
selectedDialServer = (DialServer) cb.getSelectedItem();
}
}
use of javax.swing.JComboBox in project qi4j-sdk by Qi4j.
the class EntityViewer method $$$setupUI$$$.
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
*/
private void $$$setupUI$$$() {
mainPane = new JPanel();
mainPane.setLayout(new BorderLayout(0, 0));
splitPane = new JSplitPane();
mainPane.add(splitPane, BorderLayout.CENTER);
propertiesAreaPane = new JPanel();
propertiesAreaPane.setLayout(new BorderLayout(0, 0));
splitPane.setRightComponent(propertiesAreaPane);
final JPanel panel1 = new JPanel();
panel1.setLayout(new GridBagLayout());
propertiesAreaPane.add(panel1, BorderLayout.NORTH);
entitiesCombo = new JComboBox();
GridBagConstraints gbc;
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 0;
gbc.gridwidth = 3;
gbc.weightx = 0.3;
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel1.add(entitiesCombo, gbc);
final JLabel label1 = new JLabel();
label1.setText("Entity");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.WEST;
panel1.add(label1, gbc);
final JPanel spacer1 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel1.add(spacer1, gbc);
}
use of javax.swing.JComboBox in project OpenNotebook by jaltekruse.
the class ProblemListPanel method createPanelForProblems.
public JPanel createPanelForProblems() {
ProblemList panel = new ProblemList();
JPanel tempPanel;
GridBagConstraints con = new GridBagConstraints();
JComboBox frequencyChoices;
Component[] othersInRow = new Component[2];
;
int numProblemsToShow = notebookPanel.getDatabase().getAllProblems().size();
if (numProblemsToShow > 20) {
// limit the number of problems in the list
// to 20 at a time
numProblemsToShow = 20;
}
con.gridy = 0;
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
panel.setLayout(new GridBagLayout());
for (final ProblemGenerator g : notebookPanel.getDatabase().getAllProblems()) {
// add checkbox
con.fill = GridBagConstraints.NONE;
con.gridx = 0;
con.gridwidth = 1;
con.weightx = 0;
con.insets = new Insets(0, 0, 0, 0);
final JCheckBox checkbox = new JCheckBox();
checkbox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent ev) {
if (ev.getStateChange() == ItemEvent.SELECTED) {
selectedFrequencies.add(10);
selectedProblems.add(g);
} else {
selectedFrequencies.remove(selectedProblems.indexOf(g));
selectedProblems.remove(g);
}
previewPanel.getDoc().getPage(0).removeAllObjects();
// set the page size big to prevent problem generation from spawning pages
previewPanel.getDoc().setHeight(5000);
previewPanel.getDoc().setWidth(5000);
previewPanel.getDoc().generateProblem(g);
previewPanel.resizeViewWindow();
MathObject mObj = previewPanel.getDoc().getPage(0).getObjects().get(0);
previewPanel.getDoc().setWidth(mObj.getWidth() + 2 * problemBuffer);
previewPanel.getDoc().setHeight(mObj.getHeight() + 2 * problemBuffer);
mObj.setxPos(problemBuffer);
mObj.setyPos(problemBuffer);
previewPanel.resizeViewWindow();
}
});
frequencyChoices = new JComboBox(frequencies);
panel.add(checkbox, con);
othersInRow[0] = checkbox;
othersInRow[1] = frequencyChoices;
con.fill = GridBagConstraints.HORIZONTAL;
con.insets = new Insets(0, 5, 0, 0);
con.weightx = 1;
con.gridx = 1;
tempPanel = new ProblemDescriptionPanel(g, othersInRow);
tempPanel.addMouseListener(new MouseListener() {
public void mouseClicked(MouseEvent arg0) {
}
public void mouseEntered(MouseEvent arg0) {
}
public void mouseExited(MouseEvent arg0) {
}
@Override
public void mousePressed(MouseEvent arg0) {
checkbox.setSelected(!checkbox.isSelected());
}
public void mouseReleased(MouseEvent arg0) {
}
});
panel.add(tempPanel, con);
// // add frequency selection menu
// con.fill = GridBagConstraints.NONE;
// con.gridx = 2;
// con.weightx = 0;
// con.insets = new Insets(0, 5, 0, 5);
// frequencyChoices.setSelectedItem(AVERAGE);
// panel.add(frequencyChoices, con);
con.gridy++;
con.gridx = 0;
con.gridwidth = 2;
con.insets = new Insets(0, 0, 0, 0);
panel.add(new JSeparator(), con);
con.gridy++;
}
return panel;
}
Aggregations