• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's exactly what I needed...thank you. Not sure how I missed this in the first place!
 
I want my playground back. Here, I'll give you this tiny ad for it:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic