List of usage examples for javax.swing JSlider setPaintLabels
@BeanProperty(visualUpdate = true, description = "If true labels are painted on the slider.") public void setPaintLabels(boolean b)
From source file:Main.java
public Main() { setLayout(new BorderLayout()); JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 50, 25); slider.setMinorTickSpacing(2);//from w w w. jav a2s. c o m slider.setMajorTickSpacing(10); slider.setPaintTicks(true); slider.setPaintLabels(true); slider.setOrientation(JSlider.VERTICAL); slider.setInverted(false); // We'll just use the standard numeric labels for now... slider.setLabelTable(slider.createStandardLabels(10)); add(slider, BorderLayout.CENTER); }
From source file:MainClass.java
public MainClass() { super(true);// w ww .j a va 2 s . co m JSlider mySlider = new JSlider(); mySlider.setMajorTickSpacing(20); mySlider.setMinorTickSpacing(10); mySlider.setPaintTicks(true); mySlider.setPaintLabels(true); CurvedBorder border = new CurvedBorder(10, Color.darkGray); mySlider.setBorder(border); add(mySlider); }
From source file:CurvedExample.java
public CurvedExample() { super(true);/*from w ww . ja v a 2s . c om*/ JSlider mySlider = new JSlider(); mySlider.setMajorTickSpacing(20); mySlider.setMinorTickSpacing(10); mySlider.setPaintTicks(true); mySlider.setPaintLabels(true); CurvedBorder border = new CurvedBorder(10, Color.darkGray); mySlider.setBorder(border); add(mySlider); }
From source file:AlphaCompositeDemo.java
public AlphaCompositeDemo() { super();/*from w w w. j a va 2 s . com*/ Container container = getContentPane(); canvas = new MyCanvas(); container.add(canvas); rulesBox = new JComboBox(rulesLabels); rulesBox.setSelectedIndex(0); rulesBox.setAlignmentX(Component.LEFT_ALIGNMENT); rulesBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox) e.getSource(); canvas.compositeRule = rules[cb.getSelectedIndex()]; canvas.repaint(); } }); slider.setPaintTicks(true); slider.setMajorTickSpacing(25); slider.setMinorTickSpacing(25); slider.setPaintLabels(true); slider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JSlider slider = (JSlider) e.getSource(); canvas.alphaValue = (float) slider.getValue() / 100; canvas.repaint(); } }); JPanel panel = new JPanel(); panel.setLayout(new GridLayout(1, 3)); panel.add(rulesBox); panel.add(new JLabel("Alpha Adjustment x E-2: ", JLabel.RIGHT)); panel.add(slider); container.add(panel, BorderLayout.SOUTH); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); setSize(500, 300); setVisible(true); }
From source file:Main.java
public Main() { Container content = getContentPane(); content.setBackground(Color.white); JSlider slider1 = new JSlider(); slider1.setBorder(BorderFactory.createTitledBorder("JSlider without Tick Marks")); content.add(slider1, BorderLayout.NORTH); JSlider slider2 = new JSlider(); slider2.setBorder(BorderFactory.createTitledBorder("JSlider with Tick Marks")); slider2.setMajorTickSpacing(20);/*from w ww . j ava 2s . co m*/ slider2.setMinorTickSpacing(5); slider2.setPaintTicks(true); content.add(slider2, BorderLayout.CENTER); JSlider slider3 = new JSlider(); slider3.setBorder(BorderFactory.createTitledBorder("JSlider with Tick Marks & Labels")); slider3.setMajorTickSpacing(20); slider3.setMinorTickSpacing(5); slider3.setPaintTicks(true); slider3.setPaintLabels(true); content.add(slider3, BorderLayout.SOUTH); setSize(300, 300); setVisible(true); }
From source file:Main.java
public JSlider getSlider(int min, int max, int init, int mjrTkSp, int mnrTkSp) { JSlider slider = new JSlider(JSlider.HORIZONTAL, min, max, init); slider.setPaintTicks(true);/*from ww w .j a va 2 s. c om*/ slider.setMajorTickSpacing(mjrTkSp); slider.setMinorTickSpacing(mnrTkSp); slider.setPaintLabels(true); slider.addChangeListener(new SliderListener()); return slider; }
From source file:SliderControlPaintLine.java
public JSlider createSlider(JPanel panel, int orientation, int minimumValue, int maximumValue, int initValue, int majorTickSpacing, int minorTickSpacing) { JSlider slider = new JSlider(orientation, minimumValue, maximumValue, initValue); slider.setPaintTicks(true);/*from www. ja va 2 s . co m*/ slider.setMajorTickSpacing(majorTickSpacing); slider.setMinorTickSpacing(minorTickSpacing); slider.setPaintLabels(true); slider.addChangeListener(new SliderListener()); panel.add(slider); return slider; }
From source file:ArcApp.java
public JSlider setSlider(int min, int max, int init, int mjrTkSp, int mnrTkSp) { JSlider slider = new JSlider(JSlider.HORIZONTAL, min, max, init); slider.setPaintTicks(true);// w ww . ja v a 2 s .c om slider.setMajorTickSpacing(mjrTkSp); slider.setMinorTickSpacing(mnrTkSp); slider.setPaintLabels(true); slider.addChangeListener(new SliderListener()); return slider; }
From source file:Presentation.MainWindow.java
private void addSlider() { JSlider sliderTemp = new JSlider(12, 26, 26); sliderTemp.setLabelTable(sliderTemp.createStandardLabels(14)); sliderTemp.setMinorTickSpacing(1);//from w w w . ja va 2 s . c o m sliderTemp.setPaintLabels(true); sliderTemp.setPaintTicks(true); this.tSlider = sliderTemp; Label labelConsigne = new Label("Temprature de consigne : " + tSlider.getValue() + " C"); //Label labelOutdoorTemp = new Label(Singleton.getInstance().getAcquisition().getOutdoorTemp()); this.tLabel = labelConsigne; mPanel.add(labelConsigne); mPanel.add(sliderTemp); }
From source file:House.java
public JSlider setSlider(JPanel panel, int orientation, int minimumValue, int maximumValue, int initValue, int majorTickSpacing, int minorTickSpacing) { JSlider slider = new JSlider(orientation, minimumValue, maximumValue, initValue); slider.setPaintTicks(true);/*from ww w.ja v a 2s .co m*/ slider.setMajorTickSpacing(majorTickSpacing); slider.setMinorTickSpacing(minorTickSpacing); slider.setPaintLabels(true); slider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JSlider tempSlider = (JSlider) e.getSource(); if (tempSlider.equals(sliderTransX)) { transX = sliderTransX.getValue() - 150.0; canvas.repaint(); } else if (tempSlider.equals(sliderTransY)) { transY = sliderTransY.getValue() - 150.0; canvas.repaint(); } else if (tempSlider.equals(sliderRotateTheta)) { rotateTheta = sliderRotateTheta.getValue() * Math.PI / 180; canvas.repaint(); } else if (tempSlider.equals(sliderRotateX)) { rotateX = sliderRotateX.getValue(); canvas.repaint(); } else if (tempSlider.equals(sliderRotateY)) { rotateY = sliderRotateY.getValue(); canvas.repaint(); } else if (tempSlider.equals(sliderScaleX)) { if (sliderScaleX.getValue() != 0.0) { scaleX = sliderScaleX.getValue() / 100.0; canvas.repaint(); } } else if (tempSlider.equals(sliderScaleY)) { if (sliderScaleY.getValue() != 0.0) { scaleY = sliderScaleY.getValue() / 100.0; canvas.repaint(); } } } }); panel.add(slider); return slider; }