Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.textcoder.main;
- import java.awt.FlowLayout;
- import javax.swing.JFrame;
- import javax.swing.JProgressBar;
- public class Progress extends JFrame {
- private static final long serialVersionUID = 7870466108503443368L;
- private JProgressBar bar;
- public Progress(String title) {
- try {
- setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
- setVisible(false);
- setResizable(false);
- setLayout(new FlowLayout());
- setAlwaysOnTop(true);
- setTitle(title);
- bar = new JProgressBar();
- bar.setStringPainted(true);
- bar.setMaximum(100);
- bar.setMinimum(0);
- bar.setValue(0);
- bar.setString("0%");
- getContentPane().add(bar);
- pack();
- setLocationRelativeTo(null);
- setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- public void setProgress(int p, String d) {
- bar.setValue(p);
- bar.setString(d + " " + p + "%");
- }
- public void setTitles(String t) {
- setTitle(t);
- }
- public void setMax(int m) {
- bar.setMaximum(m);
- }
- public void remove() {
- setVisible(false);
- dispose();
- }
- public int getMax() {
- return bar.getMaximum();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement