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 89 90 91 92 93 94 95 96 97
|
public Fenetre(){
//Théme de la fenetre (ici Windows XP)
String lnfName = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
try {
UIManager.setLookAndFeel(lnfName);
SwingUtilities.updateComponentTreeUI(this);
}
catch (ClassNotFoundException e) {e.printStackTrace();}
catch (InstantiationException e) {e.printStackTrace();}
catch (IllegalAccessException e) {e.printStackTrace();}
catch (UnsupportedLookAndFeelException e) {e.printStackTrace();}
//Attributs de la fenêtre
this.setTitle("Automatisation déploiement mise à jour");
this.setIconImage(Toolkit.getDefaultToolkit().getImage("ressources/picto16.gif")); //Modification de l'icone de l'application
this.setSize(500,580);
this.setVisible(true);
this.setResizable(true);
this.setLocationRelativeTo(null); //Postionnement au centre
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Fermeture lorsque l'on clique sur la croix
this.setContentPane(getJContentPane()); //déclaration du contentPane
//Attribut du content pane
jContentPane.setBackground(Color.decode("#A3CCED")); //Modification de l'écran de fond
//Log de la console
try {
System.setOut(new PrintStream(
new MultiOutputStream(System.out, new FileOutputStream("log.txt"))
, true));
} catch (FileNotFoundException e) {
System.out.println("Fichier log.txt inexistant");
}
//**************AJOUTS DES COMPOSANTS**********************************************
choixServeur = new GroupeChoixServeur();
version = new GroupeVersion();
selectionMaj = new GroupeSelectionFichierMaj();
majLocal = new GroupeMajLocal();
majSql = new GroupeMajSql();
validation = new GroupeBoutonValidation();
//*********************************************************************************
//*******MISE EN FORME*************************************************
this.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
gbc.insets = new Insets(0, 0, 3, 0);
//Ajout de la sélection du serveur
gbc.gridx = gbc.gridy = 0;
jContentPane.add(choixServeur.getJPanel(), gbc);
//Ajout de la mise à jour
gbc.gridx = 1;
gbc.gridy = 0;
gbc.gridwidth = GridBagConstraints.REMAINDER;
jContentPane.add(version.getJPanel(), gbc);
//Ajout de la mise à jour workspace
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = GridBagConstraints.REMAINDER;
jContentPane.add(selectionMaj.getJPanel(), gbc);
//Ajout de la mise à du local
gbc.gridx = 0;
gbc.gridy = 2;
gbc.gridwidth = GridBagConstraints.REMAINDER;
jContentPane.add(majLocal.getJPanel(), gbc);
//Ajout de la mise à jour SQL
gbc.gridx = 0;
gbc.gridy = 4;
gbc.gridwidth = GridBagConstraints.REMAINDER;
jContentPane.add(majSql.getJPanel(), gbc);
//Ajout du séparateur
//gbc.gridx = 4;
gbc.gridy = 5;
//gbc.anchor = GridBagConstraints.CENTER;
gbc.fill = GridBagConstraints.HORIZONTAL;
//gbc.insets = new Insets(3, 5, 0, 5);
gbc.gridwidth = GridBagConstraints.REMAINDER;
jContentPane.add(separator, gbc);
//Ajout des boutons valider et annuler
gbc.gridx = 0;
gbc.gridy = 6;
gbc.gridwidth = GridBagConstraints.REMAINDER;
jContentPane.add(validation.getJPanel(), gbc);
//********************************************************************* |
Partager