سؤال

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