summaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/nativewindow/classes/jogamp')
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
index e326b65bd..611c13a22 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
@@ -72,10 +72,28 @@ public class AWTMisc {
return (Container) c;
}
+ /**
+ * Return insets of the component w/o traversing up to parent,
+ * i.e. trying Window and JComponent.
+ * <p>
+ * Exception is JRootPane.
+ * Return it's parent's Window component's insets if available,
+ * otherwise return JRootPane's insets.<br>
+ * This is due to <i>experience</i> that <i>some</i> JRootPane's
+ * do not expose valid insets value.
+ * </p>
+ */
public static Insets getInsets(Component c) {
if( c instanceof Window ) {
return ((Window)c).getInsets();
}
+ if( c instanceof JRootPane ) {
+ final Window w = getWindow(c);
+ if( null != w ) {
+ return w.getInsets();
+ }
+ return ((JRootPane)c).getInsets();
+ }
if( c instanceof JComponent ) {
return ((JComponent)c).getInsets();
}