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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
| class DialogueTravail extends JInternalFrame
{
static int compte=0;
JButton OK,ANNULER;
Container L1;
DialogueTravail(String nomFenetre){
super(nomFenetre,false,true,false,false);
addInternalFrameListener(new InternalFrameAdapter(){
public void internalFrameClosing(InternalFrameEvent e)
{
dispose();
}
});
Font police= new Font("Dialog",Font.BOLD,12);
getContentPane().setLayout(new GridBagLayout());
GridBagConstraints c= new GridBagConstraints();
JFrame fenetreTravail= new JFrame();
Container L1= fenetreTravail.getContentPane();
c.gridwidth= GridBagConstraints.REMAINDER;
getContentPane().add(L1,c);
L1.setLayout(new BorderLayout(30,30));
JTabbedPane mesOnglets;
JPanel panneau;
// pour le premier onglet:
JLabel quelNom,quelleDate,quelAuteur,ecrirePlus;
JTextField inNom,inDate,inAuteur;
JTextArea inPlus,listeFichiers;
JButton ajouterFichier,retirerFichier;
quelNom= new JLabel("Nom:");
quelleDate= new JLabel("Date:");
quelAuteur= new JLabel("Auteur(s):");
ecrirePlus= new JLabel("Description du projet:");
inNom= new JTextField(12);
inDate= new JTextField(8);
inAuteur= new JTextField(15);
inPlus= new JTextArea(3,22);
listeFichiers= new JTextArea(4,15);
//
OK= new JButton("Ok");
OK.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
dispose();
}
});
ANNULER= new JButton("Annuler");
ANNULER.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
dispose();
}
});
ajouterFichier= new JButton("Ajouter un gerber");
ajouterFichier.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
}
});
retirerFichier= new JButton("Retirer un gerber");
retirerFichier.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
}
});
mesOnglets= new JTabbedPane(SwingConstants.TOP);
L1.add(mesOnglets);
mesOnglets.addTab("Informations",panneau= new JPanel());
panneau.add(quelNom,c);
panneau.add(inNom,c);
panneau.add(quelleDate,c);
c.gridwidth= GridBagConstraints.REMAINDER;
panneau.add(inDate,c);
panneau.add(quelAuteur,c);
c.gridwidth= GridBagConstraints.REMAINDER;
panneau.add(inAuteur,c);
panneau.add(ecrirePlus,c);
c.gridwidth= GridBagConstraints.REMAINDER;
panneau.add(inPlus,c);
panneau.add(ajouterFichier);
c.gridwidth= GridBagConstraints.REMAINDER;
panneau.add(retirerFichier);
c.gridwidth= GridBagConstraints.REMAINDER;
panneau.add(listeFichiers);
mesOnglets.addTab("Face superieure (Top layer)",panneau= new JPanel());
mesOnglets.addTab("Face inferieure (Bottom layer)",panneau= new JPanel());
mesOnglets.addTab("Positionnement",panneau= new JPanel());
mesOnglets.setSelectedIndex(0); //selectionne le premier onglet par defaut
listeFichiers.setEditable(false);
OK.setFont(police);
c.gridwidth=1;
getContentPane().add(OK,c);
ANNULER.setFont(police);
c.gridheight= GridBagConstraints.REMAINDER;
getContentPane().add(ANNULER,c);
setup();
setResizable(false);
setVisible(true);
}
void setup(){
int xB= Math.max(OK.getPreferredSize().width,ANNULER.getPreferredSize().width);
int yB= OK.getPreferredSize().height;
OK.setPreferredSize(new Dimension(xB,yB));
OK.setMaximumSize(new Dimension(xB,yB));
OK.setMinimumSize(new Dimension(xB,yB));
ANNULER.setPreferredSize(new Dimension(xB,yB));
ANNULER.setMaximumSize(new Dimension(xB,yB));
ANNULER.setMinimumSize(new Dimension(xB,yB));
int largeur= 620, hauteur= 460;
setSize(largeur,hauteur);
Dimension tailleEcran= Toolkit.getDefaultToolkit().getScreenSize();
int largeurEcran= tailleEcran.width;
int hauteurEcran= tailleEcran.height;
int xPos= (largeurEcran - largeur)/2;
int yPos= (hauteurEcran - hauteur)/2;
setLocation(xPos,yPos);
}
} |
Partager