Code example for JSlider

Methods: setEnabledsetPreferredSize

0
/** 
 * @author Christian Bauer 
 */ 
public class ProgressPanel extends JPanel {
 
    final private JSlider positionSlider = new JSlider(0, 100, 0);
    final private JLabel positionLabel = new JLabel();
    private PositionInfo positionInfo;
 
    public ProgressPanel() { 
        super(); 
 
        setBorder(BorderFactory.createTitledBorder("Position"));
        setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
 
        positionLabel.setText("00:00:00/00:00:00");
        positionLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
 
        positionSlider.setEnabled(false);
 
        positionSlider.setPreferredSize(new Dimension(200, 24));
        add(positionSlider);
        add(positionLabel);
 
    }