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