Search in sources :

Example 1 with JComboBox

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;
}
Also used : JComboBox(javax.swing.JComboBox) JComponent(javax.swing.JComponent) Properties(java.util.Properties) JTextField(javax.swing.JTextField)

Example 2 with JComboBox

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;
}
Also used : JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) JComboBox(javax.swing.JComboBox) BorderLayout(java.awt.BorderLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) ParseMode(com.puppycrawl.tools.checkstyle.gui.MainFrameModel.ParseMode)

Example 3 with JComboBox

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

Example 4 with JComboBox

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);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) BorderLayout(java.awt.BorderLayout) GridBagLayout(java.awt.GridBagLayout) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel) JSplitPane(javax.swing.JSplitPane)

Example 5 with JComboBox

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;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) ItemEvent(java.awt.event.ItemEvent) Insets(java.awt.Insets) MouseEvent(java.awt.event.MouseEvent) JComboBox(javax.swing.JComboBox) GridBagLayout(java.awt.GridBagLayout) JSeparator(javax.swing.JSeparator) ProblemGenerator(doc.mathobjects.ProblemGenerator) JCheckBox(javax.swing.JCheckBox) MouseListener(java.awt.event.MouseListener) ItemListener(java.awt.event.ItemListener) JComponent(javax.swing.JComponent) Component(java.awt.Component) MathObject(doc.mathobjects.MathObject)

Aggregations

JComboBox (javax.swing.JComboBox)150 JLabel (javax.swing.JLabel)66 JPanel (javax.swing.JPanel)57 ActionEvent (java.awt.event.ActionEvent)51 ActionListener (java.awt.event.ActionListener)48 JButton (javax.swing.JButton)47 JScrollPane (javax.swing.JScrollPane)28 JTextField (javax.swing.JTextField)27 BoxLayout (javax.swing.BoxLayout)26 Dimension (java.awt.Dimension)25 JCheckBox (javax.swing.JCheckBox)23 JTable (javax.swing.JTable)22 BorderLayout (java.awt.BorderLayout)21 GridBagLayout (java.awt.GridBagLayout)20 Insets (java.awt.Insets)20 GridBagConstraints (java.awt.GridBagConstraints)19 FlowLayout (java.awt.FlowLayout)18 DefaultCellEditor (javax.swing.DefaultCellEditor)17 TableColumn (javax.swing.table.TableColumn)14 ItemEvent (java.awt.event.ItemEvent)11