Make Java Swing Modal Dialog Behave Like Mac OSX Dialogs
I am writing a small app that requires a ProgressBar to appear centred under the frame's TitleBar as is often seen in Mac OSX apps. I have two problems: 1 . I have managed the positioning but I had to hard code the parent Frame's TitleBar height. Is there a 'soft' way to get the TitleBar's height? In the Dialog's constructor: Dimension dimensionParentFrame = parent.getSize(); Dimension dimensionDialog = getSize(); int x = parent.getX() + ((dimensionParentFrame.width - dimensionDialog.width)/2); setLocation(x, parent.getY() + 22); // TODO HARD CODE WARNING TITLE HEIGHT 2 . Even though the