Search in sources :

Example 6 with ButtonGroup

use of javax.swing.ButtonGroup in project voltdb by VoltDB.

the class DatabaseManagerSwing method updateSchemaList.

private void updateSchemaList() {
    ButtonGroup group = new ButtonGroup();
    ArrayList list = new ArrayList();
    ResultSet result = null;
    try {
        result = dMeta.getSchemas();
        if (result == null) {
            throw new SQLException("Failed to get metadata from database");
        }
        while (result.next()) {
            list.add(result.getString(1));
        }
    } catch (SQLException se) {
        CommonSwing.errorMessage(se);
    } finally {
        if (result != null) {
            try {
                result.close();
            } catch (SQLException se) {
            }
        }
    }
    mnuSchemas.removeAll();
    rbAllSchemas.setSelected(schemaFilter == null);
    group.add(rbAllSchemas);
    mnuSchemas.add(rbAllSchemas);
    String s;
    JRadioButtonMenuItem radioButton;
    for (int i = 0; i < list.size(); i++) {
        s = (String) list.get(i);
        radioButton = new JRadioButtonMenuItem(s);
        group.add(radioButton);
        mnuSchemas.add(radioButton);
        radioButton.setSelected(schemaFilter != null && schemaFilter.equals(s));
        radioButton.addActionListener(schemaListListener);
        radioButton.setEnabled(list.size() > 1);
    }
    mnuSchemas.addSeparator();
    mnuSchemas.add(mitemUpdateSchemas);
}
Also used : ButtonGroup(javax.swing.ButtonGroup) SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) ResultSet(java.sql.ResultSet) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem)

Example 7 with ButtonGroup

use of javax.swing.ButtonGroup in project EnrichmentMapApp by BaderLab.

the class PostAnalysisWeightPanel method createHypergeomPanel.

private JPanel createHypergeomPanel() {
    ActionListener universeSelectActionListener = e -> {
        boolean enable = e.getActionCommand().equals("User Defined");
        universeSelectionTextField.setEnabled(enable);
    };
    gmtRadioButton = new JRadioButton();
    gmtRadioButton.setActionCommand("GMT");
    gmtRadioButton.addActionListener(universeSelectActionListener);
    gmtRadioButton.setSelected(true);
    expressionSetRadioButton = new JRadioButton();
    expressionSetRadioButton.setActionCommand("Expression Set");
    expressionSetRadioButton.addActionListener(universeSelectActionListener);
    intersectionRadioButton = new JRadioButton();
    intersectionRadioButton.setActionCommand("Intersection");
    intersectionRadioButton.addActionListener(universeSelectActionListener);
    userDefinedRadioButton = new JRadioButton("User Defined:");
    userDefinedRadioButton.setActionCommand("User Defined");
    userDefinedRadioButton.addActionListener(universeSelectActionListener);
    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(gmtRadioButton);
    buttonGroup.add(expressionSetRadioButton);
    buttonGroup.add(intersectionRadioButton);
    buttonGroup.add(userDefinedRadioButton);
    DecimalFormat intFormat = new DecimalFormat();
    intFormat.setParseIntegerOnly(true);
    universeSelectionTextField = new JFormattedTextField(intFormat);
    universeSelectionTextField.addPropertyChangeListener("value", e -> {
        Number val = (Number) universeSelectionTextField.getValue();
        if (val == null || val.intValue() < 0) {
            universeSelectionTextField.setValue(1);
            CySwingApplication application = serviceRegistrar.getService(CySwingApplication.class);
            JOptionPane.showMessageDialog(application.getJFrame(), "Universe value must be greater than zero", "Parameter out of bounds", JOptionPane.WARNING_MESSAGE);
        }
    });
    universeSelectionTextField.setEnabled(false);
    gmtRadioButton.setText("GMT");
    expressionSetRadioButton.setText("Expression Set");
    intersectionRadioButton.setText("Intersection");
    universeSelectionTextField.setValue(0);
    makeSmall(gmtRadioButton, expressionSetRadioButton, intersectionRadioButton, userDefinedRadioButton, universeSelectionTextField);
    JPanel panel = new JPanel();
    panel.setBorder(LookAndFeelUtil.createTitledBorder("Advanced Hypergeometric Universe"));
    final GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING, true).addComponent(gmtRadioButton).addComponent(expressionSetRadioButton).addComponent(intersectionRadioButton).addGroup(layout.createSequentialGroup().addComponent(userDefinedRadioButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addComponent(universeSelectionTextField, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)));
    layout.setVerticalGroup(layout.createSequentialGroup().addComponent(gmtRadioButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(expressionSetRadioButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(intersectionRadioButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(userDefinedRadioButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(universeSelectionTextField, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)));
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : Arrays(java.util.Arrays) CardLayout(java.awt.CardLayout) ActionListener(java.awt.event.ActionListener) PostAnalysisParameters(org.baderlab.csplugins.enrichmentmap.model.PostAnalysisParameters) JTextField(javax.swing.JTextField) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) Ranking(org.baderlab.csplugins.enrichmentmap.model.Ranking) IconManager(org.cytoscape.util.swing.IconManager) PostAnalysisFilterParameters(org.baderlab.csplugins.enrichmentmap.model.PostAnalysisFilterParameters) GeneExpressionMatrix(org.baderlab.csplugins.enrichmentmap.model.GeneExpressionMatrix) Map(java.util.Map) EnablementComboBoxRenderer(org.baderlab.csplugins.enrichmentmap.view.EnablementComboBoxRenderer) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) SwingUtil.makeSmall(org.baderlab.csplugins.enrichmentmap.view.util.SwingUtil.makeSmall) JComboBox(javax.swing.JComboBox) JFrame(javax.swing.JFrame) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar) DEFAULT_SIZE(javax.swing.GroupLayout.DEFAULT_SIZE) UniverseType(org.baderlab.csplugins.enrichmentmap.model.PostAnalysisParameters.UniverseType) JFormattedTextField(javax.swing.JFormattedTextField) ButtonGroup(javax.swing.ButtonGroup) DecimalFormat(java.text.DecimalFormat) ComponentPlacement(javax.swing.LayoutStyle.ComponentPlacement) JOptionPane(javax.swing.JOptionPane) JRadioButton(javax.swing.JRadioButton) PREFERRED_SIZE(javax.swing.GroupLayout.PREFERRED_SIZE) List(java.util.List) Alignment(javax.swing.GroupLayout.Alignment) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet) PostAnalysisFilterType(org.baderlab.csplugins.enrichmentmap.model.PostAnalysisFilterType) LookAndFeelUtil(org.cytoscape.util.swing.LookAndFeelUtil) JLabel(javax.swing.JLabel) GroupLayout(javax.swing.GroupLayout) CySwingApplication(org.cytoscape.application.swing.CySwingApplication) Optional(java.util.Optional) Collections(java.util.Collections) JPanel(javax.swing.JPanel) JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) ActionListener(java.awt.event.ActionListener) ButtonGroup(javax.swing.ButtonGroup) CySwingApplication(org.cytoscape.application.swing.CySwingApplication) DecimalFormat(java.text.DecimalFormat) JFormattedTextField(javax.swing.JFormattedTextField) GroupLayout(javax.swing.GroupLayout)

Example 8 with ButtonGroup

use of javax.swing.ButtonGroup in project EnrichmentMapApp by BaderLab.

the class PostAnalysisInputPanel method createAnalysisTypePanel.

/**
	 * Creates a JPanel containing scope radio buttons
	 */
private JPanel createAnalysisTypePanel() {
    makeSmall(getKnownSignatureRadio(), getSignatureDiscoveryRadio());
    ButtonGroup analysisOptions = new ButtonGroup();
    analysisOptions.add(getKnownSignatureRadio());
    analysisOptions.add(getSignatureDiscoveryRadio());
    JPanel panel = new JPanel();
    panel.setBorder(LookAndFeelUtil.createTitledBorder("Post Analysis Type"));
    final GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(getKnownSignatureRadio()).addComponent(getSignatureDiscoveryRadio()).addGap(0, 0, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(Alignment.CENTER, true).addComponent(getKnownSignatureRadio(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getSignatureDiscoveryRadio(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) ButtonGroup(javax.swing.ButtonGroup) GroupLayout(javax.swing.GroupLayout)

Example 9 with ButtonGroup

use of javax.swing.ButtonGroup in project ACS by ACS-Community.

the class LogMenuBar method setupMenuBar.

/**
     * Builds the menu bar
     */
private void setupMenuBar() {
    // Add the File menu
    fileMenu = new javax.swing.JMenu();
    fileMenu.setName("FileMenu");
    fileMenu.setText("File");
    fileMenu.add(getConnectMenuItem());
    fileMenu.add(getAutoReconnectMenuItem());
    fileMenu.addSeparator();
    fileMenu.add(getLoadMenuItem());
    fileMenu.add(getLoadURLMenuItem());
    fileMenu.add(getLoadDBMenuItem());
    fileMenu.add(getSaveFileMenuItem());
    fileMenu.add(getClearLogsMenuItem());
    //fileMenu.addSeparator();
    fileMenu.add(exitSeparator);
    fileMenu.add(getExitMenuItem());
    add(fileMenu);
    // Add the View Menu
    viewMenu = new javax.swing.JMenu();
    viewMenu.setName("ViewMenu");
    viewMenu.setText("View");
    viewMenu.add(getViewToolbarMenuItem());
    viewMenu.add(getViewDetailedInfoMenuItem());
    viewMenu.add(getViewStatusAreaMenuItem());
    viewMenu.addSeparator();
    viewMenu.add(getFieldsMenuItem());
    viewMenu.add(getShortDateViewMenuItem());
    viewMenu.add(getLogTypeDescriptionViewMenuItem());
    viewMenu.addSeparator();
    viewMenu.add(getFiltersMenuItem());
    viewMenu.add(getViewErrorBrowserMenuItem());
    viewMenu.addSeparator();
    viewMenu.add(getStatisticsMenuItem());
    viewMenu.add(getViewErrorLogMenuItem());
    add(viewMenu);
    // Add the Search Menu
    add(getSearchMenu());
    // Add the zoom menu
    add(getZoomMenu());
    // Add the expert menu
    expertMenu = new JMenu();
    expertMenu.setName("ExpertMenu");
    expertMenu.setText("Expert");
    JMenu modeMenu = new JMenu("Mode");
    expertMenu.add(modeMenu);
    modeMenu.add(getOperatorMode());
    modeMenu.add(getEngineeringMode());
    modeMenu.add(getSciLogMode());
    ButtonGroup group = new ButtonGroup();
    group.add(getOperatorMode());
    group.add(getEngineeringMode());
    group.add(getSciLogMode());
    expertMenu.addSeparator();
    expertMenu.add(getSuspendMenuItem());
    expertMenu.add(getPrefsMenuItem());
    expertMenu.add(getEngineFiltersMenuItem());
    add(expertMenu);
}
Also used : ButtonGroup(javax.swing.ButtonGroup) JMenu(javax.swing.JMenu) JMenu(javax.swing.JMenu)

Example 10 with ButtonGroup

use of javax.swing.ButtonGroup in project nhin-d by DirectProject.

the class ViewTrustBundle method addComponentsToPane.

/**
	 * Set the orientation of the components inside the pane.
	 * @param pane Accept the container pane and set its orientation.
	 * @return void 
	 */
public static void addComponentsToPane(Container pane) {
    if (RIGHT_TO_LEFT) {
        pane.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    }
    pane.setLayout(new GridBagLayout());
    ComponentCreation creation = new ComponentCreation();
    /**
	 * Below block create the screen by using the ComponentCreation class and its method to create components.
	 * The componentCreation class has various methods exposed which will take the pane and type of component with its position.
	 * Radio, label, File, Directory etc are different type of pane can be created using the class. 
	 */
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = (c.gridx == 0) ? GridBagConstraints.EAST : GridBagConstraints.WEST;
    c.weighty = 1.5;
    c.weightx = 0.5;
    ButtonGroup myButtonGroup = new ButtonGroup();
    creation.createComponent("RADIO", "  Create Unsigned Trust Bundle", false, c, pane, myButtonGroup, 0, 0);
    creation.createComponent("RADIO", "  Create Signed Trust Bundle", false, c, pane, myButtonGroup, 1, 0);
    creation.createComponent("RADIO", "  View Trust Bundle", true, c, pane, myButtonGroup, 2, 0);
    creation.createComponent("LABEL", "  Trust Bundle", false, c, pane, null, 0, 1);
    creation.createBrowseFile("FILE", "Select Trust Bundle File", c, pane, 1, 1);
    creation.createComponent("BUTTON", "View Bundle", false, c, pane, null, 1, 5);
    c.fill = GridBagConstraints.NONE;
    creation.createComponent("LABEL", " 	Feedback:", false, c, pane, null, 0, 6);
    creation.createComponent("TEXTPANE", "", false, c, pane, null, 1, 6);
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) ButtonGroup(javax.swing.ButtonGroup) ComponentCreation(org.nhindirect.trustbundle.utils.ComponentCreation)

Aggregations

ButtonGroup (javax.swing.ButtonGroup)339 JPanel (javax.swing.JPanel)202 JRadioButton (javax.swing.JRadioButton)186 JLabel (javax.swing.JLabel)148 ActionEvent (java.awt.event.ActionEvent)134 ActionListener (java.awt.event.ActionListener)118 BoxLayout (javax.swing.BoxLayout)83 GridBagLayout (java.awt.GridBagLayout)81 JButton (javax.swing.JButton)75 JTextField (javax.swing.JTextField)70 JMenu (javax.swing.JMenu)69 GridBagConstraints (java.awt.GridBagConstraints)67 BorderLayout (java.awt.BorderLayout)64 Insets (java.awt.Insets)64 Dimension (java.awt.Dimension)58 JRadioButtonMenuItem (javax.swing.JRadioButtonMenuItem)57 FlowLayout (java.awt.FlowLayout)53 JMenuItem (javax.swing.JMenuItem)50 JCheckBox (javax.swing.JCheckBox)47 JScrollPane (javax.swing.JScrollPane)47