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.

有帮助吗?

解决方案

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");
    }
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top