Created
November 8, 2018 17:14
-
-
Save axone80/652ab2c9b998f9fe2454ce1f03deabf0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Fentrage; | |
import java.awt.Color; | |
import java.util.logging.Level; | |
import java.util.logging.Logger; | |
import javax.swing.JFrame; | |
/** | |
* | |
* @author usager | |
*/ | |
public class Fenetrage_intro extends javax.swing.JFrame implements Runnable { | |
// variable | |
private int progression = 0; | |
private int maximum = 100; | |
/** | |
* Nouvelle fenetre | |
*/ | |
public Fenetrage_intro() { | |
initComponents(); | |
// setLocationRelativeTo(null); | |
this.setExtendedState(JFrame.MAXIMIZED_BOTH); | |
this.getContentPane().setBackground( Color.white ); | |
// définition du minimum et du maxium de la barre de progression | |
pbar.setMinimum(0); | |
pbar.setMaximum(maximum); | |
Thread t = new Thread(this, "Téléchargement"); | |
t.start(); | |
} | |
@SuppressWarnings("unchecked") | |
// <editor-fold defaultstate="collapsed" desc="Generated Code"> | |
private void initComponents() { | |
jPanel1 = new javax.swing.JPanel(); | |
pbar = new javax.swing.JProgressBar(); | |
jLabel2 = new javax.swing.JLabel(); | |
jLabel1 = new javax.swing.JLabel(); | |
jLabel3 = new javax.swing.JLabel(); | |
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); | |
setBackground(new java.awt.Color(0, 0, 0)); | |
setForeground(new java.awt.Color(0, 0, 0)); | |
setUndecorated(true); | |
jPanel1.setBackground(new java.awt.Color(255, 255, 255)); | |
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Fentrage/LOGO_FINAL.png"))); // NOI18N | |
jLabel2.setText("jLabel2"); | |
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bonhomme_pendu/Medias/xbox-2-logo-thumb.jpg"))); // NOI18N | |
jLabel1.setText("jLabel1"); | |
jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bonhomme_pendu/Medias/logo dc.jpg"))); // NOI18N | |
jLabel3.setText("jLabel3"); | |
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); | |
jPanel1.setLayout(jPanel1Layout); | |
jPanel1Layout.setHorizontalGroup( | |
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel1Layout.createSequentialGroup() | |
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel1Layout.createSequentialGroup() | |
.addGap(243, 243, 243) | |
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 446, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
.addGroup(jPanel1Layout.createSequentialGroup() | |
.addGap(102, 102, 102) | |
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addGap(29, 29, 29) | |
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 454, javax.swing.GroupLayout.PREFERRED_SIZE))) | |
.addContainerGap(317, Short.MAX_VALUE)) | |
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() | |
.addGap(0, 0, Short.MAX_VALUE) | |
.addComponent(pbar, javax.swing.GroupLayout.PREFERRED_SIZE, 278, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addGap(326, 326, 326)) | |
); | |
jPanel1Layout.setVerticalGroup( | |
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() | |
.addContainerGap() | |
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 451, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addGap(29, 29, 29) | |
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addComponent(jLabel3)) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 66, Short.MAX_VALUE) | |
.addComponent(pbar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addGap(29, 29, 29)) | |
); | |
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | |
getContentPane().setLayout(layout); | |
layout.setHorizontalGroup( | |
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(layout.createSequentialGroup() | |
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addGap(0, 0, Short.MAX_VALUE)) | |
); | |
layout.setVerticalGroup( | |
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(layout.createSequentialGroup() | |
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addGap(0, 0, Short.MAX_VALUE)) | |
); | |
pack(); | |
}// </editor-fold> | |
/** | |
* @param args the command line arguments | |
*/ | |
// public static void main(String args[]) { | |
// /* Set the Nimbus look and feel */ | |
// //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> | |
// /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. | |
// * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html | |
// */ | |
// try { | |
// for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { | |
// if ("Nimbus".equals(info.getName())) { | |
// javax.swing.UIManager.setLookAndFeel(info.getClassName()); | |
// break; | |
// } | |
// } | |
// } catch (ClassNotFoundException ex) { | |
// java.util.logging.Logger.getLogger(Fenetrage_intro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
// } catch (InstantiationException ex) { | |
// java.util.logging.Logger.getLogger(Fenetrage_intro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
// } catch (IllegalAccessException ex) { | |
// java.util.logging.Logger.getLogger(Fenetrage_intro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
// } catch (javax.swing.UnsupportedLookAndFeelException ex) { | |
// java.util.logging.Logger.getLogger(Fenetrage_intro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
// } | |
// //</editor-fold> | |
// | |
// /* Create and display the form */ | |
// java.awt.EventQueue.invokeLater(new Runnable() { | |
// public void run() { | |
// new Fenetrage_intro().setVisible(true); | |
// } | |
// }); | |
// } | |
// Variables declaration - do not modify | |
private javax.swing.JLabel jLabel1; | |
private javax.swing.JLabel jLabel2; | |
private javax.swing.JLabel jLabel3; | |
private javax.swing.JPanel jPanel1; | |
private javax.swing.JProgressBar pbar; | |
// End of variables declaration | |
// méthode de finission du téléchargement | |
public void fermeture_fenetre() { | |
// ouverture de la nouvelle fenetre | |
new Fenetrage_intro().setVisible(true); | |
//new | |
} | |
@Override | |
public void run() { | |
while (true) { | |
// progression de la barre de téléchargement | |
progression++; | |
pbar.setValue(progression); | |
// lors de l'atteinte du maximum | |
if (progression > maximum) { | |
dispose(); | |
break; | |
} | |
try { | |
Thread.sleep(100); | |
} catch (InterruptedException ex) { | |
Logger.getLogger(Fenetrage_intro.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment