Sunday, 6 January 2013

Java Swing :- ProgressBar Class

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package chapter18;

import java.awt.Color;
import java.awt.Container;
import java.awt.FlowLayout;
import javax.swing.BorderFactory;
import javax.swing.JApplet;
import javax.swing.JProgressBar;

/**
 *
 * @author Amol
 */
public class Progress extends JApplet {
    JProgressBar jProgressBar1,jprogressbar2,jprogressbar3,jprogressbar4
            ,jprogressbar5,jprogressbar6;
    public void init(){
        Container contentPane = getContentPane();
        contentPane.setLayout(new FlowLayout());
        jProgressBar1=new JProgressBar();
        jProgressBar1.setValue(50);
        contentPane.add(jProgressBar1);
        jprogressbar2=new JProgressBar();
        jprogressbar2.setMinimum(100);
        jprogressbar2.setMaximum(200);
        jprogressbar2.setValue(180);
        jprogressbar2.setForeground(Color.red);
        contentPane.add(jprogressbar2);
        jprogressbar3=new JProgressBar();
        jprogressbar3.setOrientation(JProgressBar.HORIZONTAL);
        jprogressbar3.setStringPainted(true);
        jprogressbar3.setBorder(BorderFactory.createRaisedBevelBorder());
        jprogressbar3.setValue(50);
        jprogressbar3.setForeground(Color.blue);
        contentPane.add(jprogressbar3);

                jprogressbar4=new JProgressBar();
        jprogressbar4.setOrientation(JProgressBar.HORIZONTAL);
        jprogressbar3.setStringPainted(true);
        jprogressbar4.setBorderPainted(false);
        jprogressbar4.setValue(80);
        jprogressbar4.setForeground(Color.yellow);
        contentPane.add(jprogressbar4);

    }

}

No comments:

Post a Comment