• Post Reply Bookmark Topic Watch Topic
  • New Topic

AWT: how to get the size of the titlebar in a Frame?  RSS feed

 
Gideon Goodwin
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I have encountered a problem that seems like it ought to have an easy fix, but I can't seem to find any info about it, anywhere.

My applet is restricted to using AWT with a target JVM version of 1.3.1. After a loading sequence, the applet creates a Frame and proceeds to add components to the frame according to a specific layout. No layout manager is being used. The problem is that if I try to add one of my custom components at (0, 0), it appears underneath the title bar of the Frame. This title bar varies in size depending on the browser that was used to launch the applet (and even depending on the theme which the browser is using). I need a way to get the (vertical) dimension of the titlebar so I can adjust my origin for custom drawing, but I can't seem to find any info whatsoever on how to do this in a platform-independent way. Any help? Thanks in advance.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the Frame api, the Container method getInsets is handy here. insets.top should contain the height of the title bar. Another option is to work with/on a Panel and add it to the Frame. Then there are no offset problems since everything is inside the Panel.
 
Gideon Goodwin
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's exactly what I needed...thank you. Not sure how I missed this in the first place!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!