rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
public static File createTempFile(String prefix, String suffix) | public static synchronized File createTempFile(String prefix, String suffix, File directory) | public static File createTempFile(String prefix, String suffix) throws IOException { return createTempFile(prefix, suffix, null); } |
return createTempFile(prefix, suffix, null); | if (directory == null) { String dirname = System.getProperty("java.io.tmpdir"); if (dirname == null) throw new IOException("Cannot determine system temporary directory"); directory = new File(dirname); if (! VMFile.exists(directory.path)) throw new IOException("System temporary directory " + directory.getName() + " does not exist."); if (! VMFile.isDirectory(directory.path)) throw new IOException("System temporary directory " + directory.getName() + " is not really a directory."); } if (prefix.length() < 3) throw new IllegalArgumentException("Prefix too short: " + prefix); if (suffix == null) suffix = ".tmp"; File file; if (!VMFile.IS_DOS_8_3) { do { long now = System.currentTimeMillis(); if (now > last_tmp) { last_tmp = now; n_created = 0; } else n_created++; String name = Long.toHexString(now); if (n_created > 0) name += '_'+Integer.toHexString(n_created); String filename = prefix + name + suffix; file = new File(directory, filename); } while (VMFile.exists(file.path)); } else { if (prefix.length() >= 8) throw new IllegalArgumentException("Prefix too long: " + prefix + "(valid length 3..7)"); long mask = 0x000000ffffFFFFL >> (prefix.length() * 4); do { int n = (int) (System.currentTimeMillis() & mask); String filename = prefix + java.lang.Integer.toHexString(n) + suffix; file = new File(directory, filename); } while (VMFile.exists(file.path)); } SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkWrite(file.getAbsolutePath()); VMFile.create(file.getAbsolutePath()); return file; | public static File createTempFile(String prefix, String suffix) throws IOException { return createTempFile(prefix, suffix, null); } |
return System.getProperty ("user.dir") + separatorChar + path; | { String currentDir = System.getProperty("user.dir"); if (currentDir.endsWith(separator)) return currentDir + path; else return currentDir + separator + path; } | public String getAbsolutePath() { if (isAbsolute()) return path; else if (separatorChar == '\\' && path.length() > 0 && path.charAt (0) == '\\') { // On Windows, even if the path starts with a '\\' it is not // really absolute until we prefix the drive specifier from // the current working directory to it. return System.getProperty ("user.dir").substring (0, 2) + path; } else if (separatorChar == '\\' && path.length() > 1 && path.charAt (1) == ':' && ((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z'))) { // On Windows, a process has a current working directory for // each drive and a path like "G:foo\bar" would mean the // absolute path "G:\wombat\foo\bar" if "\wombat" is the // working directory on the G drive. String drvDir = null; try { drvDir = new File (path.substring (0, 2)).getCanonicalPath(); } catch (IOException e) { drvDir = path.substring (0, 2) + "\\"; } // Note: this would return "C:\\." for the path "C:.", if "\" // is the working folder on the C drive, but this is // consistent with what Sun's JRE 1.4.1.01 actually returns! if (path.length() > 2) return drvDir + '\\' + path.substring (2, path.length()); else return drvDir; } else return System.getProperty ("user.dir") + separatorChar + path; } |
public String[] list() | public String[] list(FilenameFilter filter) | public String[] list() { return list(null); } |
return list(null); | 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; | public String[] list() { return list(null); } |
public void checkWrite(String filename) | public void checkWrite(FileDescriptor desc) | public void checkWrite(String filename) { checkPermission(new FilePermission(filename, "write")); } |
checkPermission(new FilePermission(filename, "write")); | if (desc == null) throw new NullPointerException(); checkPermission(new RuntimePermission("writeFileDescriptor")); | public void checkWrite(String filename) { checkPermission(new FilePermission(filename, "write")); } |
public URI(String scheme, String userInfo, String host, int port, String path, String query, String fragment) throws URISyntaxException | public URI(String str) throws URISyntaxException | 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(); } |
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(); | this.string = str; parseURI(str); | 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 URL(String spec) throws MalformedURLException { this((URL) null, spec, (URLStreamHandler) null); | public URL(String protocol, String host, int port, String file) throws MalformedURLException { this(protocol, host, port, file, null); | public URL(String spec) throws MalformedURLException { this((URL) null, spec, (URLStreamHandler) null); } |
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() throws FactoryConfigurationError { ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (loader == null) { loader = SAXParserFactory.class.getClassLoader(); } String className = null; int count = 0; do { className = getFactoryClassName(loader, count++); if (className != null) { try { Class t = (loader != null) ? loader.loadClass(className) : Class.forName(className); return (SAXParserFactory) t.newInstance(); } catch (ClassNotFoundException e) { className = null; } catch (Exception e) { throw new FactoryConfigurationError(e, "error instantiating class " + className); } } } while (className == null && count < 3); return new gnu.xml.aelfred2.JAXPFactory(); } | 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 void setNamespaceAware(boolean value) { namespaceAware = value; } | public void setNamespaceAware(boolean awareness) { namespaceAware = awareness; } | public void setNamespaceAware(boolean value) { namespaceAware = value; } // setNamespaceAware() |
public void setValidating(boolean value) { validating = value; } | public void setValidating(boolean validating) { this.validating = validating; } | public void setValidating(boolean value) { validating = value; } // setValidating() |
public FactoryConfigurationError(Exception ex, String msg) { super(msg); exception = ex; } | public FactoryConfigurationError() { super(); } | public FactoryConfigurationError(Exception ex, String msg) { super(msg); exception = ex; } // FactoryConfigurationError() |
if (c instanceof JInternalFrame) { | if (c instanceof JInternalFrame && !JNodeToolkit.getJNodeToolkit().isWindow(c)) { | 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()); } } |
private JFrame f; | private JFrame frame; private JColorChooser colorChooser; | 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(); } }); } |
if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); | frame = new JFrame("Desktop color"); colorChooser = new JColorChooser(); frame.add(colorChooser, BorderLayout.CENTER); | 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(); } }); } |
desktop.setBackground(color_chooser.getColor()); f.setVisible(false); | desktop.setBackground(colorChooser.getColor()); frame.setVisible(false); | 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(); } }); } |
desktop.setBackground(color_chooser.getColor()); | desktop.setBackground(colorChooser.getColor()); | 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(); } }); } |
f.setVisible(false); | frame.setVisible(false); | 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(); } }); } |
f.add(buttons, BorderLayout.SOUTH); } | frame.add(buttons, BorderLayout.SOUTH); | 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(); } }); } |
f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); | frame.setSize(500, 400); frame.setVisible(true); frame.setLocation(x, y); | 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(); } }); } |
private JFrame f; | private JFrame frame; private JColorChooser colorChooser; | 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(); } |
if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); | frame = new JFrame("Desktop color"); colorChooser = new JColorChooser(); frame.add(colorChooser, BorderLayout.CENTER); | 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(); } |
desktop.setBackground(color_chooser.getColor()); f.setVisible(false); | desktop.setBackground(colorChooser.getColor()); frame.setVisible(false); | 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(); } |
desktop.setBackground(color_chooser.getColor()); | desktop.setBackground(colorChooser.getColor()); | 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(); } |
f.setVisible(false); | frame.setVisible(false); | 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(); } |
f.add(buttons, BorderLayout.SOUTH); } | frame.add(buttons, BorderLayout.SOUTH); | 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(); } |
f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); | frame.setSize(500, 400); frame.setVisible(true); frame.setLocation(x, y); | 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(); } |
if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); | frame = new JFrame("Desktop color"); colorChooser = new JColorChooser(); frame.add(colorChooser, BorderLayout.CENTER); | 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); } |
desktop.setBackground(color_chooser.getColor()); f.setVisible(false); | desktop.setBackground(colorChooser.getColor()); frame.setVisible(false); | 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); } |
desktop.setBackground(color_chooser.getColor()); | desktop.setBackground(colorChooser.getColor()); | 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); } |
f.setVisible(false); | frame.setVisible(false); | 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); } |
f.add(buttons, BorderLayout.SOUTH); } | frame.add(buttons, BorderLayout.SOUTH); | 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); } |
f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); | frame.setSize(500, 400); frame.setVisible(true); frame.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); } |
desktop.setBackground(color_chooser.getColor()); f.setVisible(false); | desktop.setBackground(colorChooser.getColor()); frame.setVisible(false); | public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } |
desktop.setBackground(color_chooser.getColor()); | desktop.setBackground(colorChooser.getColor()); | public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } |
f.setVisible(false); | frame.setVisible(false); | public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } |
return handler.toExternalForm(this); } | return ph.toExternalForm(this); } | public String toString() { // Identical to toExternalForm(). return handler.toExternalForm(this); } |
public Dimension(int w, int h) | public Dimension() | public Dimension(int w, int h) { width = w; height = h; } |
width = w; height = h; | public Dimension(int w, int h) { width = w; height = h; } |
|
public JLabel(Icon image) { this("", image, 0); } | public JLabel() { this("", null, 0); } | public JLabel(Icon image) { this("", image, 0); } |
public void add(Component comp, Object constraints) | public Component add(Component comp) | public void add(Component comp, Object constraints) { addImpl(comp, constraints, -1); } |
addImpl(comp, constraints, -1); | addImpl(comp, null, -1); return comp; | public void add(Component comp, Object constraints) { addImpl(comp, constraints, -1); } |
if (isShowing()) | public void repaint() { if (isShowing()) repaint(0, 0, 0, width, height); } |
|
public JPopupMenu(String label) { | public JPopupMenu() { | public JPopupMenu(String label) { // TODO } // JPopupMenu() |
public JMenuItem(String text) { | public JMenuItem() { | public JMenuItem(String text) { // TODO } // JMenuItem() |
public void addActionListener(ActionListener l) { getModel().addActionListener(l); } | public void addActionListener(ActionListener l) { listenerList.add(ActionListener.class, l); } | public void addActionListener(ActionListener l) { getModel().addActionListener(l); } |
public JFrame(String title) { super(title); frameInit(); } | public JFrame() { super("JFrame"); frameInit(); } | public JFrame(String title) { super(title); frameInit(); } |
public JButton(String text) { this(text, null); } | public JButton() { this(null, null); } | public JButton(String text) { this(text, null); } |
public abstract Object clone (); | Object clone(); | public abstract Object clone (); |
public abstract char current (); | char current(); | public abstract char current (); |
public abstract char first (); | char first(); | public abstract char first (); |
public abstract char last (); | char last(); | public abstract char last (); |
public abstract char previous (); | char previous(); | public abstract char previous (); |
public static KeyStroke getKeyStroke(String string) { return null; | public static KeyStroke getKeyStroke(char keyChar) { KeyStroke key; key = new KeyStroke(); key.keyChar = keyChar; return key; | public static KeyStroke getKeyStroke(String string) { return null; // TODO } // getKeyStroke() |
public static ResourceBundle getBundle(String baseName, Locale locale) | public static ResourceBundle getBundle(String baseName) | public static ResourceBundle getBundle(String baseName, Locale locale) { ClassLoader cl = security.getCallingClassLoader(); if (cl == null) cl = ClassLoader.getSystemClassLoader(); return getBundle(baseName, locale, cl); } |
return getBundle(baseName, locale, cl); | return getBundle(baseName, Locale.getDefault(), cl); | public static ResourceBundle getBundle(String baseName, Locale locale) { ClassLoader cl = security.getCallingClassLoader(); if (cl == null) cl = ClassLoader.getSystemClassLoader(); return getBundle(baseName, locale, cl); } |
void showDocument(URL url, String target); | void showDocument(URL url); | void showDocument(URL url, String target); |
public ErrorHandler getErrorHandler() { return errorHandler; } | public abstract ErrorHandler getErrorHandler(); | public ErrorHandler getErrorHandler() { return errorHandler; } |
if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(schemaLanguage)) return new gnu.xml.validation.xmlschema.XMLSchemaSchemaFactory(); if (XMLConstants.RELAXNG_NS_URI.equals(schemaLanguage)) return new gnu.xml.validation.relaxng.RELAXNGSchemaFactory(); | public static final SchemaFactory newInstance(String schemaLanguage) { // TODO throw new IllegalArgumentException(schemaLanguage); } |
|
public void setErrorHandler(ErrorHandler errorHandler) { this.errorHandler = errorHandler; } | public abstract void setErrorHandler(ErrorHandler errorHandler); | public void setErrorHandler(ErrorHandler errorHandler) { this.errorHandler = errorHandler; } |
public StreamSource(File file) { setSystemId (file); | public StreamSource() { | public StreamSource(File file) { setSystemId (file); } |
public LinkedHashSet(Collection<? extends T> c) | public LinkedHashSet() | public LinkedHashSet(Collection<? extends T> c) { super(c); } |
super(c); | super(); | public LinkedHashSet(Collection<? extends T> c) { super(c); } |
public LinkedHashMap(int initialCapacity, float loadFactor) | public LinkedHashMap() | public LinkedHashMap(int initialCapacity, float loadFactor) { super(initialCapacity, loadFactor); accessOrder = false; } |
super(initialCapacity, loadFactor); | super(); | public LinkedHashMap(int initialCapacity, float loadFactor) { super(initialCapacity, loadFactor); accessOrder = false; } |
{ | TemplateNode clone(Stylesheet stylesheet) { TemplateNode ret = new TextNode(disableOutputEscaping); if (children != null) { ret.children = children.clone(stylesheet); } if (next != null) { ret.next = next.clone(stylesheet); } return ret; } |
|
} | TemplateNode clone(Stylesheet stylesheet) { TemplateNode ret = new TextNode(disableOutputEscaping); if (children != null) { ret.children = children.clone(stylesheet); } if (next != null) { ret.next = next.clone(stylesheet); } return ret; } |
|
{ | void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { String value = ""; Document doc = (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); if (children != null) { // Create a document fragment to hold the text DocumentFragment fragment = doc.createDocumentFragment(); // Apply children to the fragment children.apply(stylesheet, mode, context, pos, len, fragment, null); // Use XPath string-value of fragment value = Expr.stringValue(fragment); } Text text = doc.createTextNode(value); if (disableOutputEscaping) { text.setUserData("disable-output-escaping", "yes", stylesheet); } // Insert into result tree if (nextSibling != null) { parent.insertBefore(text, nextSibling); } else { parent.appendChild(text); } if (next != null) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } } |
|
} | void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { String value = ""; Document doc = (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); if (children != null) { // Create a document fragment to hold the text DocumentFragment fragment = doc.createDocumentFragment(); // Apply children to the fragment children.apply(stylesheet, mode, context, pos, len, fragment, null); // Use XPath string-value of fragment value = Expr.stringValue(fragment); } Text text = doc.createTextNode(value); if (disableOutputEscaping) { text.setUserData("disable-output-escaping", "yes", stylesheet); } // Insert into result tree if (nextSibling != null) { parent.insertBefore(text, nextSibling); } else { parent.appendChild(text); } if (next != null) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } } |
|
{ | final void apply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { if (stylesheet.terminated) { return; } if (Thread.currentThread().isInterrupted()) { // Try to head off any infinite loops at the pass return; } if (stylesheet.debug) { System.err.println("Applying " + toString()); System.err.println("\twith context=" + context + ", pos=" + pos + ", len=" + len); } doApply(stylesheet, mode, context, pos, len, parent, nextSibling); } |
|
} | final void apply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { if (stylesheet.terminated) { return; } if (Thread.currentThread().isInterrupted()) { // Try to head off any infinite loops at the pass return; } if (stylesheet.debug) { System.err.println("Applying " + toString()); System.err.println("\twith context=" + context + ", pos=" + pos + ", len=" + len); } doApply(stylesheet, mode, context, pos, len, parent, nextSibling); } |
|
public static String stringValue(Node node) | public static String stringValue(Collection nodeSet) | public static String stringValue(Node node) { return stringValue(node, false); } |
return stringValue(node, false); | StringBuffer buf = new StringBuffer(); for (Iterator i = nodeSet.iterator(); i.hasNext(); ) { buf.append(stringValue((Node) i.next())); } return buf.toString(); | public static String stringValue(Node node) { return stringValue(node, false); } |
public RuntimeException(String s) { super(s); | public RuntimeException() { | public RuntimeException(String s) { super(s); } |
setLayout(createLayoutManager()); | public JViewport() { setOpaque(true); setScrollMode(BLIT_SCROLL_MODE); updateUI(); } |
|
if (viewListener == null) viewListener = createViewListener(); v.addComponentListener(viewListener); | public void setView(Component v) { while (getComponentCount() > 0) remove(0); if (v != null) { add(v); fireStateChanged(); } } |
|
for (int i = 0; i < ncomponents; ++i) | Component r = component[index]; ComponentListener[] list = r.getComponentListeners(); for (int j = 0; j < list.length; j++) r.removeComponentListener(list[j]); r.removeNotify(); System.arraycopy(component, index + 1, component, index, ncomponents - index - 1); component[--ncomponents] = null; invalidate(); if (layoutMgr != null) layoutMgr.removeLayoutComponent(r); r.parent = null; if (isShowing ()) | public void remove(Component comp) { synchronized (getTreeLock ()) { for (int i = 0; i < ncomponents; ++i) { if (component[i] == comp) { remove(i); break; } } } } |
public Point(int x, int y) | public Point() | public Point(int x, int y) { this.x = x; this.y = y; } |
this.x = x; this.y = y; | public Point(int x, int y) { this.x = x; this.y = y; } |
|
public static String getAlgorithmProperty(String algName, String propName) { | public static String getAlgorithmProperty(String algName, String propName) { if (algName == null || propName == null) return null; String property = String.valueOf(propName) + "." + String.valueOf(algName); Provider p; for (Iterator i = providers.iterator(); i.hasNext(); ) { p = (Provider) i.next(); for (Iterator j = p.keySet().iterator(); j.hasNext(); ) { String key = (String) j.next(); if (key.equalsIgnoreCase(property)) return p.getProperty(key); } } | public static String getAlgorithmProperty(String algName, String propName) { /* TODO: Figure out what this actually does */ return null; } |
if (p.getName() == name) return p; | if (p.getName().equals(name)) return p; | public static Provider getProvider(String name) { Provider p; int max = providers.size(); for (int i = 0; i < max; i++) { p = (Provider) providers.elementAt(i); if (p.getName() == name) return p; } return null; } |
int max = providers.size(); for (int i = 0; i < max; i++) { if (((Provider) providers.elementAt(i)).getName() == provider .getName()) return -1; | int max = providers.size (); for (int i = 0; i < max; i++) { if (((Provider) providers.elementAt(i)).getName().equals(provider.getName())) return -1; | public static int insertProviderAt(Provider provider, int position) { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkSecurityAccess("insertProvider." + provider.getName()); position--; int max = providers.size(); for (int i = 0; i < max; i++) { if (((Provider) providers.elementAt(i)).getName() == provider .getName()) return -1; } if (position < 0) position = 0; if (position > max) position = max; providers.insertElementAt(provider, position); return position + 1; } |
private static void loadProviders(String baseUrl, String vendor) { if (baseUrl == null || vendor == null) return; | private static boolean loadProviders(String baseUrl, String vendor) { if (baseUrl == null || vendor == null) return false; | private static void loadProviders(String baseUrl, String vendor) { if (baseUrl == null || vendor == null) return; String secfilestr = baseUrl + "/security/" + vendor + ".security"; try { InputStream fin = new URL(secfilestr).openStream(); secprops.load(fin); int i = 1; String name; while ((name = secprops.getProperty("security.provider." + i)) != null) { Exception exception = null; try { providers.addElement(Class.forName(name).newInstance()); } catch (ClassNotFoundException x) { exception = x; } catch (InstantiationException x) { exception = x; } catch (IllegalAccessException x) { exception = x; } if (exception != null) System.err.println("Error loading security provider " + name + ": " + exception); i++; } } catch (FileNotFoundException ignored) { // Actually we probibly shouldn't ignore these, once the security // properties file is actually installed somewhere. } catch (IOException ignored) { } } |
System.err.println("Error loading security provider " | { System.err.println ("WARNING: Error loading security provider " | private static void loadProviders(String baseUrl, String vendor) { if (baseUrl == null || vendor == null) return; String secfilestr = baseUrl + "/security/" + vendor + ".security"; try { InputStream fin = new URL(secfilestr).openStream(); secprops.load(fin); int i = 1; String name; while ((name = secprops.getProperty("security.provider." + i)) != null) { Exception exception = null; try { providers.addElement(Class.forName(name).newInstance()); } catch (ClassNotFoundException x) { exception = x; } catch (InstantiationException x) { exception = x; } catch (IllegalAccessException x) { exception = x; } if (exception != null) System.err.println("Error loading security provider " + name + ": " + exception); i++; } } catch (FileNotFoundException ignored) { // Actually we probibly shouldn't ignore these, once the security // properties file is actually installed somewhere. } catch (IOException ignored) { } } |
} catch (FileNotFoundException ignored) { } catch (IOException ignored) { | private static void loadProviders(String baseUrl, String vendor) { if (baseUrl == null || vendor == null) return; String secfilestr = baseUrl + "/security/" + vendor + ".security"; try { InputStream fin = new URL(secfilestr).openStream(); secprops.load(fin); int i = 1; String name; while ((name = secprops.getProperty("security.provider." + i)) != null) { Exception exception = null; try { providers.addElement(Class.forName(name).newInstance()); } catch (ClassNotFoundException x) { exception = x; } catch (InstantiationException x) { exception = x; } catch (IllegalAccessException x) { exception = x; } if (exception != null) System.err.println("Error loading security provider " + name + ": " + exception); i++; } } catch (FileNotFoundException ignored) { // Actually we probibly shouldn't ignore these, once the security // properties file is actually installed somewhere. } catch (IOException ignored) { } } |
|
catch (IOException ignored) { result = false; } return result; | private static void loadProviders(String baseUrl, String vendor) { if (baseUrl == null || vendor == null) return; String secfilestr = baseUrl + "/security/" + vendor + ".security"; try { InputStream fin = new URL(secfilestr).openStream(); secprops.load(fin); int i = 1; String name; while ((name = secprops.getProperty("security.provider." + i)) != null) { Exception exception = null; try { providers.addElement(Class.forName(name).newInstance()); } catch (ClassNotFoundException x) { exception = x; } catch (InstantiationException x) { exception = x; } catch (IllegalAccessException x) { exception = x; } if (exception != null) System.err.println("Error loading security provider " + name + ": " + exception); i++; } } catch (FileNotFoundException ignored) { // Actually we probibly shouldn't ignore these, once the security // properties file is actually installed somewhere. } catch (IOException ignored) { } } |
|
Provider p = null; int max = providers.size(); for (int i = 0; i < max; i++) { if (((Provider) providers.elementAt(i)).getName() == name) { | int max = providers.size (); for (int i = 0; i < max; i++) { if (((Provider) providers.elementAt(i)).getName().equals(name)) { | public static void removeProvider(String name) { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkSecurityAccess("removeProvider." + name); Provider p = null; int max = providers.size(); for (int i = 0; i < max; i++) { if (((Provider) providers.elementAt(i)).getName() == name) { providers.remove(i); break; } } } |
return getProperty(key, null); | Properties prop = this; do { String value = (String) prop.get(key); if (value != null) return value; prop = prop.defaults; } while (prop != null); return null; | public String getProperty(String key) { return getProperty(key, null); } |
public InvalidParameterException(String msg) | public InvalidParameterException() | public InvalidParameterException(String msg) { super(msg); } |
super(msg); | public InvalidParameterException(String msg) { super(msg); } |
|
public <T> T[] toArray(T[] a) | public Object[] toArray() | public <T> T[] toArray(T[] a) { int size = size(); if (a.length < size) a = (T[]) Array.newInstance(a.getClass().getComponentType(), size); else if (a.length > size) a[size] = null; Iterator<E> itr = iterator(); for (int pos = 0; pos < size; pos++) { try { a[pos] = (T) (itr.next()); } catch (ClassCastException exception) { throw new ArrayStoreException("The element is of the wrong type "+ "for storing in this array."); } } return a; } |
if (a.length < size) a = (T[]) Array.newInstance(a.getClass().getComponentType(), size); else if (a.length > size) a[size] = null; Iterator<E> itr = iterator(); | Object[] a = new Object[size]; | public <T> T[] toArray(T[] a) { int size = size(); if (a.length < size) a = (T[]) Array.newInstance(a.getClass().getComponentType(), size); else if (a.length > size) a[size] = null; Iterator<E> itr = iterator(); for (int pos = 0; pos < size; pos++) { try { a[pos] = (T) (itr.next()); } catch (ClassCastException exception) { throw new ArrayStoreException("The element is of the wrong type "+ "for storing in this array."); } } return a; } |
{ try { a[pos] = (T) (itr.next()); } catch (ClassCastException exception) { throw new ArrayStoreException("The element is of the wrong type "+ "for storing in this array."); } } | a[pos] = itr.next(); | public <T> T[] toArray(T[] a) { int size = size(); if (a.length < size) a = (T[]) Array.newInstance(a.getClass().getComponentType(), size); else if (a.length > size) a[size] = null; Iterator<E> itr = iterator(); for (int pos = 0; pos < size; pos++) { try { a[pos] = (T) (itr.next()); } catch (ClassCastException exception) { throw new ArrayStoreException("The element is of the wrong type "+ "for storing in this array."); } } return a; } |
public final InputStream openStream() throws IOException { | public InputStream openStream() throws IOException { | public final InputStream openStream() throws IOException { return openConnection().getInputStream(); } |
if (line == null) line = ""; | public void load(InputStream inStream) throws IOException { // The spec says that the file must be encoded using ISO-8859-1. BufferedReader reader = new BufferedReader(new InputStreamReader(inStream, "ISO-8859-1")); String line; while ((line = reader.readLine()) != null) { char c = 0; int pos = 0; // Leading whitespaces must be deleted first. while (pos < line.length() && Character.isWhitespace(c = line.charAt(pos))) pos++; // If empty line or begins with a comment character, skip this line. if ((line.length() - pos) == 0 || line.charAt(pos) == '#' || line.charAt(pos) == '!') continue; // The characters up to the next Whitespace, ':', or '=' // describe the key. But look for escape sequences. StringBuffer key = new StringBuffer(); while (pos < line.length() && ! Character.isWhitespace(c = line.charAt(pos++)) && c != '=' && c != ':') { if (c == '\\') { if (pos == line.length()) { // The line continues on the next line. line = reader.readLine(); pos = 0; while (pos < line.length() && Character.isWhitespace(c = line.charAt(pos))) pos++; } else { c = line.charAt(pos++); switch (c) { case 'n': key.append('\n'); break; case 't': key.append('\t'); break; case 'r': key.append('\r'); break; case 'u': if (pos + 4 <= line.length()) { char uni = (char) Integer.parseInt (line.substring(pos, pos + 4), 16); key.append(uni); pos += 4; } // else throw exception? break; default: key.append(c); break; } } } else key.append(c); } boolean isDelim = (c == ':' || c == '='); while (pos < line.length() && Character.isWhitespace(c = line.charAt(pos))) pos++; if (! isDelim && (c == ':' || c == '=')) { pos++; while (pos < line.length() && Character.isWhitespace(c = line.charAt(pos))) pos++; } StringBuffer element = new StringBuffer(line.length() - pos); while (pos < line.length()) { c = line.charAt(pos++); if (c == '\\') { if (pos == line.length()) { // The line continues on the next line. line = reader.readLine(); // We might have seen a backslash at the end of // the file. The JDK ignores the backslash in // this case, so we follow for compatibility. if (line == null) break; pos = 0; while (pos < line.length() && Character.isWhitespace(c = line.charAt(pos))) pos++; element.ensureCapacity(line.length() - pos + element.length()); } else { c = line.charAt(pos++); switch (c) { case 'n': element.append('\n'); break; case 't': element.append('\t'); break; case 'r': element.append('\r'); break; case 'u': if (pos + 4 <= line.length()) { char uni = (char) Integer.parseInt (line.substring(pos, pos + 4), 16); element.append(uni); pos += 4; } // else throw exception? break; default: element.append(c); break; } } } else element.append(c); } put(key.toString(), element.toString()); } } |
|
public synchronized T remove(int index) | public boolean remove(Object o) | public synchronized T remove(int index) { checkBoundExclusive(index); T temp = elementData[index]; modCount++; elementCount--; if (index < elementCount) System.arraycopy(elementData, index + 1, elementData, index, elementCount - index); elementData[elementCount] = null; return temp; } |
checkBoundExclusive(index); T temp = elementData[index]; modCount++; elementCount--; if (index < elementCount) System.arraycopy(elementData, index + 1, elementData, index, elementCount - index); elementData[elementCount] = null; return temp; | return removeElement(o); | public synchronized T remove(int index) { checkBoundExclusive(index); T temp = elementData[index]; modCount++; elementCount--; if (index < elementCount) System.arraycopy(elementData, index + 1, elementData, index, elementCount - index); elementData[elementCount] = null; return temp; } |
public final VmArrayClass getArrayClass() { return getArrayClass(null); | final VmArrayClass getArrayClass(String arrayClassName) { if (arrayClass == null) { arrayClass = createArrayClass(true, arrayClassName); } else { arrayClass.link(); } return arrayClass; | public final VmArrayClass getArrayClass() { return getArrayClass(null); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.