use of javax.swing.JSpinner in project ACS by ACS-Community.
the class BeanGrouper method getTimeSampSpinner.
/**
* Initializes the TextField that will allow to input the desired Sampling Time for the Sampling Group.<br>
* By default the value is 0, which means infinite time (or until stop button is pressed).<br>
* Also checks for its correctness when the value changes.
* @return javax.swing.JTextField Reference to the Text Field containing the number.
*/
private JSpinner getTimeSampSpinner() {
if (timeSampSpinner == null) {
timeSampSpinner = new JSpinner();
timeSampSpinner.setModel(new SpinnerNumberModel(0, 0, 1000, 1));
timeSampSpinner.setToolTipText("How long, in minutes, will the sampling last. A value of 0 means non-stopping sample.");
}
return timeSampSpinner;
}
use of javax.swing.JSpinner in project adempiere by adempiere.
the class MinuteModel method jbInit.
/**
* Static init
* @throws Exception
*/
private void jbInit() throws Exception {
this.addKeyListener(this);
//
mainPanel.setLayout(mainLayout);
mainLayout.setHgap(2);
mainLayout.setVgap(2);
//mainPanel.setBorder(BorderFactory.createLoweredBevelBorder());
mainPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 2));
getContentPane().add(mainPanel);
// Month Panel
monthPanel.setLayout(monthLayout);
monthPanel.add(bBack, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
monthPanel.add(cYear, new GridBagConstraints(3, 0, 1, 1, 1.0, 0.0, GridBagConstraints.SOUTHEAST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 0), 0, 0));
monthPanel.add(bNext, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
monthPanel.add(cMonth, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
monthPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));
mainPanel.add(monthPanel, BorderLayout.NORTH);
cMonth.addActionListener(this);
cYear.addChangeListener(this);
// <
bBack.setIcon(Env.getImageIcon("Parent16.gif"));
bBack.setMargin(new Insets(0, 0, 0, 0));
bBack.addActionListener(this);
// >
bNext.setIcon(Env.getImageIcon("Detail16.gif"));
bNext.setMargin(new Insets(0, 0, 0, 0));
bNext.addActionListener(this);
// Day Panel
dayPanel.setLayout(dayLayout);
dayLayout.setColumns(7);
dayLayout.setHgap(2);
dayLayout.setRows(7);
dayLayout.setVgap(2);
dayPanel.setBackground(Color.white);
dayPanel.setOpaque(true);
mainPanel.add(dayPanel, BorderLayout.CENTER);
// Time Panel
timePanel.setLayout(timeLayout);
lTimeSep.setText(" : ");
timePanel.add(fHour, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 0), 0, 0));
timePanel.add(lTimeSep, new GridBagConstraints(1, 0, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
timePanel.add(fMinute, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
timePanel.add(cbPM, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 0), 0, 0));
timePanel.add(lTZ, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 4, 0, 0), 0, 0));
timePanel.add(bOK, new GridBagConstraints(5, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 6, 0, 2), 0, 0));
mainPanel.add(timePanel, BorderLayout.SOUTH);
// Enter returns
fHour.addKeyListener(this);
// JSpinner ignores KeyListener
((JSpinner.DefaultEditor) fMinute.getEditor()).getTextField().addKeyListener(this);
fMinute.addChangeListener(this);
cbPM.addActionListener(this);
cbPM.addKeyListener(this);
bOK.setIcon(Env.getImageIcon("Ok16.gif"));
bOK.setMargin(new Insets(0, 1, 0, 1));
bOK.addActionListener(this);
AutoCompletion.enable(fHour);
}
use of javax.swing.JSpinner 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.JSpinner in project JMRI by JMRI.
the class JsonServerPreferencesPanel method portPanel.
private JPanel portPanel() {
JPanel panel = new JPanel();
port = new JSpinner(new SpinnerNumberModel(JsonServerPreferences.DEFAULT_PORT, 1, 65535, 1));
((JSpinner.DefaultEditor) port.getEditor()).getTextField().setEditable(true);
port.setEditor(new JSpinner.NumberEditor(port, "#"));
this.port.addChangeListener((ChangeEvent e) -> {
this.setValues();
});
this.port.setToolTipText(Bundle.getMessage("PortToolTip"));
panel.add(port);
JLabel label = new JLabel(Bundle.getMessage("LabelPort"));
label.setToolTipText(this.port.getToolTipText());
panel.add(label);
return panel;
}
use of javax.swing.JSpinner in project JMRI by JMRI.
the class JsonServerPreferencesPanel method heartbeatPanel.
private JPanel heartbeatPanel() {
JPanel panel = new JPanel();
heartbeatIntervalSpinner = new JSpinner(new SpinnerNumberModel(15, MIN_HEARTBEAT_INTERVAL, MAX_HEARTBEAT_INTERVAL, 1));
((JSpinner.DefaultEditor) heartbeatIntervalSpinner.getEditor()).getTextField().setEditable(true);
this.heartbeatIntervalSpinner.addChangeListener((ChangeEvent e) -> {
this.setValues();
});
this.heartbeatIntervalSpinner.setToolTipText(Bundle.getMessage("HeartbeatToolTip", MIN_HEARTBEAT_INTERVAL, MAX_HEARTBEAT_INTERVAL));
panel.add(heartbeatIntervalSpinner);
JLabel label = new JLabel(Bundle.getMessage("HeartbeatLabel"));
label.setToolTipText(this.heartbeatIntervalSpinner.getToolTipText());
panel.add(label);
return panel;
}
Aggregations