Java Code Examples for javax.swing.JSlider#setMaximum()
The following examples show how to use
javax.swing.JSlider#setMaximum() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FuzzerOptionsPanel.java From zap-extensions with Apache License 2.0 | 6 votes |
private static JSlider createDefaultFuzzDelayInMsSlider( int delayInMs, int maxDelayInMs, final JLabel currentValueFeedbackLabel) { final JSlider delaySlider = new JSlider(); delaySlider.setMinimum(0); delaySlider.setValue(delayInMs); delaySlider.setMaximum(maxDelayInMs); delaySlider.setMinorTickSpacing(25); delaySlider.setMajorTickSpacing(100); delaySlider.setPaintTicks(true); delaySlider.setPaintLabels(true); delaySlider.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { currentValueFeedbackLabel.setText(Integer.toString(delaySlider.getValue())); } }); return delaySlider; }
Example 2
Source File: FuzzOptionsPanel.java From zap-extensions with Apache License 2.0 | 6 votes |
private static JSlider createDefaultFuzzDelayInMsSlider( int defaultDelayInMs, int maxDelayInMs, final JLabel currentValueFeedbackLabel) { final JSlider delaySlider = new JSlider(); delaySlider.setMinimum(0); delaySlider.setValue(defaultDelayInMs); delaySlider.setMaximum(maxDelayInMs); delaySlider.setMinorTickSpacing(25); delaySlider.setMajorTickSpacing(100); delaySlider.setPaintTicks(true); delaySlider.setPaintLabels(true); delaySlider.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { currentValueFeedbackLabel.setText(Integer.toString(delaySlider.getValue())); } }); return delaySlider; }
Example 3
Source File: ChartPanel.java From javamelody with Apache License 2.0 | 6 votes |
private JSlider createSlider() { final JSlider slider = new JSlider(); slider.setOpaque(false); slider.setMinimum(10); slider.setMaximum(200); slider.setValue(100); slider.setLabelTable(slider.createStandardLabels(50)); slider.setMajorTickSpacing(100); slider.setMinorTickSpacing(10); slider.setExtent(20); // slider.setPaintLabels(true); // slider.setPaintTicks(true); // slider.setSnapToTicks(true); slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { final int value = slider.getValue(); refreshZoom(value); } }); return slider; }
Example 4
Source File: ViewElementSlider.java From Robot-Overlord-App with GNU General Public License v2.0 | 6 votes |
public ViewElementSlider(RobotOverlord ro,IntEntity e,int top,int bottom) { super(ro); this.e=e; e.addObserver(this); field = new JSlider(); field.setMaximum(top); field.setMinimum(bottom); field.setMinorTickSpacing(1); field.setValue(e.get()); field.addChangeListener(this); field.addFocusListener(this); JLabel label = new JLabel(e.getName(),JLabel.LEADING); value = new JLabel(Integer.toString(field.getValue()),JLabel.RIGHT); Dimension dim = new Dimension(30,1); value.setMinimumSize(dim); value.setPreferredSize(dim); value.setMaximumSize(dim); panel.setLayout(new BorderLayout()); panel.add(label,BorderLayout.LINE_START); panel.add(field,BorderLayout.CENTER); panel.add(value,BorderLayout.LINE_END); }
Example 5
Source File: ViewElementSliderDouble.java From Robot-Overlord-App with GNU General Public License v2.0 | 6 votes |
public ViewElementSliderDouble(RobotOverlord ro,DoubleEntity e,int top,int bottom) { super(ro); this.e=e; e.addObserver(this); field = new JSlider(); field.setMaximum(top); field.setMinimum(bottom); field.setMinorTickSpacing(1); field.setValue((int)Math.floor(e.get())); field.addChangeListener(this); field.addFocusListener(this); JLabel label = new JLabel(e.getName(),JLabel.LEADING); value = new JLabel(Integer.toString(field.getValue()),JLabel.RIGHT); Dimension dim = new Dimension(30,1); value.setMinimumSize(dim); value.setPreferredSize(dim); value.setMaximumSize(dim); panel.setLayout(new BorderLayout()); panel.add(label,BorderLayout.LINE_START); panel.add(field,BorderLayout.CENTER); panel.add(value,BorderLayout.LINE_END); }
Example 6
Source File: ViewElementColor.java From Robot-Overlord-App with GNU General Public License v2.0 | 6 votes |
private JSlider addField(float value,JPanel parent,String labelName,GridBagConstraints gbc) { JSlider field = new JSlider(); field.setMaximum(255); field.setMinimum(0); field.setMinorTickSpacing(1); field.setValue((int)(value*255)); field.addChangeListener(this); field.addFocusListener(this); JLabel label = new JLabel(labelName,JLabel.LEADING); JPanel panel = new JPanel(new BorderLayout()); panel.add(label,BorderLayout.LINE_START); panel.add(field,BorderLayout.LINE_END); parent.add(panel,gbc); return field; }
Example 7
Source File: DefaultProductLayer.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
public JPanel getControlPanel(final WorldWindowGLCanvas wwd) { final JSlider opacitySlider = new JSlider(); opacitySlider.setMaximum(100); opacitySlider.setValue((int) (getOpacity() * 100)); opacitySlider.setEnabled(true); opacitySlider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { int value = opacitySlider.getValue(); setOpacity(value / 100d); wwd.repaint(); } }); //theSelectedObjectLabel = new JLabel("Selected: "); final JPanel opacityPanel = new JPanel(new BorderLayout(5, 5)); opacityPanel.add(new JLabel("Opacity"), BorderLayout.WEST); opacityPanel.add(opacitySlider, BorderLayout.CENTER); return opacityPanel; }
Example 8
Source File: GameToolbar.java From SproutLife with MIT License | 4 votes |
/** * Create the panel. */ public void buildPanel() { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); horizontalStrut = Box.createHorizontalStrut(20); add(horizontalStrut); JLabel lblZoom = new JLabel("Zoom"); add(lblZoom); //lblZoom.setMinimumSize(new Dimension(100, 14)); zoomSlider = new JSlider(); zoomSlider.setPreferredSize(new Dimension(100, 29)); add(zoomSlider); zoomSlider.setMinorTickSpacing(1); zoomSlider.setMinimum(-5); zoomSlider.setValue(-2); zoomSlider.setMaximum(5); JLabel speedLabel = new JLabel("Speed"); add(speedLabel); speedSlider = new JSlider(); speedSlider.setPreferredSize(new Dimension(100, 29)); speedSlider.setSnapToTicks(true); add(speedSlider); speedSlider.setMinimum(-5); speedSlider.setMaximum(4); speedSlider.setValue(-2); gifStopRecordingButton = new JButton("GIF - Stop Rec."); gifStopRecordingButton.setVisible(false); add(gifStopRecordingButton); startPauseButton = new JButton("Start"); add(startPauseButton); startPauseButton.setMaximumSize(new Dimension(200, 23)); startPauseButton.setPreferredSize(new Dimension(80, 29)); stepButton = new JButton("Step"); stepButton.setPreferredSize(new Dimension(80, 29)); add(stepButton); resetButton = new JButton("Reset"); resetButton.setPreferredSize(new Dimension(80, 29)); add(resetButton); horizontalStrut_1 = Box.createHorizontalStrut(20); add(horizontalStrut_1); }