PDA

View Full Version : Java GUI Help




Awesomeness
Mar 22, 2009, 02:54 PM
Ok, I have a GUI in AWT and Swing, and I set the size of my JFrame, but... It includes the title bar. How do I set the size of the CONTENT of my JFrame?

Thanks beforehand,
--Awesomeness

And yes, I have figured out the size of the mac title bar. However, I want my app to be cross platform, and that means that it differs between OSes.



iShater
Mar 22, 2009, 03:04 PM
What exactly are you putting in the frame? what layout manager are you using?

Awesomeness
Mar 22, 2009, 03:26 PM
What exactly are you putting in the frame? what layout manager are you using?
None. I am using paint() to make graphics in a window. I have a pane inside it, but even when I set its size frame.pack() doesn't do what I want it to do.

iShater
Mar 22, 2009, 03:29 PM
I'm having a hard time understanding what you are trying to do, and what you are seeing instead. Care to give more details?

Awesomeness
Mar 22, 2009, 05:28 PM
I'm having a hard time understanding what you are trying to do, and what you are seeing instead. Care to give more details?

Okay, I'm generating a box in a window using paint() and it's not coming out where I want it to be because the window, including the title bar, is in my case is 400 pixels tall, but the content of the window is only 377 pixels tall because the title bar takes up 23 of those pixels. I could make it 423 pixels tall instead, but that wouldn't work on PCs because their title bar is much taller. I need to make the content 400 pixels tall.

Awesomeness
Mar 22, 2009, 05:34 PM
Okay, I'm generating a box in a window using paint() and it's not coming out where I want it to be because the window, including the title bar, is in my case is 400 pixels tall, but the content of the window is only 377 pixels tall because the title bar takes up 23 of those pixels. I could make it 423 pixels tall instead, but that wouldn't work on PCs because their title bar is much taller. I need to make the content 400 pixels tall.

Nevermind. I found the solution here:
http://www.acm.org/crossroads/xrds13-3/minueto.html

iShater
Mar 22, 2009, 08:09 PM
Aaaaah... now I get it, and thanks for posting the link for future programmers. :D