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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
package T2Viewer;
import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
public class DownloadDlg extends JDialog
{
/**
*
*/
private static final long serialVersionUID = 1L;
/** width of dialog */
int width = 0;
/** main application object */
static Viewer parent;
/** */
JProgressBar progress = null;
public DownloadDlg( DicomDirDialog dialog, boolean bModal )
{
super( dialog, bModal );
parent = Viewer.getViewer();
this.setLayout( new BorderLayout());
this.setDefaultCloseOperation( HIDE_ON_CLOSE );
this.setResizable( false );
this.setLocation( parent.getWidth() / 4, parent.getHeight() / 6 );
this.setSize( 200, 100 );// frame.getWidth() / 2,
// frame.getHeight() / 3
// * 2 );
// width = dialog.getWidth() / 2;
JPanel panel = new JPanel();
panel.setLayout( null );
JLabel text = new JLabel( "Chargement en cours ..." );
text.setBounds( 20, 5, 180, 20 );
panel.add( text );
progress = new JProgressBar( 0, 100 );
progress.setBounds( 20, 50, 150, 20 );
progress.setString( "0 %" );
progress.setStringPainted(true);
progress.setValue( 0 );
panel.add( progress );
this.getContentPane().add( panel, null );
this.addWindowListener( new WindowAdapter()
{
public void windowClosing( WindowEvent e )
{
}
public void windowDeiconified( WindowEvent e )
{
}
public void windowIconified( WindowEvent e )
{
}
} );
}
public void setProgressBar( int value )
{
progress.setString( value + " %" );
progress.setStringPainted(true);
progress.setValue( value );
}
} |
Partager