JSlider in Java Program
JSlider in Java Program
import javax.swing.*;
public class JSliders extends JFrame
{
public Static void main(String[] args)
{
new JSliders();
}
public JSliders()
{
super("using JSlider");
Container content=getContentPane();
JSlider slider1=new JSlider();
slider1.setBorder(BorderFactory.createTitledBorder("JSlider without tick mark"));
content.add(slider1,BorderLayout.NORTH);
System.out.println("Value",+slider1.getvalue());
JSlider slider2=new JSlider();
Slider2.getBorder(BorderFactory.createTitledBorder("JSLider with tick mark"));
Slider2.setMajorTickSpacing(20);
Slider2.setMinorTickSpacing(5);
Slider2.setPaintTicks(true);
content.add(Slider2,BorderLayout.CENTER);
JSlider Slider3=new JSlider();
Slider3.setBorder(BorderFactory.createTitledBorder("JSlider-TickMarks&Labels"));
Slider3.setMajorTickSpacing(20);
Slider3.setMinorTickSpacing(5);
Slider3.setPaintTicks(true);
Slider3.setPaintLabels(true);
content.add(Slider 3,BorderLayout.SOUTH);
pack();
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
0 coment�rios:
Post a Comment