Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.Color;
import java.awt.GridLayout;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JProgressBar;
import javax.swing.UIManager;

public class Main extends JFrame {

    public static void main(String args[]) {
        UIManager.put("ProgressBar.repaintInterval", 100);
        UIManager.put("ProgressBar.border", BorderFactory.createLineBorder(Color.blue, 2));
        JFrame f = new JFrame();
        f.setLayout(new GridLayout(0, 1, 5, 5));
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.add(createBar());
        f.add(createBar());
        f.add(createBar());
        f.pack();
        f.setLocationRelativeTo(null);
        f.setVisible(true);
    }

    private static JProgressBar createBar() {
        JProgressBar progressBar = new JProgressBar(0, 100);
        progressBar.setValue(50);
        return progressBar;
    }
}