public SatelliteMultiViewerCorner() { layer = new SpinnerListModel(); layer.addChangeListener(new ChangeListener() { @SuppressWarnings("rawtypes") @Override public void stateChanged(ChangeEvent e) { // find viewer for satellite if (layer.getValue() instanceof LayerViewer) setViewer((LayerViewer) layer.getValue()); else setViewer(null); } }); spinner = new JSpinner(layer); // Workaround to fix the satellite jumping issue // caused by changeevent-setviewer-dolayout-setvalue-(layoutinvalid) spinner.setPreferredSize(new Dimension(105, 22)); getSatellite().getContentPane().add(spinner, BorderLayout.NORTH); // by default disabled setEnabled(false); }
/** * Creates new form OLCustomizer */ public OLCustomizer(OL ol) { this.ol = ol; initComponents(); try { ((JSpinner.NumberEditor)jSpinner1.getEditor()).getTextField().getAccessibleContext().setAccessibleName(jSpinner1.getAccessibleContext().getAccessibleName()); ((JSpinner.NumberEditor)jSpinner1.getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(jSpinner1.getAccessibleContext().getAccessibleDescription()); }catch (Exception e) { } if (ol.getType().equals(OL.DEFAULT)) jRadioButton1.setSelected(true); else if (ol.getType().equals(OL.ARABIC_NUMBERS)) jRadioButton2.setSelected(true); else if (ol.getType().equals(OL.LOWER_ALPHA)) jRadioButton3.setSelected(true); else if (ol.getType().equals(OL.UPPER_ALPHA)) jRadioButton4.setSelected(true); else if (ol.getType().equals(OL.LOWER_ROMAN)) jRadioButton5.setSelected(true); else if (ol.getType().equals(OL.UPPER_ROMAN)) jRadioButton6.setSelected(true); }
/** * Creates new form ULCustomizer */ public ULCustomizer(UL ul) { this.ul = ul; initComponents(); try { ((JSpinner.NumberEditor)jSpinner1.getEditor()).getTextField().getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(ULCustomizer.class,"ACSN_UL_Items_Spinner")); ((JSpinner.NumberEditor)jSpinner1.getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(ULCustomizer.class,"ACSD_UL_Items_Spinner")); }catch (Exception e) { } if (ul.getType().equals(UL.DEFAULT)) jRadioButton1.setSelected(true); else if (ul.getType().equals(UL.DISC)) jRadioButton2.setSelected(true); else if (ul.getType().equals(UL.CIRCLE)) jRadioButton3.setSelected(true); else if (ul.getType().equals(UL.SQUARE)) jRadioButton4.setSelected(true); }
/** Creates new form TABLE_1Panel */ public TABLECustomizer(TABLE table) { this.table = table; initComponents(); try { ((JSpinner.NumberEditor)jSpinner1.getEditor()).getTextField().getAccessibleContext().setAccessibleName(jSpinner1.getAccessibleContext().getAccessibleName()); ((JSpinner.NumberEditor)jSpinner1.getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(jSpinner1.getAccessibleContext().getAccessibleDescription()); ((JSpinner.NumberEditor)jSpinner2.getEditor()).getTextField().getAccessibleContext().setAccessibleName(jSpinner2.getAccessibleContext().getAccessibleName()); ((JSpinner.NumberEditor)jSpinner2.getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(jSpinner2.getAccessibleContext().getAccessibleDescription()); ((JSpinner.NumberEditor)jSpinner3.getEditor()).getTextField().getAccessibleContext().setAccessibleName(jSpinner3.getAccessibleContext().getAccessibleName()); ((JSpinner.NumberEditor)jSpinner3.getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(jSpinner3.getAccessibleContext().getAccessibleDescription()); ((JSpinner.NumberEditor)jSpinner4.getEditor()).getTextField().getAccessibleContext().setAccessibleName(jSpinner4.getAccessibleContext().getAccessibleName()); ((JSpinner.NumberEditor)jSpinner4.getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(jSpinner4.getAccessibleContext().getAccessibleDescription()); ((JSpinner.NumberEditor)jSpinner5.getEditor()).getTextField().getAccessibleContext().setAccessibleName(jSpinner5.getAccessibleContext().getAccessibleName()); ((JSpinner.NumberEditor)jSpinner5.getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(jSpinner5.getAccessibleContext().getAccessibleDescription()); ((JSpinner.NumberEditor)widthSpinner.getEditor()).getTextField().getAccessibleContext().setAccessibleName(widthSpinner.getAccessibleContext().getAccessibleName()); ((JSpinner.NumberEditor)widthSpinner.getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(widthSpinner.getAccessibleContext().getAccessibleDescription()); } catch (Exception e) { } }
private void initComponents() { setLayout(new BorderLayout(5, 5)); setBorder(new EmptyBorder(5, 5, 5, 5)); capacitySpinner = new JSpinner(); capacitySpinner.setPreferredSize(DIM_BUTTON_XS); infiniteCheckBox = new JCheckBox("Infinite"); JPanel capacityPanel = new JPanel(); capacityPanel.setBorder(new TitledBorder(new EtchedBorder(), "Storage Capacity")); capacityPanel.add(new JLabel("Capacity: ")); capacityPanel.add(capacitySpinner); capacityPanel.add(infiniteCheckBox); optionTable = new StorageOptionTable(); JPanel optionPanel = new JPanel(new BorderLayout()); optionPanel.setBorder(new TitledBorder(new EtchedBorder(), "Storage Options")); optionPanel.add(new WarningScrollTable(optionTable, WARNING_CLASS)); add(capacityPanel, BorderLayout.NORTH); add(optionPanel, BorderLayout.CENTER); }
@BeforeMethod public void showDialog() throws Throwable { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { frame = new JFrame("My Dialog"); frame.setName("dialog-1"); JSpinner listSpinner = createListSpinner(); Calendar calendar = Calendar.getInstance(); JSpinner numberSpinner = createNumberSpinner(calendar); JSpinner dateSpinner = createDateSpinner(calendar); frame.setLayout(new FlowLayout()); frame.getContentPane().add(listSpinner); frame.getContentPane().add(numberSpinner); frame.getContentPane().add(dateSpinner); frame.pack(); frame.setAlwaysOnTop(true); frame.setVisible(true); } }); driver = new JavaAgent(); }
private JSpinner createDateSpinner(Calendar calendar) { Date initDate = calendar.getTime(); calendar.add(Calendar.YEAR, -100); Date earliestDate = calendar.getTime(); calendar.add(Calendar.YEAR, 200); Date latestDate = calendar.getTime(); SpinnerDateModel spinnerDateModel = new SpinnerDateModel(initDate, earliestDate, latestDate, Calendar.YEAR); JSpinner dateSpinner = new JSpinner(spinnerDateModel); dateSpinner.setEditor(new JSpinner.DateEditor(dateSpinner, "MM/yyyy")); dateSpinner.setName("date-spinner"); return dateSpinner; }
public static void reset() { entries.clear(); add(Component.class, RUnknownComponent.class); add(Window.class, RWindow.class); add(JTable.class, RTable.class); add(JTableHeader.class, RTableHeader.class); add(AbstractButton.class, RAbstractButton.class); add(JToggleButton.class, RToggleButton.class); add(JComboBox.class, RComboBox.class); add(JTextComponent.class, RTextComponent.class); add(JTree.class, RTree.class); add(JList.class, RList.class); add(JTabbedPane.class, RTabbedPane.class); add(JMenuItem.class, RMenuItem.class); add(JSlider.class, RSlider.class); add(JProgressBar.class, RProgressBar.class); add(JSpinner.class, RSpinner.class); add(DefaultEditor.class, RDefaultEditor.class); add(JColorChooser.class, RColorChooser.class); add(JSplitPane.class, RSplitPane.class); add(BasicSplitPaneDivider.class, RSplitPane.class); add(JFileChooser.class, RFileChooser.class); add(JEditorPane.class, REditorPane.class); add(JLabel.class, RLabel.class); add(JScrollBar.class, RIgnoreComponent.class); }
/** * Prompt the user for a value * * @param component The component to use as parent for the prompting dialog * @param description The description of the value being prompted for * @return True if the value was configured */ public boolean showValueDialog(final JComponent component, String description) { ValueDialog dialog = new ValueDialog(component, name, description); dialog.setTitle(name); dialog.setLocationRelativeTo(null); EventQueue.invokeLater(new Runnable() { public void run () { JComponent focusComponent = component; if (focusComponent instanceof JSpinner) focusComponent = ((JSpinner.DefaultEditor)((JSpinner)component).getEditor()).getTextField(); focusComponent.requestFocusInWindow(); } }); dialog.setVisible(true); return dialog.okPressed; }
private PartSpinner(int dimension) { super(new PartSpinnerModel()); this.dimension = dimension; setupFilter(); addChangeListener(new ChangeListener(){ @Override public void stateChanged(ChangeEvent e) { Part part = controller.getSelectedPart(); PartSpinner spinner = (PartSpinner) e.getSource(); if(part != null && ((JSpinner.DefaultEditor)getEditor()).getTextField().hasFocus()) { double d = (double) spinner.getValue(); float[] prevValues = part.getValues(); part.setValue((float) d, dimension); controller.mainController.versionController.applyChange(new ChangeSetValues(prevValues, part.getValues(), part.getName(), (int) controller.getTime())); } } }); }
protected boolean accept(Component jc) { if (extListener != null && extListener.accept(jc)) { return true; } if (!(jc instanceof JComponent)) { return false; } return isProbablyAContainer (jc) || jc instanceof JList || jc instanceof JComboBox || jc instanceof JTree || jc instanceof JToggleButton || //covers toggle, radio, checkbox jc instanceof JTextComponent || jc instanceof JColorChooser || jc instanceof JSpinner || jc instanceof JSlider; }
private void initComponents() { this.setLayout(new BorderLayout()); epochs = new JSpinner(new SpinnerNumberModel(10, 10, 50, 1)); JPanel epochOption = new JPanel(new BorderLayout()); JPanel flowTemp = new JPanel(new FlowLayout(FlowLayout.LEFT)); epochs.setPreferredSize(new Dimension(70, 40)); epochs.setFont(new Font(epochs.getFont().getName(), epochs.getFont().getStyle(), epochs.getFont().getSize() + 4)); flowTemp.add(new JLabel("<html><body><h3>Select the maximum number of epochs: </h3></body></html> ")); flowTemp.add(epochs); JButton setEpoch = new JButton(this.setEpoch); setEpoch.setPreferredSize(new Dimension(85, 35)); flowTemp.add(setEpoch); epochOption.add(flowTemp, BorderLayout.CENTER); //JPanel btnPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); //btnPanel.add(setEpoch); //epochOption.add(btnPanel,BorderLayout.SOUTH); this.add(epochOption, BorderLayout.NORTH); }
/** * Prompts the user for int value * * @param name The name of the dialog to show * @param currentValue The current value to be displayed * @param description The help text to provide * @return The value selected by the user */ static public Value intValue (String name, final int currentValue, final String description) { return new DefaultValue(name, String.valueOf(currentValue)) { public void showDialog () { JSpinner spinner = new JSpinner(new SpinnerNumberModel(currentValue, Short.MIN_VALUE, Short.MAX_VALUE, 1)); if (showValueDialog(spinner, description)) value = String.valueOf(spinner.getValue()); } public Object getObject () { return Integer.valueOf(value); } }; }
/** * Prompts the user for float value * * @param name The name of the dialog to show * @param currentValue The current value to be displayed * @param description The help text to provide * @param min The minimum value to allow * @param max The maximum value to allow * @return The value selected by the user */ static public Value floatValue (String name, final float currentValue, final float min, final float max, final String description) { return new DefaultValue(name, String.valueOf(currentValue)) { public void showDialog () { JSpinner spinner = new JSpinner(new SpinnerNumberModel(currentValue, min, max, 0.1f)); if (showValueDialog(spinner, description)) value = String.valueOf(((Double)spinner.getValue()).floatValue()); } public Object getObject () { return Float.valueOf(value); } }; }
public bug6463712() { SpinnerNumberModel m1 = new SpinnerNumberModel(); JSpinner s = new JSpinner(m1); s.addChangeListener(this); SpinnerDateModel m2 = new SpinnerDateModel(); s.setModel(m2); // m1 is no longer linked to the JSpinner (it has been replaced by m2), so // the following should not trigger a call to our stateChanged() method... m1.setValue(new Integer(1)); }
WidthHeightPanel(boolean showWidth, boolean showHeight) { ResourceBundle bundle = NbBundle.getBundle(BoxFillerInitializer.class); JLabel widthLabel = new JLabel(bundle.getString("BoxFillerInitializer.width")); // NOI18N JLabel heightLabel = new JLabel(bundle.getString("BoxFillerInitializer.height")); // NOI18N widthField = new JSpinner(new SpinnerNumberModel()); heightField = new JSpinner(new SpinnerNumberModel()); GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(widthLabel) .addComponent(heightLabel)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(widthField) .addComponent(heightField)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(widthLabel) .addComponent(widthField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(heightLabel) .addComponent(heightField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); widthLabel.setVisible(showWidth); heightLabel.setVisible(showHeight); widthField.setVisible(showWidth); heightField.setVisible(showHeight); }
/** * Test Profiler options. */ public void testOptions() { OptionsOperator options = OptionsOperator.invoke(); options.selectJava(); JTabbedPaneOperator tabbedPane = new JTabbedPaneOperator(options); tabbedPane.selectPage("Profiler"); JListOperator categoriesOper = new JListOperator(options); // General category assertEquals("Wrong profiling port.", 5140, new JSpinnerOperator(options).getValue()); // manage calibration data new JButtonOperator(options, "Manage").pushNoBlock(); NbDialogOperator manageOper = new NbDialogOperator("Manage Calibration data"); JTableOperator platformsOper = new JTableOperator(manageOper); platformsOper.selectCell(0, 0); new JButtonOperator(manageOper, "Calibrate").pushNoBlock(); new NbDialogOperator("Information").ok(); manageOper.closeByButton(); // reset new JButtonOperator(options, "Reset").push(); // Snapshots category categoriesOper.selectItem("Snapshots"); JLabelOperator lblSnapshotOper = new JLabelOperator(options, "When taking snapshot:"); assertEquals("Wrong value for " + lblSnapshotOper.getText(), "Open snapshot", new JComboBoxOperator((JComboBox) lblSnapshotOper.getLabelFor()).getSelectedItem()); JLabelOperator lblOpenOper = new JLabelOperator(options, "Open automatically:"); assertEquals("Wrong value for " + lblOpenOper.getText(), "On first saved snapshot", new JComboBoxOperator((JComboBox) lblOpenOper.getLabelFor()).getSelectedItem()); // Engine category categoriesOper.selectItem("Engine"); JLabelOperator lblSamplingOper = new JLabelOperator(options, "Sampling frequency"); assertEquals("Wrong value for " + lblSamplingOper.getText(), 10, new JSpinnerOperator((JSpinner) lblSamplingOper.getLabelFor()).getValue()); options.cancel(); }
public JExtendedSpinner() { super(); ((JSpinner.DefaultEditor) getEditor()).getTextField().setFont(UIManager.getFont("Label.font")); // NOI18N ((JSpinner.DefaultEditor) getEditor()).getTextField().addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(final java.awt.event.KeyEvent e) { if (e.getKeyCode() == java.awt.event.KeyEvent.VK_ESCAPE) { processKeyEvent(e); } } }); configureWheelListener(); }
public JExtendedSpinner(SpinnerModel model) { super(model); ((JSpinner.DefaultEditor) getEditor()).getTextField().setFont(UIManager.getFont("Label.font")); // NOI18N ((JSpinner.DefaultEditor) getEditor()).getTextField().addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(final java.awt.event.KeyEvent e) { if (e.getKeyCode() == java.awt.event.KeyEvent.VK_ESCAPE) { processKeyEvent(e); } } }); configureWheelListener(); }
public void setModel(SpinnerModel model) { Font font = ((JSpinner.DefaultEditor) getEditor()).getTextField().getFont(); String accessibleName = ((JSpinner.DefaultEditor) getEditor()).getTextField().getAccessibleContext().getAccessibleName(); String accessibleDescription = ((JSpinner.DefaultEditor) getEditor()).getTextField().getAccessibleContext() .getAccessibleDescription(); super.setModel(model); ((JSpinner.DefaultEditor) getEditor()).getTextField().setFont(font); ((JSpinner.DefaultEditor) getEditor()).getTextField().getAccessibleContext().setAccessibleName(accessibleName); ((JSpinner.DefaultEditor) getEditor()).getTextField().getAccessibleContext() .setAccessibleDescription(accessibleDescription); }
public void fixAccessibility() { if (getAccessibleContext() != null) { ((JSpinner.DefaultEditor) getEditor()).getTextField().getAccessibleContext() .setAccessibleName(getAccessibleContext().getAccessibleName()); ((JSpinner.DefaultEditor) getEditor()).getTextField().getAccessibleContext() .setAccessibleDescription(getAccessibleContext().getAccessibleDescription()); } }
/** * Maps {@code JSpinner.getEditor()} through queue */ public JComponent getEditor() { return (runMapping(new MapAction<JComponent>("getEditor") { @Override public JComponent map() { return ((JSpinner) getSource()).getEditor(); } })); }
/** * Maps {@code JSpinner.removeChangeListener(ChangeListener)} through queue */ public void removeChangeListener(final ChangeListener changeListener) { runMapping(new MapVoidAction("removeChangeListener") { @Override public void map() { ((JSpinner) getSource()).removeChangeListener(changeListener); } }); }
@Override public void stateChanged(ChangeEvent ce) { if (this.enabledChangeListener==true) { Object ceTrigger = ce.getSource(); if (ceTrigger instanceof JSpinner) { this.saveTimeModelToSimulationSetup(); } } }
@Override public void stateChanged(ChangeEvent ce) { Object ceTrigger = ce.getSource(); if (ceTrigger instanceof JSpinner) { this.setFilePropertyManualStartTimeForOffset(this.getJSpinnerTime().toString()); } }
@Override public Object getCellEditorValue(){ Object value = ((JSpinner)editorComponent).getValue(); // If the value is a String or Double, convert it to Float if(value instanceof String){ value = ((String)value).replace(",", "."); value = (Float.parseFloat(((String)value))); }else if(value instanceof Double){ value = ((Double)value).floatValue(); } return value; }
@Override public Object getCellEditorValue() { // Add the difference remembered at initialization time, to compensate errors caused by the time formats Date returnedDate = (Date) ((JSpinner)editorComponent).getValue(); Date correctDate = new Date(returnedDate.getTime() + difference); return correctDate.getTime(); }
private void initComponents() { this.setLayout(new BorderLayout()); epochs = new JSpinner(new SpinnerNumberModel(10, 10, 50, 1)); JPanel epochOption = new JPanel(new BorderLayout()); JPanel flowTemp = new JPanel(new FlowLayout(FlowLayout.LEFT)); epochs.setPreferredSize(new Dimension(70, 40)); epochs.setFont(new Font(epochs.getFont().getName(), epochs.getFont().getStyle(), epochs.getFont().getSize() + 4)); flowTemp.add(new JLabel("<html><body><h3>Select the maximum number of epochs: </h3></body></html> ")); flowTemp.add(epochs); JButton setEpoch = new JButton(this.setEpoch); setEpoch.setPreferredSize(new Dimension(85, 35)); flowTemp.add(setEpoch); epochOption.add(flowTemp, BorderLayout.CENTER); this.add(epochOption, BorderLayout.NORTH); }
/** * Initialize all components of this panel */ private void initComponents() { setLayout(new BorderLayout(5, 5)); this.setBorder(new EmptyBorder(20, 20, 20, 20)); // Builds upper panel JPanel upperPanel = new JPanel(new BorderLayout()); JLabel description = new JLabel(BLOCKING_DESCRIPTION); upperPanel.add(description, BorderLayout.CENTER); //build upper right corner of the main panel JPanel upRightPanel = new JPanel(new BorderLayout()); addRegion = new JButton("Add Region"); addRegion.setMinimumSize(DIM_BUTTON_S); upRightPanel.add(addRegion, BorderLayout.CENTER); upperPanel.add(upRightPanel, BorderLayout.EAST); //build spinner panel JPanel spinnerPanel = new JPanel(); JLabel spinnerDescrLabel = new JLabel("Regions:"); regionsNumSpinner = new JSpinner(); regionsNumSpinner.setPreferredSize(DIM_BUTTON_XS); spinnerPanel.add(spinnerDescrLabel); spinnerPanel.add(regionsNumSpinner); upRightPanel.add(spinnerPanel, BorderLayout.SOUTH); add(upperPanel, BorderLayout.NORTH); // Creates blocking regions list regions = new RegionTable(); JScrollPane jsp = new JScrollPane(regions, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); jsp.setPreferredSize(new Dimension(500, 200)); add(jsp, BorderLayout.WEST); update(); }
/** * Initialize all gui related stuff */ private void initComponent() { setLayout(new GridLayout(2, 1)); stationPanel = new JPanel(new BorderLayout(5, 5)); stationPanel.setBorder(BorderFactory.createTitledBorder(new EtchedBorder(), "Stations in " + bd.getRegionName(regionKey))); // Creates panel with add station button and spinner JPanel addPanel = new JPanel(new BorderLayout()); addStation = new JButton("Add Station"); addStation.setToolTipText("Adds a station to selected blocking region"); addStation.setMinimumSize(DIM_BUTTON_S); addPanel.add(addStation, BorderLayout.CENTER); //build spinner panel JPanel spinnerPanel = new JPanel(); JLabel spinnerDescrLabel = new JLabel("Stations:"); stationNumSpinner = new JSpinner(); stationNumSpinner.setPreferredSize(DIM_BUTTON_XS); spinnerPanel.add(spinnerDescrLabel); spinnerPanel.add(stationNumSpinner); addPanel.add(spinnerPanel, BorderLayout.SOUTH); // Creates a tmp panel to put addStation panel on the northeast corner JPanel tmpPanel = new JPanel(new BorderLayout()); tmpPanel.add(addPanel, BorderLayout.NORTH); stationPanel.add(tmpPanel, BorderLayout.EAST); // Creates table to display stations stationTable = new StationTable(); warningPanel = new WarningScrollTable(stationTable, WARNING_STATION); warningPanel.addCheckVector(sd.getStationKeysNoSourceSink()); stationPanel.add(warningPanel); add(stationPanel); // Creates the inner parameter panel parameterPanel = new BlockingRegionParameterPanel(cd, bd, regionKey); // Hides unneeded global properties (specified by table) parameterPanel.setGlobalVisible(false); add(parameterPanel); }
private void initComponents() { this.setBorder(new EmptyBorder(5, 5, 5, 5)); this.setLayout(new BorderLayout(5, 5)); infiniteQueueSelector = new JRadioButton("Infinite"); finiteQueueSelector = new JRadioButton("Finite"); queueLengthGroup = new ButtonGroup(); queueLengthGroup.add(infiniteQueueSelector); queueLengthGroup.add(finiteQueueSelector); queueLengthSpinner = new JSpinner(); queueLengthSpinner.setValue(new Integer(1)); queueLengthSpinner.setPreferredSize(DIM_BUTTON_XS); queueTable = new QueueTable(); //queue details panel JPanel queuePolicyPanel = new JPanel(new BorderLayout()); queuePolicyPanel.setBorder(new TitledBorder(new EtchedBorder(), "Queue Policy")); queuePolicyPanel.add(new WarningScrollTable(queueTable, WARNING_CLASS), BorderLayout.CENTER); JPanel queueLengthPanel = new JPanel(new GridLayout(3, 1, 3, 3)); queueLengthPanel.setBorder(new TitledBorder(new EtchedBorder(), "Capacity")); // Queue strategy selector JPanel queueStrategy = new JPanel(new BorderLayout()); queueStrategy.add(new JLabel("Station queue policy: "), BorderLayout.WEST); queuePolicyCombo = new JComboBox(); queueStrategy.add(queuePolicyCombo, BorderLayout.CENTER); queuePolicyPanel.add(queueStrategy, BorderLayout.NORTH); queueStrategy.setBorder(BorderFactory.createEmptyBorder(2, 5, 10, 5)); queueLengthPanel.add(infiniteQueueSelector); queueLengthPanel.add(finiteQueueSelector); JPanel spinnerPanel = new JPanel(); JLabel label = new JLabel("<html>Max no. customers <br>(queue+service)</html>"); label.setToolTipText("The maximum number of customers allowed in the station."); spinnerPanel.add(label); spinnerPanel.add(queueLengthSpinner); queueLengthPanel.add(spinnerPanel); this.add(queueLengthPanel, BorderLayout.WEST); this.add(queuePolicyPanel, BorderLayout.CENTER); }
public ComparePanel() { dateSpinner = new JSpinner( new SpinnerDateModel() ); JSpinner.DateEditor dateEditor = new JSpinner.DateEditor(dateSpinner, "dd.MM.yyyy"); dateSpinner.setEditor(dateEditor); dateSpinner.setValue(new Date()); timeSpinner = new JSpinner( new SpinnerDateModel() ); JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(timeSpinner, "HH:mm:ss"); timeSpinner.setEditor(timeEditor); timeSpinner.setValue(new Date()); }
/** * Maps {@code JSpinner.getNextValue()} through queue */ public Object getNextValue() { return (runMapping(new MapAction<Object>("getNextValue") { @Override public Object map() { return ((JSpinner) getSource()).getNextValue(); } })); }
public void initialize() { JPanel edit = new JPanel(new GridLayout(4, 1, 0, 5)); stepsLabel = new JLabel("Steps:"); steps = new JSpinner(new SpinnerNumberModel(SPA.getNumberOfSteps(), 2, ParametricAnalysis.MAX_STEP_NUMBER, 1)); steps.setToolTipText("Sets the number of performed simulations"); edit.add(stepsLabel); edit.add(steps); edit.setPreferredSize(new Dimension(130, 108)); JPanel editLables = new JPanel(new GridLayout(4, 1, 0, 5)); editLables.add(stepsLabel); editLables.setPreferredSize(new Dimension(100, 108)); JPanel editPanel = new JPanel(); editPanel.add(editLables); editPanel.add(edit); editPanel.setBorder(new EmptyBorder(10, 20, 0, 20)); JPanel cont = new JPanel(new BorderLayout()); title = new TitledBorder("Simulation seed variation"); cont.add(editPanel, BorderLayout.CENTER); scroll = new JScrollPane(cont); scroll.setBorder(title); description = new JTextArea(DESCRIPTION); description.setOpaque(false); description.setEditable(false); description.setLineWrap(true); description.setWrapStyleWord(true); descrPane = new JScrollPane(description); descriptionTitle = new TitledBorder(new EtchedBorder(), "Description"); descrPane.setBorder(descriptionTitle); descrPane.setMinimumSize(new Dimension(80, 0)); scroll.setMinimumSize(new Dimension(360, 0)); setLeftComponent(scroll); setRightComponent(descrPane); setListeners(); this.setBorder(new EmptyBorder(5, 0, 5, 0)); }
private void initDateModel() { SpinnerDateModel dmodel = new SpinnerDateModel(); dateSpinner.setModel(dmodel); dateSpinner.setEditor(new JSpinner.DateEditor(dateSpinner, "MMM - dd - yyyy")); SpinnerDateModel tmodel = new SpinnerDateModel(); timeSpinner.setModel(tmodel); timeSpinner.setEditor(new JSpinner.DateEditor(timeSpinner, "HH:mm")); }
/** * Constructs a new {@code JSpinnerRange}. * * @param min the {@code JSpinner} that contains the minimum value * @param max the {@code JSpinner} that contains the maximum value */ public JSpinnerRange(final JSpinner min, final JSpinner max) { this.min = min; this.max = max; this.maxRange = DEFAULT_MAX_RANGE; }
private Component getEditor() { JComponent editorComponent = ((JSpinner) component).getEditor(); if (editorComponent == null) { throw new JavaAgentException("Null value returned by getEditor() on spinner", null); } if (editorComponent instanceof JSpinner.DefaultEditor) { editorComponent = ((JSpinner.DefaultEditor) editorComponent).getTextField(); } return editorComponent; }
private JSpinner createListSpinner() { String[] monthStrings = { "January", "February", "March", "April" }; SpinnerListModel spinnerListModel = new SpinnerListModel(monthStrings); JSpinner listSpinner = new JSpinner(spinnerListModel); listSpinner.setName("list-spinner"); return listSpinner; }
private String getSpinnerText() { JComponent editor = ((JSpinner) component).getEditor(); if (editor == null) { } else { RComponentFactory finder = new RComponentFactory(omapConfig); if (editor instanceof JSpinner.DefaultEditor) { RComponent rComponent = finder.findRawRComponent(editor, null, recorder); return rComponent.getText(); } } return null; }