Progress bar component JProgressBar

       Foreword:

       When installing a software, a progress bar is often encountered. The progress bar is usually used to display the completion percentage of an operation. The user can know the degree of the current operation by observing the progress bar. The time component is used to perform programmer-specified actions sequentially over a period of time. The slider can display major and minor tick marks. The number of values ​​in the middle of the tick marks is controlled by setMajorTickSpacing and setMinorTickSpacing. The divider is the dividing line that you usually see in the menu to divide different types of menu items. The time component is primarily a component that controls the frequency of events.

public class test21 {
    
    static final int WIDTH=300;
    static final int HEIGHT=200;
    
    public  static  void main(String[] args) {
         // TODO Auto-generated method stub 
        JFrame jf= new JFrame("Add content panel test program" );
        jf.setSize(WIDTH,HEIGHT);
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        jf.setVisible(true);
        JPanel contentPane=new JPanel();
        jf.setContentPane(contentPane);
        JProgressBar pb = new JProgressBar(); // Create a progress bar 
        contentPane.add(pb);
    }
}

The running result is shown in the figure above. The above is to use the simplest constructor JProgressBar() to create a progress bar.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325040566&siteId=291194637