72 |
{ |
{ |
73 |
Component awtComponent; |
Component awtComponent; |
74 |
|
|
75 |
|
Insets insets; |
76 |
|
|
77 |
/* this isEnabled differs from Component.isEnabled, in that it |
/* this isEnabled differs from Component.isEnabled, in that it |
78 |
knows if a parent is disabled. In that case Component.isEnabled |
knows if a parent is disabled. In that case Component.isEnabled |
79 |
may return true, but our isEnabled will always return false */ |
may return true, but our isEnabled will always return false */ |
92 |
throw new RuntimeException (); |
throw new RuntimeException (); |
93 |
} |
} |
94 |
|
|
95 |
|
void initializeInsets () |
96 |
|
{ |
97 |
|
insets = new Insets (0, 0, 0, 0); |
98 |
|
} |
99 |
|
|
100 |
native void connectHooks (); |
native void connectHooks (); |
101 |
|
|
102 |
protected GtkComponentPeer (Component awtComponent) |
protected GtkComponentPeer (Component awtComponent) |
122 |
// c.setFont (cp.getFont ()); |
// c.setFont (cp.getFont ()); |
123 |
if (awtComponent.getFont() != null) |
if (awtComponent.getFont() != null) |
124 |
setFont(awtComponent.getFont()); |
setFont(awtComponent.getFont()); |
125 |
|
|
126 |
if (! (awtComponent instanceof Window)) |
initializeInsets (); |
127 |
{ |
|
128 |
setCursor (awtComponent.getCursor ()); |
setCursor (awtComponent.getCursor ()); |
129 |
Rectangle bounds = awtComponent.getBounds (); |
Rectangle bounds = awtComponent.getBounds (); |
130 |
setBounds (bounds.x, bounds.y, bounds.width, bounds.height); |
setBounds (bounds.x, bounds.y, bounds.width, bounds.height); |
131 |
} |
|
132 |
} catch (RuntimeException ex) { ; } |
} catch (RuntimeException ex) { ; } |
133 |
} |
} |
134 |
|
|
285 |
{ |
{ |
286 |
Component parent = awtComponent.getParent (); |
Component parent = awtComponent.getParent (); |
287 |
|
|
288 |
if (parent instanceof Frame) |
if (parent instanceof Window) |
289 |
{ |
{ |
290 |
Insets insets = ((Frame)parent).getInsets (); |
Insets insets = ((Window) parent).getInsets (); |
291 |
/* convert Java's coordinate space into GTK+'s coordinate space */ |
// Convert from Java coordinates to GTK coordinates. |
292 |
setNativeBounds (x-insets.left, y-insets.top, width, height); |
setNativeBounds (x - insets.left, y - insets.top, width, height); |
293 |
} |
} |
294 |
else |
else |
295 |
setNativeBounds (x, y, width, height); |
setNativeBounds (x, y, width, height); |