This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JInternal Frame Border Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JInternal Frame Border" Watch "JInternal Frame Border" New topic
Author

JInternal Frame Border

Derek Boring
Ranch Hand

Joined: Aug 15, 2006
Posts: 63
Hi y'all!

I have a JInternalFrame inwhich I have overwritten the paint method. However, I have found that (0,0) is on top of the "title bar" for the JInternal frame. I know I could just play with numbers until I find the right vertical offset, but I want to do it the professional way. I already figured out how to get the width of the border, but now my question is:

How do I find out the height of the title bar?


Life is 10% what happens and 90% how you react to it.
Attitude is everything.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10167
    
    8

Originally posted by Derek Boring:
I know I could just play with numbers until I find the right vertical offset, but I want to do it the professional way.


Professional way:
1) Run a loop so that you dont have to do it manually.
2) Find the screen co-ordinates of the content pane and compare them with the co-ordinates of the frame.
3) Try 22. If it doesnt work try 27. Still doesnt work, refer 1 and 2 above.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Originally posted by Maneesh Godbole:

2) Find the screen co-ordinates of the content pane and compare them with the co-ordinates of the frame.

Just thinking... if that gives the corect result, the difference of getHeight() should also do it.


luck, db
There are no new questions, but there may be new answers.
Derek Boring
Ranch Hand

Joined: Aug 15, 2006
Posts: 63
That makes perfect sense. But I'm still curious, I know that the title bar for a JInternalFrame isn't an official OS title bar, but since it's drawn by Java, wouldn't it make sense that the UI manager or some other module would know the dimensions of it?

I'll use your suggestion for now, but this makes me wonder how the JInternalFrame knows where to position the content pane vertically.

Thanks for your help guys.
 
Consider Paul's rocket mass heater.
 
subject: JInternal Frame Border
 
Similar Threads
moving an undecorated frame
JFrame Title Block
how to customize the title bar of a JInternalFrame
tabbing in JTable
tabbing in JTable