How do can I put a JFrame inside a JPanel?

Posted on 2012-08-13
Last Modified: 2012-08-17
How do can I put a JFrame inside a JPanel?

I want to have a button create a JFrame and put it inside the JPanel so that its contained only to that area. If the user maximizes the JFrame inside the JPanel, the JFrame will expland to the size of the JPanel.

How can I achieve this?
Question by:mmedi005
    LVL 35

    Expert Comment

    I'm pretty such that can't be done. The JFrame is a top-level component, in that it is contained by anything.

    If you can explain in a little more detail what you are trying to accomplish (in terms of the end result to the user, not in terms of panels/frames, etc), we might be able to assist you further.
    LVL 86

    Accepted Solution


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Using object mapper in spring web application 8 39
    fix34  challenge 9 70
    countAbc challenge 9 35
    stringclean challenge 26 43
    Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
    Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
    Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
    This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now