• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JInternal Frame Border

 
Derek Boring
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Maneesh Godbole
Saloon Keeper
Posts: 11066
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Darryl Burke
Bartender
Posts: 5132
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Derek Boring
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic