YVS1102
YVS1102

Reputation: 2748

How to make the second frame inside the Main?

I have this simple JFrame the classname is MainFrame here is the screenshot

enter image description here

I want to do some MDI thing.

for now, I only know this

private void mhsaddshowActionPerformed(java.awt.event.ActionEvent evt) {
    addMhs AM = new addMhs();
    AM.setVisible(true);  
    //desktopPane.add(AM);
}  

and with my script above now i have two separated window.

enter image description here

so how can i make the second window (addMhs();) as the child and MainFrame as the parent ?

I'm new with this, maybe you can share a tutorial link about my problem. Thanks in advance

Upvotes: 2

Views: 70

Answers (2)

Jatin Parmar
Jatin Parmar

Reputation: 2900

in order to make MDI app with java you have to use DesktopPane and add JInternalFrame inside your DesktopPane.

Upvotes: 2

gprathour
gprathour

Reputation: 15333

Frames will have a separate window.

You should use Panel instead.

You can show a panel inside JFrame. Read how to use panel.

Upvotes: 1

Related Questions