FileDocCategorySizeDatePackage
SliderPanel.javaAPI DocExample787Fri Dec 07 10:10:42 GMT 2001None

SliderPanel

public class SliderPanel extends JPanel

Fields Summary
private JTextField
log
private JSlider
slider
Constructors Summary
public SliderPanel(JTextField tf)

		this.log = tf;
		setLayout(new BorderLayout());
		slider=new JSlider(JSlider.HORIZONTAL,-50,50,35);
		// draw both major and minor tick marks
		slider.setMajorTickSpacing(20);
		slider.setMinorTickSpacing(5);
		slider.setPaintTicks(true);
		slider.setPaintLabels(true);
		add(slider,BorderLayout.NORTH);
		slider.addChangeListener(new ChangeListener(){
			public void stateChanged(ChangeEvent e)
			{
				log.setText("Value = " +slider.getValue());
			}
		});
		
	
Methods Summary