WinBarThread.java
1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package osp.utils;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import osp.ui.OSPE_MainFrame;
public class WinBarThread extends JFrame
{
private static final long serialVersionUID = 1L;
WinBarThread ww;
Container c;
JPanel p1,p2,p3;
public JProgressBar pgB;
public boolean fi=true; // Flag if cancel : "Cancel"=false.
JButton btC; // Cancel Button
public WinBarThread(JProgressBar jBar, OSPE_MainFrame mf)
{
super();
pgB = jBar;
this.setLocationRelativeTo(mf);
build(this);
}
private void build(WinBarThread win)
{
ww=win;
ww.setTitle("Progress ??");
ww.setSize(200, 100);
c=getContentPane();
p1=new JPanel();
p3=new JPanel();
c.add(p3);
pgB.setSize(100, 20);
pgB.setMinimum(0);
pgB.setMaximum(179);
pgB.setValue(0);
p1.add(pgB);
p3.add(p1);
btC=new JButton("Cancel");
btC.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
fi=false;
ww.dispose();
}
});
p2=new JPanel();
p2.add(btC);
p3.add(p2);
this.revalidate();
} // End Build
} // End class WinBarThread