Domanda

I am creating a Java application. I have 2 Forms, one is JFRAME FORM, which contains left and right JPanel; and JPANEL FORM which contains the contents..

I am having trouble of putting the JPanel Form and its contents to the right JPanel of the JFRame form using card layout.

È stato utile?

Soluzione

If you've already added the necessary space, for the right JPanel of the frame form, it's just a matter of hand coding the addition of your JPanel form. something like this

public FrameForm extends JFrame {
    private PanelForm pForm = new PanelForm();

    public FrameForm() {
        initComponents();
        CardLayout card = new CardLayout();
        rightPanel.setLayout(card);

        rightPanel.add(pForm, "pForm");
    }
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top