bugged
stringlengths 6
599k
| fixed
stringlengths 6
40.8M
| __index_level_0__
int64 0
3.24M
|
|---|---|---|
public boolean isDirectory() { checkRead(); return VMFile.isDirectory(path); }
|
public boolean isDirectory() { checkRead(); return VMFile.isDirectory(path); }
| 14,373
|
public String[] list() { return list(null); }
|
public String[] list(FilenameFilter filter) { return list(null); }
| 14,374
|
public String[] list() { return list(null); }
|
public String[] list() { checkRead(); if (!exists() || !isDirectory()) return null; String files[] = VMFile.list(path); if (files == null) return null; if (filter == null) return files; int count = 0; for (int i = 0; i < files.length; i++) { if (filter.accept(this, files[i])) ++count; else files[i] = null; } String[] retfiles = new String[count]; count = 0; for (int i = 0; i < files.length; i++) if (files[i] != null) retfiles[count++] = files[i]; return retfiles; }
| 14,375
|
public boolean mkdirs() { String parent = getParent(); if (parent == null) { return mkdir(); } File f = new File(parent); if (!f.exists()) { boolean rc = f.mkdirs(); if (rc == false) return false; } return mkdir(); }
|
public boolean mkdirs() { String parent = getParent(); if (parent == null) { return mkdir(); } File f = new File(parent); if (!f.exists()) { boolean rc = f.mkdirs(); if (rc == false) return false; } return mkdir(); }
| 14,376
|
private String normalizePath(String p) { // On Windows, convert any '/' to '\'. This appears to be the same logic // that Sun's Win32 Java performs. if (separatorChar == '\\') { p = p.replace ('/', '\\'); // We have to special case the "\c:" prefix. if (p.length() > 2 && p.charAt(0) == '\\' && ((p.charAt(1) >= 'a' && p.charAt(1) <= 'z') || (p.charAt(1) >= 'A' && p.charAt(1) <= 'Z')) && p.charAt(2) == ':') p = p.substring(1); } int dupIndex = p.indexOf(dupSeparator); int plen = p.length(); // Special case: permit Windows UNC path prefix. if (dupSeparator.equals("\\\\") && dupIndex == 0) dupIndex = p.indexOf(dupSeparator, 1); if (dupIndex == -1) { // Ignore trailing separator (though on Windows "a:\", for // example, is a valid and minimal path). if (plen > 1 && p.charAt (plen - 1) == separatorChar) { if (! (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':')) return p.substring (0, plen - 1); } else return p; } StringBuffer newpath = new StringBuffer(plen); int last = 0; while (dupIndex != -1) { newpath.append(p.substring(last, dupIndex)); // Ignore the duplicate path characters. while (p.charAt(dupIndex) == separatorChar) { dupIndex++; if (dupIndex == plen) return newpath.toString(); } newpath.append(separatorChar); last = dupIndex; dupIndex = p.indexOf(dupSeparator, last); } // Again, ignore possible trailing separator (except special cases // like "a:\" on Windows). int end; if (plen > 1 && p.charAt (plen - 1) == separatorChar) { if (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':') end = plen; else end = plen - 1; } else end = plen; newpath.append(p.substring(last, end)); return newpath.toString(); }
|
private String normalizePath(String p) { // On Windows, convert any '/' to '\'. This appears to be the same logic // that Sun's Win32 Java performs. if (separatorChar == '\\') { p = p.replace ('/', '\\'); // We have to special case the "\c:" prefix. if (p.length() > 2 && p.charAt(0) == '\\' && ((p.charAt(1) >= 'a' && p.charAt(1) <= 'z') || (p.charAt(1) >= 'A' && p.charAt(1) <= 'Z')) && p.charAt(2) == ':') p = p.substring(1); } int dupIndex = p.indexOf(dupSeparator); int plen = p.length(); // Special case: permit Windows UNC path prefix. if (dupSeparator.equals("\\\\") && dupIndex == 0) dupIndex = p.indexOf(dupSeparator, 1); if (dupIndex == -1) { // Ignore trailing separator (though on Windows "a:\", for // example, is a valid and minimal path). if (plen > 1 && p.charAt (plen - 1) == separatorChar) { if (! (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':')) return p.substring (0, plen - 1); } else return p; } StringBuffer newpath = new StringBuffer(plen); int last = 0; while (dupIndex != -1) { newpath.append(p.substring(last, dupIndex)); // Ignore the duplicate path characters. while (p.charAt(dupIndex) == separatorChar) { dupIndex++; if (dupIndex == plen) return newpath.toString(); } newpath.append(separatorChar); last = dupIndex; dupIndex = p.indexOf(dupSeparator, last); } // Again, ignore possible trailing separator (except special cases // like "a:\" on Windows). int end; if (plen > 1 && p.charAt (plen - 1) == separatorChar) { if (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':') end = plen; else end = plen - 1; } else end = plen; newpath.append(p.substring(last, end)); return newpath.toString(); }
| 14,377
|
private String normalizePath(String p) { // On Windows, convert any '/' to '\'. This appears to be the same logic // that Sun's Win32 Java performs. if (separatorChar == '\\') { p = p.replace ('/', '\\'); // We have to special case the "\c:" prefix. if (p.length() > 2 && p.charAt(0) == '\\' && ((p.charAt(1) >= 'a' && p.charAt(1) <= 'z') || (p.charAt(1) >= 'A' && p.charAt(1) <= 'Z')) && p.charAt(2) == ':') p = p.substring(1); } int dupIndex = p.indexOf(dupSeparator); int plen = p.length(); // Special case: permit Windows UNC path prefix. if (dupSeparator.equals("\\\\") && dupIndex == 0) dupIndex = p.indexOf(dupSeparator, 1); if (dupIndex == -1) { // Ignore trailing separator (though on Windows "a:\", for // example, is a valid and minimal path). if (plen > 1 && p.charAt (plen - 1) == separatorChar) { if (! (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':')) return p.substring (0, plen - 1); } else return p; } StringBuffer newpath = new StringBuffer(plen); int last = 0; while (dupIndex != -1) { newpath.append(p.substring(last, dupIndex)); // Ignore the duplicate path characters. while (p.charAt(dupIndex) == separatorChar) { dupIndex++; if (dupIndex == plen) return newpath.toString(); } newpath.append(separatorChar); last = dupIndex; dupIndex = p.indexOf(dupSeparator, last); } // Again, ignore possible trailing separator (except special cases // like "a:\" on Windows). int end; if (plen > 1 && p.charAt (plen - 1) == separatorChar) { if (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':') end = plen; else end = plen - 1; } else end = plen; newpath.append(p.substring(last, end)); return newpath.toString(); }
|
private String normalizePath(String p) { // On Windows, convert any '/' to '\'. This appears to be the same logic // that Sun's Win32 Java performs. if (separatorChar == '\\') { p = p.replace ('/', '\\'); // We have to special case the "\c:" prefix. if (p.length() > 2 && p.charAt(0) == '\\' && ((p.charAt(1) >= 'a' && p.charAt(1) <= 'z') || (p.charAt(1) >= 'A' && p.charAt(1) <= 'Z')) && p.charAt(2) == ':') p = p.substring(1); } int dupIndex = p.indexOf(dupSeparator); int plen = p.length(); // Special case: permit Windows UNC path prefix. if (dupSeparator.equals("\\\\") && dupIndex == 0) dupIndex = p.indexOf(dupSeparator, 1); if (dupIndex == -1) { // Ignore trailing separator (though on Windows "a:\", for // example, is a valid and minimal path). if (plen > 1 && p.charAt (plen - 1) == separatorChar) { if (! (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':')) return p.substring (0, plen - 1); } else return p; } StringBuffer newpath = new StringBuffer(plen); int last = 0; while (dupIndex != -1) { newpath.append(p.substring(last, dupIndex)); // Ignore the duplicate path characters. while (p.charAt(dupIndex) == separatorChar) { dupIndex++; if (dupIndex == plen) return newpath.toString(); } newpath.append(separatorChar); last = dupIndex; dupIndex = p.indexOf(dupSeparator, last); } // Again, ignore possible trailing separator (except special cases // like "a:\" on Windows). int end; if (plen > 1 && p.charAt (plen - 1) == separatorChar) { if (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':') end = plen; else end = plen - 1; } else end = plen; newpath.append(p.substring(last, end)); return newpath.toString(); }
| 14,378
|
private String normalizePath(String p) { // On Windows, convert any '/' to '\'. This appears to be the same logic // that Sun's Win32 Java performs. if (separatorChar == '\\') { p = p.replace ('/', '\\'); // We have to special case the "\c:" prefix. if (p.length() > 2 && p.charAt(0) == '\\' && ((p.charAt(1) >= 'a' && p.charAt(1) <= 'z') || (p.charAt(1) >= 'A' && p.charAt(1) <= 'Z')) && p.charAt(2) == ':') p = p.substring(1); } int dupIndex = p.indexOf(dupSeparator); int plen = p.length(); // Special case: permit Windows UNC path prefix. if (dupSeparator.equals("\\\\") && dupIndex == 0) dupIndex = p.indexOf(dupSeparator, 1); if (dupIndex == -1) { // Ignore trailing separator (though on Windows "a:\", for // example, is a valid and minimal path). if (plen > 1 && p.charAt (plen - 1) == separatorChar) { if (! (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':')) return p.substring (0, plen - 1); } else return p; } StringBuffer newpath = new StringBuffer(plen); int last = 0; while (dupIndex != -1) { newpath.append(p.substring(last, dupIndex)); // Ignore the duplicate path characters. while (p.charAt(dupIndex) == separatorChar) { dupIndex++; if (dupIndex == plen) return newpath.toString(); } newpath.append(separatorChar); last = dupIndex; dupIndex = p.indexOf(dupSeparator, last); } // Again, ignore possible trailing separator (except special cases // like "a:\" on Windows). int end; if (plen > 1 && p.charAt (plen - 1) == separatorChar) { if (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':') end = plen; else end = plen - 1; } else end = plen; newpath.append(p.substring(last, end)); return newpath.toString(); }
|
private String normalizePath(String p) { // On Windows, convert any '/' to '\'. This appears to be the same logic // that Sun's Win32 Java performs. if (separatorChar == '\\') { p = p.replace ('/', '\\'); // We have to special case the "\c:" prefix. if (p.length() > 2 && p.charAt(0) == '\\' && ((p.charAt(1) >= 'a' && p.charAt(1) <= 'z') || (p.charAt(1) >= 'A' && p.charAt(1) <= 'Z')) && p.charAt(2) == ':') p = p.substring(1); } int dupIndex = p.indexOf(dupSeparator); int plen = p.length(); // Special case: permit Windows UNC path prefix. if (dupSeparator.equals("\\\\") && dupIndex == 0) dupIndex = p.indexOf(dupSeparator, 1); if (dupIndex == -1) { // Ignore trailing separator (though on Windows "a:\", for // example, is a valid and minimal path). if (plen > 1 && p.charAt (plen - 1) == separatorChar) { if (! (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':')) return p.substring (0, plen - 1); } else return p; } StringBuffer newpath = new StringBuffer(plen); int last = 0; while (dupIndex != -1) { newpath.append(p.substring(last, dupIndex)); // Ignore the duplicate path characters. while (p.charAt(dupIndex) == separatorChar) { dupIndex++; if (dupIndex == plen) return newpath.toString(); } newpath.append(separatorChar); last = dupIndex; dupIndex = p.indexOf(dupSeparator, last); } // Again, ignore possible trailing separator (except special cases // like "a:\" on Windows). int end; if (plen > 1 && p.charAt (plen - 1) == separatorChar) { if (separatorChar == '\\' && plen == 3 && p.charAt (1) == ':') end = plen; else end = plen - 1; } else end = plen; newpath.append(p.substring(last, end)); return newpath.toString(); }
| 14,379
|
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); // If the file was from an OS with a different dir separator, // fixup the path to use the separator on this OS. char oldSeparatorChar = ois.readChar(); if (oldSeparatorChar != separatorChar) path = path.replace(oldSeparatorChar, separatorChar); }
|
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); // If the file was from an OS with a different dir separator, // fixup the path to use the separator on this OS. char oldSeparatorChar = ois.readChar(); if (oldSeparatorChar != separatorChar) path = path.replace(oldSeparatorChar, separatorChar); }
| 14,380
|
public boolean setLastModified(long time) { if (time < 0) throw new IllegalArgumentException("Negative modification time: " + time); checkWrite(); return VMFile.setLastModified(path, time); }
|
public boolean setLastModified(long time) { if (time < 0) throw new IllegalArgumentException("Negative modification time: " + time); checkWrite(); return VMFile.setLastModified(path, time); }
| 14,381
|
public URI toURI() { String abspath = getAbsolutePath(); if (isDirectory()) abspath = abspath + separatorChar; if (separatorChar == '\\') abspath = separatorChar + abspath; try { return new URI("file", null, null, -1, abspath.replace(separatorChar, '/'), null, null); } catch (URISyntaxException use) { // Can't happen. throw (InternalError) new InternalError("Unconvertible file: " + this).initCause(use); } }
|
public URI toURI() { String abspath = getAbsolutePath(); if (isDirectory()) abspath = abspath + separatorChar; if (separatorChar == '\\') abspath = separatorChar + abspath; try { return new URI("file", null, null, -1, abspath.replace(separatorChar, '/'), null, null); } catch (URISyntaxException use) { // Can't happen. throw (InternalError) new InternalError("Unconvertible file: " + this).initCause(use); } }
| 14,382
|
public URL toURL() throws MalformedURLException { // On Win32, Sun's JDK returns URLs of the form "file:/c:/foo/bar.txt", // while on UNIX, it returns URLs of the form "file:/foo/bar.txt". if (separatorChar == '\\') return new URL ("file:/" + getAbsolutePath().replace ('\\', '/') + (isDirectory() ? "/" : "")); else return new URL ("file:" + getAbsolutePath() + (isDirectory() ? "/" : "")); }
|
public URL toURL() throws MalformedURLException { // On Win32, Sun's JDK returns URLs of the form "file:/c:/foo/bar.txt", // while on UNIX, it returns URLs of the form "file:/foo/bar.txt". if (separatorChar == '\\') return new URL ("file:/" + getAbsolutePath().replace ('\\', '/') + (isDirectory() ? "/" : "")); else return new URL ("file:" + getAbsolutePath() + (isDirectory() ? "/" : "")); }
| 14,383
|
public void checkRead(String filename) { checkPermission(new FilePermission(filename, "read")); }
|
public void checkRead(FileDescriptor desc) { checkPermission(new FilePermission(filename, "read")); }
| 14,384
|
public void checkRead(String filename) { checkPermission(new FilePermission(filename, "read")); }
|
public void checkRead(String filename) { if (desc == null) throw new NullPointerException(); checkPermission(new RuntimePermission("readFileDescriptor")); }
| 14,385
|
public void checkWrite(String filename) { checkPermission(new FilePermission(filename, "write")); }
|
public void checkWrite(FileDescriptor desc) { checkPermission(new FilePermission(filename, "write")); }
| 14,386
|
public void checkWrite(String filename) { checkPermission(new FilePermission(filename, "write")); }
|
public void checkWrite(String filename) { if (desc == null) throw new NullPointerException(); checkPermission(new RuntimePermission("writeFileDescriptor")); }
| 14,387
|
public URI(String scheme, String userInfo, String host, int port, String path, String query, String fragment) throws URISyntaxException { this((scheme == null ? "" : scheme + ":") + (userInfo == null && host == null && port == -1 ? "" : "//") + (userInfo == null ? "" : quoteUserInfo(userInfo) + "@") + (host == null ? "" : quoteHost(host)) + (port == -1 ? "" : ":" + String.valueOf(port)) + (path == null ? "" : quotePath(path)) + (query == null ? "" : "?" + quote(query)) + (fragment == null ? "" : "#" + quote(fragment))); parseServerAuthority(); }
|
public URI(String scheme, String userInfo, String host, int port, String path, String query, String fragment) throws URISyntaxException { this((scheme == null ? "" : scheme + ":") + (userInfo == null && host == null && port == -1 ? "" : "//") + (userInfo == null ? "" : quoteUserInfo(userInfo) + "@") + (host == null ? "" : quoteHost(host)) + (port == -1 ? "" : ":" + String.valueOf(port)) + (path == null ? "" : quotePath(path)) + (query == null ? "" : "?" + quote(query)) + (fragment == null ? "" : "#" + quote(fragment))); parseServerAuthority(); }
| 14,388
|
public URI(String scheme, String userInfo, String host, int port, String path, String query, String fragment) throws URISyntaxException { this((scheme == null ? "" : scheme + ":") + (userInfo == null && host == null && port == -1 ? "" : "//") + (userInfo == null ? "" : quoteUserInfo(userInfo) + "@") + (host == null ? "" : quoteHost(host)) + (port == -1 ? "" : ":" + String.valueOf(port)) + (path == null ? "" : quotePath(path)) + (query == null ? "" : "?" + quote(query)) + (fragment == null ? "" : "#" + quote(fragment))); parseServerAuthority(); }
|
public URI(String scheme, String userInfo, String host, int port, String path, String query, String fragment) throws URISyntaxException { this((scheme == null ? "" : scheme + ":") + (userInfo == null && host == null && port == -1 ? "" : "//") + (userInfo == null ? "" : quoteUserInfo(userInfo) + "@") + (host == null ? "" : quoteHost(host)) + (port == -1 ? "" : ":" + String.valueOf(port)) + (path == null ? "" : quotePath(path)) + (query == null ? "" : "?" + quote(query)) + (fragment == null ? "" : "#" + quote(fragment))); parseServerAuthority(); }
| 14,389
|
public InternalError(String s) { super(s); }
|
public InternalError(String s) { super(s); }
| 14,390
|
public URL(String spec) throws MalformedURLException { this((URL) null, spec, (URLStreamHandler) null); }
|
public URL(String spec) throws MalformedURLException { this((URL) null, spec, (URLStreamHandler) null); }
| 14,391
|
protected SAXParserFactory() { } // SAXParserFactory()
|
protected SAXParserFactory() { } // SAXParserFactory()
| 14,392
|
public abstract boolean getFeature (String name) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException;
|
public abstract boolean getFeature (String name) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException;
| 14,393
|
public boolean isNamespaceAware() { return namespaceAware; } // isNamespaceAware()
|
public boolean isNamespaceAware() { return namespaceAware; } // isNamespaceAware()
| 14,394
|
public boolean isNamespaceAware() { return namespaceAware; } // isNamespaceAware()
|
public boolean isNamespaceAware() { return namespaceAware; } // isNamespaceAware()
| 14,395
|
public boolean isValidating() { return validating; } // isValidating()
|
public boolean isValidating() { return validating; } // isValidating()
| 14,396
|
public boolean isValidating() { return validating; } // isValidating()
|
public boolean isValidating() { return validating; } // isValidating()
| 14,397
|
public static SAXParserFactory newInstance() { try { return (SAXParserFactory) ClassStuff.createFactory ( defaultPropName, "gnu.xml.aelfred2.JAXPFactory"); } catch (ClassCastException e) { throw new FactoryConfigurationError (e, "Factory class is the wrong type"); } }
|
public static SAXParserFactory newInstance() { try { return (SAXParserFactory) ClassStuff.createFactory ( defaultPropName, "gnu.xml.aelfred2.JAXPFactory"); } catch (ClassCastException e) { throw new FactoryConfigurationError (e, "Factory class is the wrong type"); } }
| 14,398
|
public abstract void setFeature (String name, boolean value) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException;
|
public abstract void setFeature (String name, boolean value) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException;
| 14,399
|
public void setNamespaceAware(boolean value) { namespaceAware = value; } // setNamespaceAware()
|
public void setNamespaceAware(boolean value) { namespaceAware = value; } // setNamespaceAware()
| 14,400
|
public void setValidating(boolean value) { validating = value; } // setValidating()
|
public void setValidating(boolean value) { validating = value; } // setValidating()
| 14,401
|
public FactoryConfigurationError(Exception ex, String msg) { super(msg); exception = ex; } // FactoryConfigurationError()
|
public FactoryConfigurationError(Exception ex, String msg) { super(msg); exception = ex; } // FactoryConfigurationError()
| 14,402
|
public void componentAdded(ContainerEvent event) { final Component c = event.getChild(); if (c instanceof JInternalFrame) { taskBar.windowBar.addFrame((JInternalFrame) c); } else { log.info("componentAdded: " + c.getClass().getName()); } }
|
public void componentAdded(ContainerEvent event) { final Component c = event.getChild(); if (c instanceof JInternalFrame && !JNodeToolkit.getJNodeToolkit().isWindow(c)) { taskBar.windowBar.addFrame((JInternalFrame) c); } else { log.info("componentAdded: " + c.getClass().getName()); } }
| 14,403
|
public static Image loadImage(String resName) { try { System.err.println("*** loadImage ***"); final ClassLoader cl = Thread.currentThread().getContextClassLoader(); System.err.println("cl="+cl); Enumeration e = cl.getResources("/" + resName); while(e.hasMoreElements()) { System.err.println("url="+e.nextElement()); } System.err.println("end urls"); final URL url = cl.getResource("/" + resName); System.err.println("url="+url); if (url != null) {// method 1 : generic read (with imageio api) // return ImageIO.read(url);// method 2 : direct read (with the appropriate codec) // PNGCodecHandler codec = new PNGCodecHandler();// codec.read(url.openStream(), ReadType.NORMAL);// return codec.getImageObject().getBufferedImage(); } else { System.err.println("Cannot find image " + resName); } } catch (IOException ex) { ex.printStackTrace(); System.err.println("Cannot find image " + resName + ": " + ex.getMessage()); } catch (Throwable ex) { ex.printStackTrace(); System.err.println("Cannot find image " + resName + ": " + ex.getMessage()); } return null; }
|
public static Image loadImage(String resName) { try { System.err.println("*** loadImage ***"); final ClassLoader cl = Thread.currentThread().getContextClassLoader(); System.err.println("cl="+cl); Enumeration e = cl.getResources("/" + resName); while(e.hasMoreElements()) { System.err.println("url="+e.nextElement()); } System.err.println("end urls"); final URL url = cl.getResource("/" + resName); System.err.println("url="+url); if (url != null) {// method 1 : generic read (with imageio api) // return ImageIO.read(url);// method 2 : direct read (with the appropriate codec) // PNGCodecHandler codec = new PNGCodecHandler();// codec.read(url.openStream(), ReadType.NORMAL);// return codec.getImageObject().getBufferedImage(); } else { System.err.println("Cannot find image " + resName); } } catch (IOException ex) { ex.printStackTrace(); System.err.println("Cannot find image " + resName + ": " + ex.getMessage()); } catch (Throwable ex) { ex.printStackTrace(); System.err.println("Cannot find image " + resName + ": " + ex.getMessage()); } return null; }
| 14,404
|
public static Image loadImage(String resName) { try { System.err.println("*** loadImage ***"); final ClassLoader cl = Thread.currentThread().getContextClassLoader(); System.err.println("cl="+cl); Enumeration e = cl.getResources("/" + resName); while(e.hasMoreElements()) { System.err.println("url="+e.nextElement()); } System.err.println("end urls"); final URL url = cl.getResource("/" + resName); System.err.println("url="+url); if (url != null) {// method 1 : generic read (with imageio api) // return ImageIO.read(url);// method 2 : direct read (with the appropriate codec) // PNGCodecHandler codec = new PNGCodecHandler();// codec.read(url.openStream(), ReadType.NORMAL);// return codec.getImageObject().getBufferedImage(); } else { System.err.println("Cannot find image " + resName); } } catch (IOException ex) { ex.printStackTrace(); System.err.println("Cannot find image " + resName + ": " + ex.getMessage()); } catch (Throwable ex) { ex.printStackTrace(); System.err.println("Cannot find image " + resName + ": " + ex.getMessage()); } return null; }
|
public static Image loadImage(String resName) { try { System.err.println("*** loadImage ***"); final ClassLoader cl = Thread.currentThread().getContextClassLoader(); System.err.println("cl="+cl); Enumeration e = cl.getResources("/" + resName); while(e.hasMoreElements()) { System.err.println("url="+e.nextElement()); } System.err.println("end urls"); final URL url = cl.getResource("/" + resName); System.err.println("url="+url); if (url != null) {// method 1 : generic read (with imageio api) // return ImageIO.read(url);// method 2 : direct read (with the appropriate codec) // PNGCodecHandler codec = new PNGCodecHandler();// codec.read(url.openStream(), ReadType.NORMAL);// return codec.getImageObject().getBufferedImage(); } else { System.err.println("Cannot find image " + resName); } } catch (IOException ex) { ex.printStackTrace(); System.err.println("Cannot find image " + resName + ": " + ex.getMessage()); } catch (Throwable ex) { ex.printStackTrace(); System.err.println("Cannot find image " + resName + ": " + ex.getMessage()); } return null; }
| 14,405
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
| 14,406
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame frame; private JColorChooser colorChooser; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
| 14,407
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
| 14,408
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
| 14,409
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(colorChooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(colorChooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
| 14,410
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); frame.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); frame.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
| 14,411
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
| 14,412
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
| 14,413
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
| 14,414
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
|
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
| 14,415
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
| 14,416
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame frame; private JColorChooser colorChooser; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
| 14,417
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
| 14,418
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
| 14,419
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(colorChooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(colorChooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
| 14,420
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); frame.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); frame.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
| 14,421
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
| 14,422
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
| 14,423
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
| 14,424
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
|
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
| 14,425
|
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
|
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
| 14,426
|
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
|
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
| 14,427
|
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
|
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(colorChooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(colorChooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
| 14,428
|
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
|
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); frame.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); frame.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
| 14,429
|
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
|
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
| 14,430
|
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
|
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
| 14,431
|
public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); }
|
public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); }
| 14,432
|
public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); }
|
public void actionPerformed(ActionEvent event) { desktop.setBackground(colorChooser.getColor()); }
| 14,433
|
public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); }
|
public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); frame.setVisible(false); }
| 14,434
|
public String toString() { // Identical to toExternalForm(). return handler.toExternalForm(this); }
|
public String toString() { // Identical to toExternalForm(). return handler.toExternalForm(this); }
| 14,435
|
public String toString() { // Identical to toExternalForm(). return handler.toExternalForm(this); }
|
public String toString() { // Identical to toExternalForm(). return handler.toExternalForm(this); }
| 14,436
|
public Dimension(int w, int h) { width = w; height = h; }
|
public Dimension() { width = w; height = h; }
| 14,437
|
public Dimension(int w, int h) { width = w; height = h; }
|
public Dimension(int w, int h) { width = w; height = h; }
| 14,438
|
public ImageIcon(String s) { this(s, ""); }
|
public ImageIcon(String s) { this(s, ""); }
| 14,439
|
public JLabel(Icon image) { this("", image, 0); }
|
public JLabel(Icon image) { this("", image, 0); }
| 14,440
|
public void add(Component comp, Object constraints) { addImpl(comp, constraints, -1); }
|
public Component add(Component comp) { addImpl(comp, constraints, -1); }
| 14,441
|
public void add(Component comp, Object constraints) { addImpl(comp, constraints, -1); }
|
public void add(Component comp, Object constraints) { addImpl(comp, null, -1); return comp; }
| 14,442
|
public void repaint() { if (isShowing()) repaint(0, 0, 0, width, height); }
|
public void repaint() { if (isShowing()) repaint(0, 0, 0, width, height); }
| 14,443
|
public JPopupMenu(String label) { // TODO } // JPopupMenu()
|
public JPopupMenu(String label) { // TODO } // JPopupMenu()
| 14,444
|
public JMenuItem(String text) { // TODO } // JMenuItem()
|
public JMenuItem(String text) { // TODO } // JMenuItem()
| 14,445
|
public void addActionListener(ActionListener l) { getModel().addActionListener(l); }
|
public void addActionListener(ActionListener l) { getModel().addActionListener(l); }
| 14,446
|
public JFrame(String title) { super(title); frameInit(); }
|
public JFrame(String title) { super(title); frameInit(); }
| 14,447
|
public JButton(String text) { this(text, null); }
|
public JButton(String text) { this(text, null); }
| 14,448
|
public JPanel() { this(new FlowLayout(), true); }
|
public JPanel() { this(new FlowLayout(), true); }
| 14,449
|
public abstract Object clone ();
|
public abstract Object clone ();
| 14,450
|
public abstract char current ();
|
public abstract char current ();
| 14,451
|
public abstract char first ();
|
public abstract char first ();
| 14,452
|
public abstract char last ();
|
char last();
| 14,453
|
public abstract char previous ();
|
public abstract char previous ();
| 14,454
|
public VirtualMachineError(String s) { super(s); }
|
public VirtualMachineError(String s) { super(s); }
| 14,455
|
public UserException(String reason) { super(reason); }
|
public UserException() { super(reason); }
| 14,456
|
public UserException(String reason) { super(reason); }
|
public UserException(String reason) { }
| 14,457
|
public Object createValue(UIDefaults table) { try { return Class .forName(className) .getConstructor(clss) .newInstance(objs); } catch (Exception e) { return null; } }
|
public Object createValue(UIDefaults table) { try { return Class .forName(className) .getConstructor(clss) .newInstance(objs); } catch (Exception e) { return null; } }
| 14,458
|
public Object createValue(UIDefaults table) { try { return Class .forName(className) .getConstructor(clss) .newInstance(objs); } catch (Exception e) { return null; } }
|
public Object createValue(UIDefaults table) { try { return Class .forName(className) .getConstructor(clss) .newInstance(objs); } catch (Exception e) { return null; } }
| 14,459
|
public Object createValue(UIDefaults table) { try { return Class .forName(className) .getMethod(methodName, clss) .invoke(null, objs); } catch (Exception e) { return null; } }
|
public Object createValue(UIDefaults table) { try { return Class .forName(className) .getMethod(methodName, clss) .invoke(null, objs); } catch (Exception e) { return null; } }
| 14,460
|
public ComponentUI getUI(JComponent target) { String classId = target.getUIClassID (); Class cls = getUIClass (classId); if (cls == null) { getUIError ("failed to locate UI class:" + classId); return null; } Method factory; try { factory = cls.getMethod ("createUI", new Class[] { JComponent.class } ); } catch (NoSuchMethodException nme) { getUIError ("failed to locate createUI method on " + cls.toString ()); return null; } try { return (ComponentUI) factory.invoke (null, new Object[] { target }); } catch (java.lang.reflect.InvocationTargetException ite) { getUIError ("InvocationTargetException ("+ ite.getTargetException() +") calling createUI(...) on " + cls.toString ()); return null; } catch (Exception e) { getUIError ("exception calling createUI(...) on " + cls.toString ()); return null; } }
|
public ComponentUI getUI(JComponent target) { String classId = target.getUIClassID (); Class cls = getUIClass (classId); if (cls == null) { getUIError ("failed to locate UI class:" + classId); return null; } Method factory; try { factory = cls.getMethod ("createUI", new Class[] { JComponent.class } ); } catch (NoSuchMethodException nme) { getUIError ("failed to locate createUI method on " + cls.toString ()); return null; } try { return (ComponentUI) factory.invoke (null, new Object[] { target }); } catch (java.lang.reflect.InvocationTargetException ite) { getUIError ("InvocationTargetException ("+ ite.getTargetException() +") calling createUI(...) on " + cls.toString ()); return null; } catch (Exception e) { getUIError ("exception calling createUI(...) on " + cls.toString ()); return null; } }
| 14,461
|
public ComponentUI getUI(JComponent target) { String classId = target.getUIClassID (); Class cls = getUIClass (classId); if (cls == null) { getUIError ("failed to locate UI class:" + classId); return null; } Method factory; try { factory = cls.getMethod ("createUI", new Class[] { JComponent.class } ); } catch (NoSuchMethodException nme) { getUIError ("failed to locate createUI method on " + cls.toString ()); return null; } try { return (ComponentUI) factory.invoke (null, new Object[] { target }); } catch (java.lang.reflect.InvocationTargetException ite) { getUIError ("InvocationTargetException ("+ ite.getTargetException() +") calling createUI(...) on " + cls.toString ()); return null; } catch (Exception e) { getUIError ("exception calling createUI(...) on " + cls.toString ()); return null; } }
|
public ComponentUI getUI(JComponent target) { String classId = target.getUIClassID (); Class cls = getUIClass (classId); if (cls == null) { getUIError ("failed to locate UI class:" + classId); return null; } Method factory; try { factory = cls.getMethod ("createUI", new Class[] { JComponent.class } ); } catch (NoSuchMethodException nme) { getUIError ("failed to locate createUI method on " + cls.toString ()); return null; } try { return (ComponentUI) factory.invoke (null, new Object[] { target }); } catch (java.lang.reflect.InvocationTargetException ite) { getUIError ("InvocationTargetException ("+ ite.getTargetException() +") calling createUI(...) on " + cls.toString ()); return null; } catch (Exception e) { getUIError ("exception calling createUI(...) on " + cls.toString ()); return null; } }
| 14,462
|
public ComponentUI getUI(JComponent target) { String classId = target.getUIClassID (); Class cls = getUIClass (classId); if (cls == null) { getUIError ("failed to locate UI class:" + classId); return null; } Method factory; try { factory = cls.getMethod ("createUI", new Class[] { JComponent.class } ); } catch (NoSuchMethodException nme) { getUIError ("failed to locate createUI method on " + cls.toString ()); return null; } try { return (ComponentUI) factory.invoke (null, new Object[] { target }); } catch (java.lang.reflect.InvocationTargetException ite) { getUIError ("InvocationTargetException ("+ ite.getTargetException() +") calling createUI(...) on " + cls.toString ()); return null; } catch (Exception e) { getUIError ("exception calling createUI(...) on " + cls.toString ()); return null; } }
|
public ComponentUI getUI(JComponent target) { String classId = target.getUIClassID (); Class cls = getUIClass (classId); if (cls == null) { getUIError ("failed to locate UI class:" + classId); return null; } Method factory; try { factory = cls.getMethod ("createUI", new Class[] { JComponent.class } ); } catch (NoSuchMethodException nme) { getUIError ("failed to locate createUI method on " + cls.toString ()); return null; } try { return (ComponentUI) factory.invoke (null, new Object[] { target }); } catch (java.lang.reflect.InvocationTargetException ite) { getUIError ("InvocationTargetException ("+ ite.getTargetException() +") calling createUI(...) on " + cls.toString ()); return null; } catch (Exception e) { getUIError ("exception calling createUI(...) on " + cls.toString ()); return null; } }
| 14,463
|
public ComponentUI getUI(JComponent target) { String classId = target.getUIClassID (); Class cls = getUIClass (classId); if (cls == null) { getUIError ("failed to locate UI class:" + classId); return null; } Method factory; try { factory = cls.getMethod ("createUI", new Class[] { JComponent.class } ); } catch (NoSuchMethodException nme) { getUIError ("failed to locate createUI method on " + cls.toString ()); return null; } try { return (ComponentUI) factory.invoke (null, new Object[] { target }); } catch (java.lang.reflect.InvocationTargetException ite) { getUIError ("InvocationTargetException ("+ ite.getTargetException() +") calling createUI(...) on " + cls.toString ()); return null; } catch (Exception e) { getUIError ("exception calling createUI(...) on " + cls.toString ()); return null; } }
|
public ComponentUI getUI(JComponent target) { String classId = target.getUIClassID (); Class cls = getUIClass (classId); if (cls == null) { getUIError ("failed to locate UI class:" + classId); return null; } Method factory; try { factory = cls.getMethod ("createUI", new Class[] { JComponent.class } ); } catch (NoSuchMethodException nme) { getUIError ("failed to locate createUI method on " + cls.toString ()); return null; } try { return (ComponentUI) factory.invoke (null, new Object[] { target }); } catch (java.lang.reflect.InvocationTargetException ite) { getUIError ("InvocationTargetException ("+ ite.getTargetException() +") calling createUI(...) on " + cls.toString ()); return null; } catch (Exception e) { getUIError ("exception calling createUI(...) on " + cls.toString ()); return null; } }
| 14,464
|
public ComponentUI getUI(JComponent target) { String classId = target.getUIClassID (); Class cls = getUIClass (classId); if (cls == null) { getUIError ("failed to locate UI class:" + classId); return null; } Method factory; try { factory = cls.getMethod ("createUI", new Class[] { JComponent.class } ); } catch (NoSuchMethodException nme) { getUIError ("failed to locate createUI method on " + cls.toString ()); return null; } try { return (ComponentUI) factory.invoke (null, new Object[] { target }); } catch (java.lang.reflect.InvocationTargetException ite) { getUIError ("InvocationTargetException ("+ ite.getTargetException() +") calling createUI(...) on " + cls.toString ()); return null; } catch (Exception e) { getUIError ("exception calling createUI(...) on " + cls.toString ()); return null; } }
|
public ComponentUI getUI(JComponent target) { String classId = target.getUIClassID (); Class cls = getUIClass (classId); if (cls == null) { getUIError ("failed to locate UI class:" + classId); return null; } Method factory; try { factory = cls.getMethod ("createUI", new Class[] { JComponent.class } ); } catch (NoSuchMethodException nme) { getUIError ("failed to locate createUI method on " + cls.toString ()); return null; } try { return (ComponentUI) factory.invoke (null, new Object[] { target }); } catch (java.lang.reflect.InvocationTargetException ite) { getUIError ("InvocationTargetException ("+ ite.getTargetException() +") calling createUI(...) on " + cls.toString ()); return null; } catch (Exception e) { getUIError ("exception calling createUI(...) on " + cls.toString ()); return null; } }
| 14,465
|
public ComponentUI getUI(JComponent target) { String classId = target.getUIClassID (); Class cls = getUIClass (classId); if (cls == null) { getUIError ("failed to locate UI class:" + classId); return null; } Method factory; try { factory = cls.getMethod ("createUI", new Class[] { JComponent.class } ); } catch (NoSuchMethodException nme) { getUIError ("failed to locate createUI method on " + cls.toString ()); return null; } try { return (ComponentUI) factory.invoke (null, new Object[] { target }); } catch (java.lang.reflect.InvocationTargetException ite) { getUIError ("InvocationTargetException ("+ ite.getTargetException() +") calling createUI(...) on " + cls.toString ()); return null; } catch (Exception e) { getUIError ("exception calling createUI(...) on " + cls.toString ()); return null; } }
|
public ComponentUI getUI(JComponent target) { String classId = target.getUIClassID (); Class cls = getUIClass (classId); if (cls == null) { getUIError ("failed to locate UI class:" + classId); return null; } Method factory; try { factory = cls.getMethod ("createUI", new Class[] { JComponent.class } ); } catch (NoSuchMethodException nme) { getUIError ("failed to locate createUI method on " + cls.toString ()); return null; } try { return (ComponentUI) factory.invoke (null, new Object[] { target }); } catch (java.lang.reflect.InvocationTargetException ite) { getUIError ("InvocationTargetException ("+ ite.getTargetException() +") calling createUI(...) on " + cls.toString ()); return null; } catch (Exception e) { getUIError ("exception calling createUI(...) on " + cls.toString ()); return null; } }
| 14,466
|
public static KeyStroke getKeyStroke(String string) { return null; // TODO } // getKeyStroke()
|
public static KeyStroke getKeyStroke(String string) { return null; // TODO } // getKeyStroke()
| 14,467
|
public Object newInstance(Object args[]) throws InstantiationException, IllegalAccessException, InvocationTargetException { return VmReflection.newInstance(vmMethod, args); }
|
public Object newInstance(Object args[]) throws InstantiationException, IllegalAccessException, InvocationTargetException { return VmReflection.newInstance(vmMethod, args); }
| 14,468
|
public Object invoke(Object o, Object[] args) throws IllegalAccessException, InvocationTargetException { return VmReflection.invoke(vmMethod, o, args); }
|
public Object invoke(Object o, Object[] args) throws IllegalAccessException, InvocationTargetException { return VmReflection.invoke(vmMethod, o, args); }
| 14,469
|
public static ResourceBundle getBundle(String baseName, Locale locale) { ClassLoader cl = security.getCallingClassLoader(); if (cl == null) cl = ClassLoader.getSystemClassLoader(); return getBundle(baseName, locale, cl); }
|
public static ResourceBundle getBundle(String baseName) { ClassLoader cl = security.getCallingClassLoader(); if (cl == null) cl = ClassLoader.getSystemClassLoader(); return getBundle(baseName, locale, cl); }
| 14,470
|
public static ResourceBundle getBundle(String baseName, Locale locale) { ClassLoader cl = security.getCallingClassLoader(); if (cl == null) cl = ClassLoader.getSystemClassLoader(); return getBundle(baseName, locale, cl); }
|
public static ResourceBundle getBundle(String baseName, Locale locale) { ClassLoader cl = security.getCallingClassLoader(); if (cl == null) cl = ClassLoader.getSystemClassLoader(); return getBundle(baseName, Locale.getDefault(), cl); }
| 14,471
|
void showDocument(URL url, String target);
|
void showDocument(URL url, String target);
| 14,472
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.