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
|
public void init(){
this.setOpaque(true);
this.setBackground(Color.WHITE);
/* configuration du panel principal */
setLayout(new BorderLayout());
/* configuration du panel contenant images et textes */
JPanel panelHaut = new JPanel();
panelHaut.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new Insets(0, 0, 0, 0);
panelHaut.setBackground(Color.WHITE);
/* Initialisation des images */
_bandeColoree = new JLabel(Constantes.IMAGE_BARRE_COLOREE);
Double widthEcranPrincipal = MainFrame.getSize().getWidth();
Dimension dimension = new Dimension((widthEcranPrincipal.intValue()-400),50);
_bandeColoree.setPreferredSize(dimension);
_logoAgri = new JLabel(Constantes.IMAGE_AGRI);
_logoMi = new JLabel(Constantes.IMAGE_LOGO_PETIT_FORMAT);
/* Initialisation des textes */
_titre = new JLabel(BundleManager.getInstance().getMessage(this.getClass(), "titre"));
_titre.setFont(Constantes.POLICE_TITRE_NEW_CAMPAGNE);
_titre.setForeground(Constantes.COULEUR_BGBOUTONS_VERT);
_sousTitre = new JLabel(BundleManager.getInstance().getMessage(this.getClass(), "sousTitre"));
_sousTitre.setFont(Constantes.POLICE_SOUS_TITRE_NEW_CAMPAGNE);
/* bandeColoree */
gbc.gridx=0; //Colonne de départ
gbc.gridy=0; //Ligne de départ
gbc.gridheight=1; //Nombre de Ligne
gbc.gridwidth=2; //Nombre de Colonne
gbc.anchor = GridBagConstraints.FIRST_LINE_START; //Emplacement en haut à gauche de la case
gbc.insets = new Insets(0, 0, 0, 0); //Marge
panelHaut.add(_bandeColoree,gbc);
/* logo */
gbc.gridx=0; //Colonne de départ
gbc.gridy=1; //Ligne de départ
gbc.gridheight=1; //Nombre de ligne
gbc.gridwidth=1; //Nombre de Colonne
gbc.anchor = GridBagConstraints.FIRST_LINE_START;
gbc.insets = new Insets(0, 0, 0, 0); //Marge
panelHaut.add(_logo,gbc);
/* logo agri */
gbc.gridx=2; //Colonne de départ
gbc.gridy=0; //Ligne de départ
gbc.gridheight=GridBagConstraints.REMAINDER; //Dernier de sa ligne
gbc.gridwidth=GridBagConstraints.REMAINDER; //Dernier de colonne
gbc.anchor = GridBagConstraints.LAST_LINE_END;
gbc.insets = new Insets(0, 0, 0, 0); //Marge
panelHaut.add(_logoAgri,gbc);
/* titre */
gbc.gridx=1; //Colonne de départ
gbc.gridy=2; //Ligne de départ
gbc.gridheight=1; //Dernier de sa ligne
gbc.gridwidth=1; //Dernier de colonne
gbc.anchor = GridBagConstraints.CENTER;
gbc.insets = new Insets(0, 0, 0, 0); //Marge
panelHaut.add(_titre,gbc);
/* soustitre */
gbc.gridx=1; //Colonne de départ
gbc.gridy=3; //Ligne de départ
gbc.gridheight=1; //Nombre de lignes
gbc.gridwidth=1; //Nombre de colonnes
gbc.anchor = GridBagConstraints.CENTER;
gbc.insets = new Insets(0, 0, 0, 0); //Marge
panelHaut.add(_sousTitre,gbc);
add(panelHaut,BorderLayout.NORTH);
} |
Partager