test mise en page
This commit is contained in:
@@ -0,0 +1,48 @@
|
|||||||
|
// package fr.iutfbleau.papillon;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class Rappel extends JPanel{
|
||||||
|
private final int ide = -1;
|
||||||
|
private final String titre = "loute";
|
||||||
|
private final String contenu = "que veux tu";
|
||||||
|
private final String theme = "";
|
||||||
|
private final int rang = -1;
|
||||||
|
|
||||||
|
private final JLabel lbtitre;
|
||||||
|
private final JLabel lbcontenu;
|
||||||
|
|
||||||
|
public Rappel(){
|
||||||
|
super(new BorderLayout(2,0));
|
||||||
|
|
||||||
|
lbtitre = new JLabel(titre);
|
||||||
|
lbcontenu = new JLabel(contenu);
|
||||||
|
|
||||||
|
this.setPreferredSize(new Dimension(70, 50));
|
||||||
|
this.setBackground(Color.CYAN);
|
||||||
|
this.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 2));
|
||||||
|
|
||||||
|
setLayout(new GridBagLayout());
|
||||||
|
GridBagConstraints c = new GridBagConstraints();
|
||||||
|
c.anchor = GridBagConstraints.NORTHWEST;
|
||||||
|
|
||||||
|
// --- Position du titre (en haut)
|
||||||
|
c.gridx = 0;
|
||||||
|
c.gridy = 0;
|
||||||
|
c.weighty = 0; // ne prend pas l'espace
|
||||||
|
c.fill = GridBagConstraints.NONE;
|
||||||
|
add(lbtitre, c);
|
||||||
|
|
||||||
|
|
||||||
|
// --- Position du contenu (en dessous)
|
||||||
|
c.gridx = 0;
|
||||||
|
c.gridy = 1;
|
||||||
|
c.weighty = 0;
|
||||||
|
c.fill = GridBagConstraints.NONE;
|
||||||
|
add(lbcontenu, c);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user