by Dinesh Thakur

A slider allows the user to enter a point moving data back and forth, which is intuitive in some situations (volume control, for example). a progress bar displays data in a relative form of "full" to "empty" so the user gets a perspective.

The key to hooking the two components together is to share your model in the line:
ProgressBar.setModel(Slider.getModel());
The JProgressBar is fairly straightforward, but the JSlider has a lot of options, such as orientation and major and minor brands.
Here is the example of Sliders and Progress bars

/* <applet code= Progress.class width=320 height=200> </applet> */ import javax.swing.*;

import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import javax.swing.border.*;
public class Progress extends JApplet
{
           JProgressBar ProgressBar = new JProgressBar();
           JSlider Slider = new JSlider(JSlider.HORIZONTAL, 0, 100, 60);
           public void init()
          {
                Frame frm = (Frame)this.getParent().getParent();
                frm.setTitle("Sliders and Progress bars");
                Container container = getContentPane();
                container.setLayout(new GridLayout(2,1));
                container.add(ProgressBar);
                Slider.setValue(0);
                Slider.setPaintTicks(true);
                Slider.setMajorTickSpacing(20);
                Slider.setMinorTickSpacing(5);
                Slider.setBorder(new TitledBorder("Slide Bar (JSlider)"));
                ProgressBar.setModel(Slider.getModel());
                container.add(Slider);
          }
}

Sliders and Progress bars