Example usage for javax.swing JSlider setMinimumSize

List of usage examples for javax.swing JSlider setMinimumSize

Introduction

In this page you can find the example usage for javax.swing JSlider setMinimumSize.

Prototype

@BeanProperty(description = "The minimum size of the component.")
public void setMinimumSize(Dimension minimumSize) 

Source Link

Document

Sets the minimum size of this component to a constant value.

Usage

From source file:Main.java

public static JSlider getSlider(int w, int h, String name, int minValue, int maxValue, int initValue) {
    JSlider slider = new JSlider(JSlider.HORIZONTAL, minValue, maxValue, initValue);
    slider.setFont(getFont());/*  w  w w  . j  a v a2s . c om*/
    slider.setPreferredSize(getSliderDimension(w, h));
    slider.setMinimumSize(getSliderDimension(w, h));
    slider.setName(name);
    return slider;
}

From source file:Main.java

public static JSlider getSlider(int w, int h, String name, int minValue, int maxValue) {
    JSlider slider = new JSlider(JSlider.HORIZONTAL, minValue, maxValue, ((maxValue + minValue) / 2));
    slider.setFont(getFont());//w w w . j  a  v a2s. c  o m
    slider.setPreferredSize(getSliderDimension(w, h));
    slider.setMinimumSize(getSliderDimension(w, h));
    slider.setName(name);
    return slider;
}

From source file:pt.lsts.neptus.console.plugins.ImageLayers.java

private void rebuildControls() {
    scroll.removeAll();/*w ww  .  j  a va  2  s.com*/

    for (final ImageLayer il : layers) {
        scroll.add(new JLabel(il.getName()));
        final JSlider slider = new JSlider(0, 1000, (int) (il.getTransparency() * 1000));
        slider.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                il.setTransparency(slider.getValue() / 1000.0);
            }
        });
        slider.setMinimumSize(new Dimension(20, 20));
        scroll.add(slider);
    }
    scroll.doLayout();
    scroll.revalidate();
}