Java JSlider createLabelField(String preText, String postText, JSlider s)

Here you can find the source of createLabelField(String preText, String postText, JSlider s)

Description

create Label Field

License

LGPL

Declaration

public static JPanel createLabelField(String preText, String postText, JSlider s) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import javax.swing.JLabel;
import javax.swing.JPanel;

import javax.swing.JSlider;
import javax.swing.JSpinner;

import javax.swing.SpinnerNumberModel;

public class Main {
    public static JPanel createLabelField(String preText, String postText, JSlider s) {
        JPanel p = new JPanel();

        JSpinner spin = new JSpinner(new SpinnerNumberModel(s.getValue(), s.getMinimum(), s.getMaximum(), 1));
        spin.addChangeListener(ce -> {
            s.setValue((Integer) spin.getValue());
        });/* www .j  a  va 2 s.  c  om*/
        p.add(new JLabel(preText));
        p.add(spin);
        p.add(new JLabel(postText));

        return p;
    }
}

Related

  1. addVerticalMouseListener(final JPanel panel, final JSlider slider)
  2. adjustWithoutNotifyingListeners(JSlider slider, int value)
  3. ajustarValorDeslizador(JSlider sldActual, int valor)
  4. buildIntegerFieldWithSlider(final JSlider matchingSlider)
  5. createJSlider(final BoundedRangeModel model)
  6. createSliderPanel(final JSlider slider, String label, int width)
  7. fixWinSliderUI(JSlider s)
  8. makeLabelSliderPanelHorizontal(String text, JSlider slider)
  9. reapplyFontSize(JSlider slider)