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.


>> REGISTER NOW TO START POSTING


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

Results 1 to 3 of 3

Thread: BorderLayout and getHeight/getWidth

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    28
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default BorderLayout and getHeight/getWidth

    I am running a code that uses border layout to manage 2 frames. One frame is a window in which I am displaying some graphics, located in the CENTER region. I have another frame in the SOUTH location which has keyboard listeners for various commands.

    When I try to run the getHeight and getWidth commands in the SOUTH frame, it only gives me the values of the south frame. I would like to be able to call up the locations of the CENTER frame, but am not quite sure how to do it.


  2. #2
    Member snowguy13's Avatar
    Join Date
    Nov 2011
    Location
    In Hyrule enjoying a chat with Demise and Ganondorf
    Posts
    339
    My Mood
    Happy
    Thanks
    31
    Thanked 48 Times in 42 Posts

    Default Re: BorderLayout and getHeight/getWidth

    Are you using two separate frames for one window? In that case, you should use two JPanels and one JFrame instead--that way you have one top level container managing all of the components.

    Otherwise, could you post code here and be a little more specific?
    Use highlight tags to help others help you!

    [highlight=Java]Your prettily formatted code goes here[/highlight]

    Using these tags makes your code formatted, and helps everyone answer your questions more easily!




    Wanna hear something funny?

    Me too.

  3. #3
    Junior Member
    Join Date
    Apr 2012
    Posts
    28
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: BorderLayout and getHeight/getWidth

    Thanks for the reply. What you said makes a lot of sense and I will definitely give it a try. I am pretty new to GUI and the layout stuff, and didn't even think of that.

Similar Threads

  1. [SOLVED] JPanel inside CENTER of BorderLayout is given GRID LAYOUT
    By JonLane in forum AWT / Java Swing
    Replies: 9
    Last Post: February 25th, 2012, 12:20 PM
  2. Replies: 6
    Last Post: February 21st, 2012, 09:41 PM
  3. [SOLVED] Pesky <JPanel>.getWidth() and <JPanel>.getHeight() Methods...
    By snowguy13 in forum AWT / Java Swing
    Replies: 1
    Last Post: December 31st, 2011, 03:35 PM
  4. Problem with getWidth() and getHeight()
    By dcwang3 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: November 2nd, 2011, 12:22 AM
  5. BackgroundPanel.java cannot be placed in BorderLayout.NORTH
    By chopficaro in forum AWT / Java Swing
    Replies: 7
    Last Post: August 31st, 2010, 06:27 PM