d'abord, je vais vous montrer comment il est:Java Swing GridBagLayout - Problème avec plaçant deux éléments sur un panneau
Voici comment il devrait être (voir lien ci-dessous dans mon commentaire):
L'étiquette doit être en haut et TabPane doit remplir le reste de l'écran avec des marges dans toutes les directions.
C'est le code pour le poser avec GridBagLayout:
// Layout --begin--
this.mainPanel.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
// Layout:headLineLabel --begin--
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.ipadx = 0;
gbc.ipady = 0;
gbc.insets = new Insets(0, 10, 0, 0);
gbc.anchor = GridBagConstraints.FIRST_LINE_START;
this.mainPanel.add(this.headLineLabel, gbc);
// Layout:headLineLabel --end--
// Layout:FestplattenreinigerGraphicalUserInterfaceTabbedPane --begin--
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.fill = GridBagConstraints.BOTH;
gbc.ipadx = 0;
gbc.ipady = 0;
gbc.insets = new Insets(10, 10, 10, 10);
gbc.anchor = GridBagConstraints.CENTER;
this.mainPanel.add(new FestplattenreinigerGraphicalUserInterfaceTabbedPane(), gbc);
// Layout:FestplattenreinigerGraphicalUserInterfaceTabbedPane --end--
// Layout --end--
Ce que vous devez savoir:
- FestplattenreinigerGraphicalUserInterfaceTabbedPane JTabbedPane étend.
- J'ai essayé de spécifier toutes les contraintes (même avec leur valeur par défaut) à pratiquer.
- Si je rends hommage aux achors, la disposition reste telle qu'elle est.
Quel est le problème dans cette chose?
THX beaucoup! (désolé, je ne pouvais pas poster des images directement + 1 seul lien en raison de je suis nouveau -.-)
Comment ça devrait être: http://img832.imageshack.us/img832/6905/howitshouldbe.jpg – JavaHater