Question

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.

Was it helpful?

Solution

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");
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top