src/java.desktop/unix/classes/sun/awt/X11/XRootWindow.java
Print this page
*** 29,52 ****
* This class represents AWT application root window functionality.
* Object of this class is singleton, all window reference it to have
* common logical ancestor
*/
class XRootWindow extends XBaseWindow {
! private static XRootWindow xawtRootWindow = null;
! static XRootWindow getInstance() {
XToolkit.awtLock();
try {
- if (xawtRootWindow == null) {
xawtRootWindow = new XRootWindow();
xawtRootWindow.init(xawtRootWindow.getDelayedParams().delete(DELAYED));
- }
- return xawtRootWindow;
} finally {
XToolkit.awtUnlock();
}
}
private XRootWindow() {
super(new XCreateWindowParams(new Object[] { DELAYED, Boolean.TRUE,
EVENT_MASK, XConstants.StructureNotifyMask }));
}
--- 29,56 ----
* This class represents AWT application root window functionality.
* Object of this class is singleton, all window reference it to have
* common logical ancestor
*/
class XRootWindow extends XBaseWindow {
! private static class LazyHolder {
! private static final XRootWindow xawtRootWindow;
!
! static {
XToolkit.awtLock();
try {
xawtRootWindow = new XRootWindow();
xawtRootWindow.init(xawtRootWindow.getDelayedParams().delete(DELAYED));
} finally {
XToolkit.awtUnlock();
}
}
+ }
+ static XRootWindow getInstance() {
+ return LazyHolder.xawtRootWindow;
+ }
+
private XRootWindow() {
super(new XCreateWindowParams(new Object[] { DELAYED, Boolean.TRUE,
EVENT_MASK, XConstants.StructureNotifyMask }));
}