bonjour,
je tente actuellement de m'initier a la creation d'interfaces graphiques et je dois dire que j'ai du mal a jongler avec les LAYOUT.
voici ce a quoi j'aimerais arriver :
1 fenetre type JFrame ou JDialog avec dedans 1 JLabel, 1 Choice, 1 JButton et tout ca positionner comme ci-dessous
____________________________________
|
|
|
| **JLabel** **Choice**
|
|
|
| **JButton**
|
|
|___________________________________
mais, voila ce que j'arrive a faire :
___________________________________
| **JLabel** **Choice**
|
|
|
|
| **JButton**
|
|
|
|
|__________________________________
COMMENT VOUS Y PRENDRIEZ-VOUS POUR POSITIONNER CONVENABLEMENT MES COPOSANTS DANS MON CONTENEUR ???
voici mon code :
import java.awt.*;
import javax.swing.*;
public class FenAccueil extends JDialog {
public FenAccueil() {
java.awt.Dimension tailleecran = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((tailleecran.width - 400) / 2, (tailleecran.height - 250) / 2, 400, 250);
setResizable(false);
setTitle("Analyse sur les oscillateurs");
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setLayout(new GridLayout(2, 0));
JPanel pane1 = new JPanel(new FlowLayout());
JPanel pane2 = new JPanel(new FlowLayout());
JLabel label = new JLabel("Choisissez un indicateur :");
Choice combo = new Choice();
JButton bouton = new JButton("Lancer les calculs ...");
combo.addItem("Moyennes Mobiles");
combo.select(0);
pane1.add(label);
pane1.add(combo);
pane2.add(bouton);
getContentPane().add(pane1);
getContentPane().add(pane2);
setVisible(true);
}
}
merci a vous,
alonsyl