sliderV = new JSlider( SwingConstants.VERTICAL, 0, 1000, 400); sliderV.setMajorTickSpacing( 100 ); sliderV.setMinorTickSpacing( 50 ); sliderV.setPaintTicks ( true ); sliderV.setPaintLabels( true );
The layout managers have control over the size of components, but often do their job better if you indicate a preferred size. This is done with
setPreferredSize( new Dimension( int width, int height )
If this is not used, the graphical representation of a slider often has its labels and tick marks crowded together.