Search in sources :

Example 36 with JFormattedTextField

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

the class CutoffPropertiesPanel method createFilterNodesPanel.

private JPanel createFilterNodesPanel() {
    JPanel panel = new JPanel();
    panel.setBorder(LookAndFeelUtil.createTitledBorder("Gene-Set Filtering (Nodes)"));
    pvalueLabel = new JLabel("p-value cutoff:");
    JLabel qvalueLabel = new JLabel("FDR q-value cutoff:");
    nesFilterLabel = new JLabel("NES:");
    shouldFilterMinLabel = new JLabel("Filter by minimum experiments:");
    minExperimentsLabel = new JLabel("Minimum experiments:");
    SwingUtil.makeSmall(qvalueLabel, pvalueLabel, minExperimentsLabel, shouldFilterMinLabel, nesFilterLabel);
    AbstractFormatterFactory formatterFactory = getFormatterFactory(false);
    pvalueText = new JFormattedTextField(formatterFactory);
    qvalueText = new JFormattedTextField(formatterFactory);
    shouldFilterMinCheckbox = new JCheckBox("");
    minExperimentsText = new JFormattedTextField(NumberFormat.getIntegerInstance());
    pvalueText.setValue(propertyManager.getDefaultPvalue());
    qvalueText.setValue(propertyManager.getDefaultQvalue());
    minExperimentsText.setValue(3);
    nesFilterCombo = new JComboBox<>();
    nesFilterCombo.addItem(new ComboItem<>(NESFilter.ALL, "All"));
    nesFilterCombo.addItem(new ComboItem<>(NESFilter.POSITIVE, "Positive"));
    nesFilterCombo.addItem(new ComboItem<>(NESFilter.NEGATIVE, "Negative"));
    nesFilterCombo.setSelectedItem(ComboItem.of(NESFilter.ALL));
    minExperimentsLabel.setEnabled(false);
    minExperimentsText.setEnabled(false);
    showAdvancedOptions(false);
    shouldFilterMinCheckbox.addActionListener(e -> {
        boolean enable = shouldFilterMinCheckbox.isSelected();
        minExperimentsLabel.setEnabled(enable);
        minExperimentsText.setEnabled(enable);
    });
    SwingUtil.makeSmall(pvalueText, qvalueText, shouldFilterMinCheckbox, nesFilterCombo, minExperimentsText);
    final GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.TRAILING).addComponent(qvalueLabel).addComponent(pvalueLabel).addComponent(nesFilterLabel).addComponent(shouldFilterMinLabel).addComponent(minExperimentsLabel)).addGroup(layout.createParallelGroup(Alignment.LEADING).addComponent(qvalueText, PREFERRED_SIZE, 100, PREFERRED_SIZE).addComponent(pvalueText, PREFERRED_SIZE, 100, PREFERRED_SIZE).addComponent(nesFilterCombo).addComponent(shouldFilterMinCheckbox).addComponent(minExperimentsText, PREFERRED_SIZE, 100, PREFERRED_SIZE)).addGap(0, 0, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(qvalueLabel).addComponent(qvalueText)).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(pvalueLabel).addComponent(pvalueText)).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(nesFilterLabel).addComponent(nesFilterCombo)).addGroup(layout.createParallelGroup(Alignment.CENTER).addComponent(shouldFilterMinLabel).addComponent(shouldFilterMinCheckbox)).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(minExperimentsLabel).addComponent(minExperimentsText)).addGap(0, 0, Short.MAX_VALUE));
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) JFormattedTextField(javax.swing.JFormattedTextField) GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel) AbstractFormatterFactory(javax.swing.JFormattedTextField.AbstractFormatterFactory)

Example 37 with JFormattedTextField

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

the class PostAnalysisWeightPanel method createRankTestSelectPanel.

@SuppressWarnings("unchecked")
private JPanel createRankTestSelectPanel() {
    JLabel testLabel = new JLabel(LABEL_TEST);
    JLabel cuttofLabel = new JLabel(LABEL_CUTOFF);
    JLabel dataSetLabel = new JLabel("Data Set:");
    DecimalFormat decFormat = new DecimalFormat();
    decFormat.setParseIntegerOnly(false);
    rankTestTextField = new JFormattedTextField(decFormat);
    rankTestTextField.setColumns(6);
    rankTestTextField.setHorizontalAlignment(JTextField.RIGHT);
    rankTestTextField.addPropertyChangeListener("value", e -> {
        StringBuilder message = new StringBuilder("The value you have entered is invalid.\n");
        Number number = (Number) rankTestTextField.getValue();
        PostAnalysisFilterType filterType = getFilterType();
        Optional<Double> value = PostAnalysisInputPanel.validateAndGetFilterValue(number, filterType, message);
        double def = filterType == PostAnalysisFilterType.HYPERGEOM ? HYPERGOM_DEFAULT : filterType.defaultValue;
        savedFilterValues.put(filterType, value.orElse(def));
        if (!value.isPresent()) {
            rankTestTextField.setValue(def);
            CySwingApplication application = serviceRegistrar.getService(CySwingApplication.class);
            JOptionPane.showMessageDialog(application.getJFrame(), message.toString(), "Parameter out of bounds", JOptionPane.WARNING_MESSAGE);
        }
    });
    rankingEnablementRenderer = new EnablementComboBoxRenderer<>();
    rankTestCombo = new JComboBox<>();
    rankTestCombo.setRenderer(rankingEnablementRenderer);
    rankTestCombo.addItem(PostAnalysisFilterType.MANN_WHIT_TWO_SIDED);
    rankTestCombo.addItem(PostAnalysisFilterType.MANN_WHIT_GREATER);
    rankTestCombo.addItem(PostAnalysisFilterType.MANN_WHIT_LESS);
    rankTestCombo.addItem(PostAnalysisFilterType.HYPERGEOM);
    rankTestCombo.addItem(PostAnalysisFilterType.NUMBER);
    rankTestCombo.addItem(PostAnalysisFilterType.PERCENT);
    rankTestCombo.addItem(PostAnalysisFilterType.SPECIFIC);
    rankTestCombo.addActionListener(e -> {
        PostAnalysisFilterType filterType = (PostAnalysisFilterType) rankTestCombo.getSelectedItem();
        rankTestTextField.setValue(savedFilterValues.get(filterType));
        CardLayout cardLayout = (CardLayout) cardPanel.getLayout();
        if (filterType.isMannWhitney() && map.getAllRanks().isEmpty())
            cardLayout.show(cardPanel, "warn");
        else
            cardLayout.show(cardPanel, filterType.name());
    });
    datasetCombo = new JComboBox<>();
    // Dataset model is already initialized
    datasetModel = new DefaultComboBoxModel<>();
    datasetCombo.setModel(datasetModel);
    datasetCombo.addActionListener(e -> {
        updateUniverseSize(getDataSet());
    });
    makeSmall(testLabel, cuttofLabel, rankTestCombo, rankTestTextField);
    makeSmall(dataSetLabel, datasetCombo);
    JPanel panel = new JPanel();
    final GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.CENTER, true).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.TRAILING, true).addComponent(testLabel).addComponent(cuttofLabel).addComponent(dataSetLabel)).addGroup(layout.createParallelGroup(Alignment.LEADING, true).addComponent(rankTestCombo, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(rankTestTextField, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(datasetCombo, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE))));
    layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(testLabel).addComponent(rankTestCombo, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)).addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(cuttofLabel).addComponent(rankTestTextField, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)).addPreferredGap(ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(dataSetLabel).addComponent(datasetCombo, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)));
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : CardLayout(java.awt.CardLayout) JPanel(javax.swing.JPanel) PostAnalysisFilterType(org.baderlab.csplugins.enrichmentmap.model.PostAnalysisFilterType) CySwingApplication(org.cytoscape.application.swing.CySwingApplication) DecimalFormat(java.text.DecimalFormat) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) GroupLayout(javax.swing.GroupLayout)

Example 38 with JFormattedTextField

use of javax.swing.JFormattedTextField in project intellij-community by JetBrains.

the class SingleIntegerFieldOptionsPanel method createIntegerFieldTrackingValue.

public static JFormattedTextField createIntegerFieldTrackingValue(@NotNull InspectionProfileEntry owner, @NotNull String property, int integerFieldColumns) {
    JFormattedTextField valueField = new JFormattedTextField();
    valueField.setColumns(integerFieldColumns);
    setupIntegerFieldTrackingValue(valueField, owner, property);
    return valueField;
}
Also used : JFormattedTextField(javax.swing.JFormattedTextField)

Example 39 with JFormattedTextField

use of javax.swing.JFormattedTextField in project jdk8u_jdk by JetBrains.

the class InsetsEncapsulation method run.

@Override
public void run() {
    runTest(new JLabel("hi"));
    runTest(new JMenu());
    runTest(new JTree());
    runTest(new JTable());
    runTest(new JMenuItem());
    runTest(new JCheckBoxMenuItem());
    runTest(new JToggleButton());
    runTest(new JSpinner());
    runTest(new JSlider());
    runTest(Box.createVerticalBox());
    runTest(Box.createHorizontalBox());
    runTest(new JTextField());
    runTest(new JTextArea());
    runTest(new JTextPane());
    runTest(new JPasswordField());
    runTest(new JFormattedTextField());
    runTest(new JEditorPane());
    runTest(new JButton());
    runTest(new JColorChooser());
    runTest(new JFileChooser());
    runTest(new JCheckBox());
    runTest(new JInternalFrame());
    runTest(new JDesktopPane());
    runTest(new JTableHeader());
    runTest(new JLayeredPane());
    runTest(new JRootPane());
    runTest(new JMenuBar());
    runTest(new JOptionPane());
    runTest(new JRadioButton());
    runTest(new JRadioButtonMenuItem());
    runTest(new JPopupMenu());
    runTest(new JScrollBar());
    runTest(new JScrollPane());
    runTest(new JViewport());
    runTest(new JSplitPane());
    runTest(new JTabbedPane());
    runTest(new JToolBar());
    runTest(new JSeparator());
    runTest(new JProgressBar());
    if (!failures.isEmpty()) {
        System.out.println("These classes failed");
        for (final Component failure : failures) {
            System.out.println(failure.getClass());
        }
        throw new RuntimeException("Test failed");
    }
}
Also used : JDesktopPane(javax.swing.JDesktopPane) JTextArea(javax.swing.JTextArea) JRadioButton(javax.swing.JRadioButton) JLayeredPane(javax.swing.JLayeredPane) JTabbedPane(javax.swing.JTabbedPane) JButton(javax.swing.JButton) JProgressBar(javax.swing.JProgressBar) JTableHeader(javax.swing.table.JTableHeader) JTextField(javax.swing.JTextField) JSeparator(javax.swing.JSeparator) JScrollBar(javax.swing.JScrollBar) JTextPane(javax.swing.JTextPane) JToggleButton(javax.swing.JToggleButton) JSlider(javax.swing.JSlider) JMenuItem(javax.swing.JMenuItem) JComponent(javax.swing.JComponent) Component(java.awt.Component) JScrollPane(javax.swing.JScrollPane) JViewport(javax.swing.JViewport) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) JToolBar(javax.swing.JToolBar) JOptionPane(javax.swing.JOptionPane) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) JPopupMenu(javax.swing.JPopupMenu) JCheckBox(javax.swing.JCheckBox) JTree(javax.swing.JTree) JFileChooser(javax.swing.JFileChooser) JPasswordField(javax.swing.JPasswordField) JTable(javax.swing.JTable) JEditorPane(javax.swing.JEditorPane) JSpinner(javax.swing.JSpinner) JRootPane(javax.swing.JRootPane) JSplitPane(javax.swing.JSplitPane) JColorChooser(javax.swing.JColorChooser) JInternalFrame(javax.swing.JInternalFrame) JMenu(javax.swing.JMenu) JMenuBar(javax.swing.JMenuBar)

Example 40 with JFormattedTextField

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

the class CheckDialog method initDC.

/**
	 * <p>
	 * Initializes the DC value
	 * </p>
	 *
	 */
private void initDC() {
    NumberFormatter formatter = new NumberFormatter(new DecimalFormat("##"));
    formatter.setValueClass(Integer.class);
    m_dc = new JFormattedTextField(formatter);
    m_dc.setFocusLostBehavior(JFormattedTextField.COMMIT_OR_REVERT);
    m_dc.setValue(m_defaultDC);
    JLabel label = new JLabel("DC:");
    label.setAlignmentX(Component.RIGHT_ALIGNMENT);
    addComponent(m_dc, label);
}
Also used : DecimalFormat(java.text.DecimalFormat) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) NumberFormatter(javax.swing.text.NumberFormatter)

Aggregations

JFormattedTextField (javax.swing.JFormattedTextField)43 JLabel (javax.swing.JLabel)15 JPanel (javax.swing.JPanel)14 DecimalFormat (java.text.DecimalFormat)9 ParseException (java.text.ParseException)9 PropertyChangeEvent (java.beans.PropertyChangeEvent)7 JButton (javax.swing.JButton)7 NumberFormatter (javax.swing.text.NumberFormatter)7 ActionListener (java.awt.event.ActionListener)6 PropertyChangeListener (java.beans.PropertyChangeListener)6 GroupLayout (javax.swing.GroupLayout)6 ActionEvent (java.awt.event.ActionEvent)5 JScrollPane (javax.swing.JScrollPane)5 Dimension (java.awt.Dimension)4 GridBagConstraints (java.awt.GridBagConstraints)4 GridBagLayout (java.awt.GridBagLayout)4 Insets (java.awt.Insets)4 JCheckBox (javax.swing.JCheckBox)3 JComboBox (javax.swing.JComboBox)3 JSeparator (javax.swing.JSeparator)3