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
|
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.fill = GridBagConstraints.HORIZONTAL;
/* Initialisation des images */
_bandeColoree = new JLabel(Constantes.IMAGE_BARRE_COLOREE);
//Récupération de la largeur de la fenetre principale pour modifier la largeur de la bande colorée en conséquence
Double widthEcranPrincipal = MainFrame.getSize().getWidth();
Dimension dimension = new Dimension((widthEcranPrincipal.intValue()-500),50);
_bandeColoree.setPreferredSize(dimension);
_bandeColoree.setAlignmentY(Component.LEFT_ALIGNMENT);
_logoAgri = new JLabel(Constantes.IMAGE_AGRI);
_logoAgri.setAlignmentY(Component.RIGHT_ALIGNMENT);
/* bandeColoree */
gbc.gridx=0; //Ligne de départ
gbc.gridy=0; //Colonne de départ
gbc.gridheight=2; //Nombre de Colonne
gbc.gridwidth=1; //Nombre de ligne
panelHaut.add(_bandeColoree,gbc);
/* logo agri */
gbc.gridx=0; //Ligne de départ
gbc.gridy=2; //Colonne de départ
gbc.gridheight=1; //Nombre de colonne
gbc.gridwidth=4; //Nombre de ligne;
panelHaut.add(_logoAgri,gbc);
add(panelHaut,BorderLayout.NORTH);
} |
Partager