Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Adding JPanel using Jbutton, Expanding JFrame as needed.

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Thanked 0 Times in 0 Posts

    Default Adding JPanel using Jbutton, Expanding JFrame as needed.

    If anyone could show me a sample/ example or link to reading that could help, please assist.

    On my first try, I created my panel as a class extending JPanel.
    I created an instance and added it to the frame simply enough.

    I get trouble when trying to perform the same function via a JButton.

    I'll post an example of what I have soon. I scrapped my first run as it became a mess and debugging was wasting more time than a rewrite.

  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    My Mood
    Thanked 140 Times in 135 Posts

    Default Re: Adding JPanel using Jbutton, Expanding JFrame as needed.

    There are lots of examples of just this on this forum and other similar sites. If you get stuck, please post your code attempt with [code] [/code] tags and tell us any details about the problems you may be having with your code.

Similar Threads

  1. Replies: 5
    Last Post: February 15th, 2013, 05:01 PM
  2. Adding JPanel to JFrame
    By megusta in forum AWT / Java Swing
    Replies: 6
    Last Post: February 3rd, 2013, 10:37 AM
  3. [SOLVED] What is not right here? adding JPanel in JFrame
    By Asido in forum AWT / Java Swing
    Replies: 2
    Last Post: August 23rd, 2010, 08:16 AM
  4. JButton on JPanel
    By JavaLearner in forum AWT / Java Swing
    Replies: 4
    Last Post: March 26th, 2010, 07:46 AM
  5. Imitating a JFrame extended program with JPanel; help needed...
    By emigrant in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 15th, 2010, 02:30 PM