Component::getParentMonitorArea adds OSX menu bar height

Hi,

if I call Component::getParentMonitorArea the y = 22. I think the OS X menu bar is added to the y value. Same with witdh. Width subtracts the width of the OS X dock. It is similar to Desktop::getInstance().getAllMonitorDisplayAreas(true); . If I call Desktop::getInstance().getAllMonitorDisplayAreas(false) then the width is correct. Is there any possibility to get the “real” area?

Note: Java VM JComponent::getGraphicsConfiguration::getBounds gives the “correct” values.

Thanks for any help
Rüdiger

P.S: See details in attachment

If by “real area” you mean the value that getAllMonitorDisplayAreas(false) returns, then just use that!

Hi Jules,

yes, but I need the relative position of the Component.

Cheers,
Rüdiger

So use Desktop::getMonitorAreaContaining()…?

Hi Jules,

got it thanks!

Rectangle pBounds = this->getParentMonitorArea();
Rectangle bounds = Desktop::getInstance().getMonitorAreaContaining(pBounds.getX(), pBounds.getY(), false);

:slight_smile:

Greetings from Florian!
Rüdiger