< prev index next >

src/java.desktop/share/classes/java/awt/Taskbar.java

Print this page

        

*** 194,203 **** --- 194,205 ---- if (defaultToolkit instanceof SunToolkit) { peer = ((SunToolkit) defaultToolkit).createTaskbarPeer(this); } } + private static Taskbar taskbar; + /** * Returns the {@code Taskbar} instance of the current * taskbar context. On some platforms the Taskbar API may not be * supported; use the {@link #isTaskbarSupported} method to * determine if the current taskbar is supported.
*** 215,230 **** if (!Taskbar.isTaskbarSupported()) { throw new UnsupportedOperationException("Taskbar API is not " + "supported on the current platform"); } sun.awt.AppContext context = sun.awt.AppContext.getAppContext(); ! Taskbar taskbar = (Taskbar)context.get(Taskbar.class); if (taskbar == null) { taskbar = new Taskbar(); context.put(Taskbar.class, taskbar); } return taskbar; } --- 217,240 ---- if (!Taskbar.isTaskbarSupported()) { throw new UnsupportedOperationException("Taskbar API is not " + "supported on the current platform"); } + Taskbar taskbar = null; sun.awt.AppContext context = sun.awt.AppContext.getAppContext(); ! ! taskbar = (context == null) ! ? Taskbar.taskbar ! : (Taskbar)context.get(Taskbar.class); if (taskbar == null) { taskbar = new Taskbar(); + if (context != null) { context.put(Taskbar.class, taskbar); + } else { + Taskbar.taskbar = taskbar; + } } return taskbar; }
< prev index next >