WinBarThread.java 1.37 KB
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