question: public ScaleSelector ( ) { slider = new JSlider ( 1 , 10 , 1 ) ; value = new JLabel ( "x1" ) ; size = new JLabel ( "   " ) ; preview = new ImagePanel ( ) ; value . setPreferredSize ( new Dimension ( 25 , 10 ) ) ; size . setHorizontalAlignment ( JLabel . CENTER ) ; slider . setMajorTickSpacing ( 1 ) ; slider . setSnapToTicks ( true ) ; slider . addChangeListener ( this ) ; setLayout ( new BorderLayout ( ) ) ; Box b1 = new Box ( BoxLayout . X_AXIS ) ; b1 . add ( Box . createHorizontalStrut ( 5 ) ) ; b1 . add ( Box . createHorizontalGlue ( ) ) ; b1 . add ( preview ) ; b1 . add ( Box . createHorizontalGlue ( ) ) ; b1 . add ( Box . createHorizontalStrut ( 5 ) ) ; add ( b1 , BorderLayout . CENTER ) ; Box b2 = new Box ( BoxLayout . X_AXIS ) ; b2 . add ( slider ) ; b2 . add ( Box . createHorizontalStrut ( 5 ) ) ; b2 . add ( value ) ; Box b3 = new Box ( BoxLayout . X_AXIS ) ; b3 . add ( Box . createHorizontalStrut ( 5 ) ) ; b3 . add ( Box . createHorizontalGlue ( ) ) ; b3 . add ( size ) ; b3 . add ( Box . createHorizontalGlue ( ) ) ; b3 . add ( Box . createHorizontalStrut ( 5 ) ) ; Box b4 = new Box ( BoxLayout . Y_AXIS ) ; b4 . add ( b2 ) ; b4 . add ( b3 ) ; add ( b4 , BorderLayout . SOUTH ) ; }
target:  Create a new ScaleSelector.