IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

AWT/Swing Java Discussion :

[mise en page] Comment obtenir cette interface ?


Sujet :

AWT/Swing Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Profil pro
    Inscrit en
    Juin 2005
    Messages
    260
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2005
    Messages : 260
    Par défaut [mise en page] Comment obtenir cette interface ?
    Bonjour,

    J'essaie depuis quelques jours, d'obtenir une interface ressemblant à celle ci

    Mais je n'arrive pas à dimensionner les composant de la bonne manière...

    J'utilise un gridbaglayout et plusieurs sous gridbaglayout (un pour la partie gauche, un pour la partie droite et un pour la partie du bas)

    Malheureusement je n'arrive pas à obtenir un résultat acceptable car je n'arrive pas a faire fonctionner les setSize, setPrefferedSize, et autres setMinimumSize etc...

    Par exemple mes deux instance de Class (appellons la plutot A) sont à la bonne taille (enfin à peu près) tant que je n'ajoute pas mes radiobutton, mais dès lors, mes deux instance de A prennent une taille quasi nulle en largeur...

    Donc je voudrais avoir vos conseils pour réussir à obtenir cette interface.

    Merci !

  2. #2
    Membre émérite
    Avatar de bbclone
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    537
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2006
    Messages : 537
    Par défaut
    essaye ca :-)


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    import java.awt.Color;
    import java.awt.Dimension;
     
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
     
    import java.awt.Insets;
     
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JPanel;
    import javax.swing.JRadioButton;
     
    public class AnotherGridBagLayoutPanel extends JPanel {
        private GridBagLayout gridBagLayout1 = new GridBagLayout();
        private JPanel topLeftPanel = new JPanel();
        private JPanel topRightPanel = new JPanel();
        private JPanel centerPanel = new JPanel();
        private GridBagLayout gridBagLayout2 = new GridBagLayout();
        private JPanel jPanel1 = new JPanel();
        private JRadioButton jRadioButton1 = new JRadioButton();
        private JRadioButton jRadioButton2 = new JRadioButton();
        private JPanel jPanel2 = new JPanel();
        private JRadioButton jRadioButton3 = new JRadioButton();
        private JRadioButton jRadioButton4 = new JRadioButton();
        private JButton jButton1 = new JButton();
        private JButton jButton2 = new JButton();
        private JButton jButton3 = new JButton();
        private JButton jButton4 = new JButton();
        private JPanel jPanel3 = new JPanel();
        private JButton jButton5 = new JButton();
        private JButton jButton6 = new JButton();
     
        public AnotherGridBagLayoutPanel() {
            try {
                jbInit();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
     
        private void jbInit() throws Exception {
            this.setSize(new Dimension(640, 480));
            this.setLayout(gridBagLayout1);
            topLeftPanel.setBorder(BorderFactory.createLineBorder(Color.black, 1));
            topRightPanel.setBorder(BorderFactory.createLineBorder(Color.black, 1));
            centerPanel.setBorder(BorderFactory.createLineBorder(Color.black, 1));
            centerPanel.setLayout(gridBagLayout2);
            jPanel1.setPreferredSize(new Dimension(10, 50));
            jPanel1.setMinimumSize(new Dimension(10, 50));
            jPanel1.setBorder(BorderFactory.createLineBorder(Color.black, 1));
            jRadioButton1.setText("jRadioButton1");
            jRadioButton2.setText("jRadioButton2");
            jPanel2.setMinimumSize(new Dimension(10, 50));
            jPanel2.setSize(new Dimension(520, 50));
            jPanel2.setBorder(BorderFactory.createLineBorder(Color.black, 1));
            jPanel2.setPreferredSize(new Dimension(12, 50));
            jRadioButton3.setText("jRadioButton3");
            jRadioButton4.setText("jRadioButton4");
            jButton1.setText("jButton1");
            jButton1.setPreferredSize(new Dimension(125, 22));
            jButton2.setText("jButton2");
            jButton2.setPreferredSize(new Dimension(125, 22));
            jButton3.setText("jButton3");
            jButton3.setPreferredSize(new Dimension(125, 22));
            jButton4.setText("jButton4");
            jButton4.setPreferredSize(new Dimension(125, 22));
            jPanel3.setBorder(BorderFactory.createLineBorder(Color.black, 1));
            jPanel3.setPreferredSize(new Dimension(12, 50));
            jPanel3.setMinimumSize(new Dimension(12, 50));
            jButton5.setText("jButton5");
            jButton6.setText("jButton6");
            this.add(topLeftPanel,
                     new GridBagConstraints(0, 0, 1, 1, 0.2, 0.5, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                                            new Insets(5, 5, 5, 5), 0, 0));
            this.add(topRightPanel,
                     new GridBagConstraints(1, 0, GridBagConstraints.REMAINDER,
                                            1, 0.8, 0.5, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                                            new Insets(5, 5, 5, 5), 0, 0));
            centerPanel.add(jPanel1,
                            new GridBagConstraints(0, 0, 3, 2, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                                                   new Insets(5, 5, 5, 5), 0, 0));
            centerPanel.add(jRadioButton1,
                            new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0,GridBagConstraints.CENTER, GridBagConstraints.NONE,
                                                   new Insets(5, 5, 0, 10), 0, 0));
            centerPanel.add(jRadioButton2,
                            new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0,GridBagConstraints.CENTER, GridBagConstraints.NONE,
                                                   new Insets(5, 5, 0, 10), 0, 0));
            centerPanel.add(jPanel2,
                            new GridBagConstraints(0, 2, 3, 2, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                                                   new Insets(5, 5, 5, 5), 0, 0));
            centerPanel.add(jRadioButton3,
                            new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0,GridBagConstraints.CENTER, GridBagConstraints.NONE,
                                                   new Insets(5, 5, 0, 10), 0, 0));
            centerPanel.add(jRadioButton4,
                            new GridBagConstraints(3, 3, 1, 1, 0.0, 0.0,GridBagConstraints.CENTER, GridBagConstraints.NONE,
                                                   new Insets(5, 5, 0, 10), 0, 0));
            centerPanel.add(jButton1,
                            new GridBagConstraints(0, 4, 1, 1, 0.25, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
                                                   new Insets(5, 5, 0, 0), 0, 0));
            centerPanel.add(jButton2,
                            new GridBagConstraints(3, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
                                                   new Insets(5, 5, 5, 5), 0, 0));
            centerPanel.add(jButton3,
                            new GridBagConstraints(2, 4, 1, 1, 0.25, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE,
                                                   new Insets(5, 5, 0, 0), 0, 0));
            centerPanel.add(jButton4,
                            new GridBagConstraints(1, 4, 1, 1, 0.25, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE,
                                                   new Insets(5, 5, 0, 0), 0, 0));
            centerPanel.add(jPanel3,
                            new GridBagConstraints(0, 5, 3, 2, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
                                                   new Insets(5, 5, 5, 5), 0, 0));
            centerPanel.add(jButton5,
                            new GridBagConstraints(3, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
                                                   new Insets(5, 5, 5, 5), 0, 0));
            centerPanel.add(jButton6,
                            new GridBagConstraints(3, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
                                                   new Insets(5, 5, 5, 5), 0, 0));
            this.add(centerPanel,
                     new GridBagConstraints(0, 1, GridBagConstraints.REMAINDER, 1,
                                            0.0, 0.5, GridBagConstraints.CENTER,
                                            GridBagConstraints.BOTH,
                                            new Insets(5, 5, 5, 5), 0, 0));
        }
    }
    fais tres tres rapidement et pas avec idea.


    ca donne ca
    http://www.developpez.net/forums/att...1&d=1153558899
    Images attachées Images attachées  

  3. #3
    Membre éclairé Avatar de nicotine002
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    577
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 577
    Par défaut
    Allez c'est décider je me met à JDev Bbclone

  4. #4
    Membre émérite
    Avatar de bbclone
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    537
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2006
    Messages : 537
    Par défaut
    c'est juste, c'est fait avec jdev :-)
    mais tu devrais faire comme moi, j'ai une liste d'ide installer sur ma machine. je peut me debrouiller avec tous mais celui que je prefere est de loin idea.

  5. #5
    Membre éclairé
    Profil pro
    Inscrit en
    Juin 2005
    Messages
    260
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2005
    Messages : 260
    Par défaut
    idea ?? Je connait pas. En tout cas merci beaucoup ca va beaucoup me servir

  6. #6
    Expert confirmé
    Avatar de sinok
    Profil pro
    Inscrit en
    Août 2004
    Messages
    8 765
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Août 2004
    Messages : 8 765
    Par défaut
    Par contre à moins que tu bosses sur un projet open source c'est 500$ la license, avec un grosse réduction si tu es étudiant...

Discussions similaires

  1. Réponses: 2
    Dernier message: 20/08/2009, 08h58
  2. Réponses: 3
    Dernier message: 10/11/2007, 18h09
  3. Comment obtenir l'interface de mon programme façon windows XP ?
    Par 21247692 dans le forum Composants VCL
    Réponses: 8
    Dernier message: 26/09/2007, 00h09
  4. [Mise en page] Comment formatter un XML
    Par pmartin8 dans le forum Format d'échange (XML, JSON...)
    Réponses: 2
    Dernier message: 21/09/2006, 18h37
  5. Comment obtenir cette fenetre me permettant de chercher quelque chose sur mon disque
    Par budylove dans le forum Balisage (X)HTML et validation W3C
    Réponses: 11
    Dernier message: 15/05/2006, 15h27

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo