java Composite Comment taille fixe

Je veux avoir un redimensionnable panneau, qui a toujours le haut panneau vert d'une profondeur fixe. c'est à dire toutes les variations de la hauteur le panneau jaune seulement.

Mon code ci-dessous est presque OK, sauf le vert du panneau varie en taille un peu.

Comment puis-je faire cela?

            Panel.setLayout(new BoxLayout(Panel, BoxLayout.Y_AXIS));
        Panel.setAlignmentX(Component.LEFT_ALIGNMENT);

        JPanel TopPanel = new JPanel();
        TopPanel.setPreferredSize(new Dimension(80,150));
        TopPanel.setVisible(true);
        TopPanel.setBackground(Color.GREEN);
        JPanel MainPanel = new JPanel();
        MainPanel.setPreferredSize(new Dimension(80,750));
        MainPanel.setVisible(true);
        MainPanel.setOpaque(true);
        MainPanel.setBackground(Color.YELLOW);

        Panel.add(TopPanel);
        Panel.add(MainPanel);

java Composite Comment taille fixe

OriginalL'auteur ManInMoon | 2013-11-12