bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
public final void resolve() throws PluginException { if (!resolved) { for (int i = 0; i < extensions.length; i++) { extensions[i].resolve(); } for (int i = 0; i < extensionPoints.length; i++) { extensionPoints[i].resolve(); } for (int i = 0; i < requires.length; i++) { requires[i].resolve(); } if (runtime != null) { runtime.resolve(); } resolved = true; } }
public final void resolve() throws PluginException { if (!resolved) { for (int i = 0; i < extensions.length; i++) { extensions[i].resolve(); } for (int i = 0; i < extensionPoints.length; i++) { extensionPoints[i].resolve(); } for (int i = 0; i < requires.length; i++) { requires[i].resolve(registry); } if (runtime != null) { runtime.resolve(); } resolved = true; } }
8,833
public final void resolve() throws PluginException { if (!resolved) { for (int i = 0; i < extensions.length; i++) { extensions[i].resolve(); } for (int i = 0; i < extensionPoints.length; i++) { extensionPoints[i].resolve(); } for (int i = 0; i < requires.length; i++) { requires[i].resolve(); } if (runtime != null) { runtime.resolve(); } resolved = true; } }
public final void resolve() throws PluginException { if (!resolved) { for (int i = 0; i < extensions.length; i++) { extensions[i].resolve(); } for (int i = 0; i < extensionPoints.length; i++) { extensionPoints[i].resolve(); } for (int i = 0; i < requires.length; i++) { requires[i].resolve(); } if (runtime != null) { runtime.resolve(registry); } resolved = true; } }
8,834
final void startPlugin() throws PluginException { if (started) { return; } synchronized (this) { if (started || starting) { return; } starting = true; //BootLog.info("Resolve on plugin " + getId()); try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; } }); } catch (PrivilegedActionException ex) { BootLog.error("Error starting plugin", ex); try { Thread.sleep(10000); } catch (InterruptedException ex1) { // Ignore } } finally { started = true; } } }
final void startPlugin(final PluginRegistryModel registry) throws PluginException { if (started) { return; } synchronized (this) { if (started || starting) { return; } starting = true; //BootLog.info("Resolve on plugin " + getId()); try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; } }); } catch (PrivilegedActionException ex) { BootLog.error("Error starting plugin", ex); try { Thread.sleep(10000); } catch (InterruptedException ex1) { // Ignore } } finally { started = true; } } }
8,835
final void startPlugin() throws PluginException { if (started) { return; } synchronized (this) { if (started || starting) { return; } starting = true; //BootLog.info("Resolve on plugin " + getId()); try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; } }); } catch (PrivilegedActionException ex) { BootLog.error("Error starting plugin", ex); try { Thread.sleep(10000); } catch (InterruptedException ex1) { // Ignore } } finally { started = true; } } }
final void startPlugin() throws PluginException { if (started) { return; } synchronized (this) { if (started || starting) { return; } starting = true; //BootLog.info("Resolve on plugin " + getId()); try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws PluginException { resolve(registry); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; } }); } catch (PrivilegedActionException ex) { BootLog.error("Error starting plugin", ex); try { Thread.sleep(10000); } catch (InterruptedException ex1) { // Ignore } } finally { started = true; } } }
8,836
final void startPlugin() throws PluginException { if (started) { return; } synchronized (this) { if (started || starting) { return; } starting = true; //BootLog.info("Resolve on plugin " + getId()); try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; } }); } catch (PrivilegedActionException ex) { BootLog.error("Error starting plugin", ex); try { Thread.sleep(10000); } catch (InterruptedException ex1) { // Ignore } } finally { started = true; } } }
final void startPlugin() throws PluginException { if (started) { return; } synchronized (this) { if (started || starting) { return; } starting = true; //BootLog.info("Resolve on plugin " + getId()); try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(registry); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; } }); } catch (PrivilegedActionException ex) { BootLog.error("Error starting plugin", ex); try { Thread.sleep(10000); } catch (InterruptedException ex1) { // Ignore } } finally { started = true; } } }
8,837
public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; }
public Object run() throws PluginException { resolve(registry); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; }
8,838
public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; }
public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(registry); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; }
8,839
protected void unresolve() throws PluginException { if (resolved) { if (runtime != null) { runtime.unresolve(); } for (int i = 0; i < requires.length; i++) { requires[i].unresolve(); } for (int i = 0; i < extensionPoints.length; i++) { extensionPoints[i].unresolve(); } for (int i = 0; i < extensions.length; i++) { extensions[i].unresolve(); } resolved = false; } }
protected void unresolve() throws PluginException { if (resolved) { if (runtime != null) { runtime.unresolve(); } for (int i = 0; i < requires.length; i++) { requires[i].unresolve(); } for (int i = 0; i < extensionPoints.length; i++) { extensionPoints[i].unresolve(); } for (int i = 0; i < extensions.length; i++) { extensions[i].unresolve(); } resolved = false; } }
8,840
public void startSystemPlugins() throws PluginException { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(START_SYSTEM_PLUGINS_PERM); } // Resolve all plugins ((PluginRegistryModel) registry).resolveDescriptors(); // Set the context classloader Thread.currentThread().setContextClassLoader( registry.getPluginsClassLoader()); // Start the plugins final String cmdLine = (String)AccessController.doPrivileged(new GetPropertyAction("jnode.cmdline", "")); final boolean debug = (cmdLine.indexOf("debug") > 0); final List descrList = createPluginDescriptorList(); // 2 loops, first start all system plugins, // then start all auto-start plugins for (int type = 0; type < 2; type++) { for (Iterator i = descrList.iterator(); i.hasNext();) { final PluginDescriptor descr = (PluginDescriptor) i.next(); try { final boolean start; if (type == 0) { start = descr.isSystemPlugin(); } else { start = (!descr.isSystemPlugin()) && descr.isAutoStart(); } if (start) { if (debug) { Thread.sleep(250); } startSinglePlugin(descr.getPlugin()); } } catch (Throwable ex) { BootLog.error("Cannot start " + descr.getId(), ex); if (debug) { try { Thread.sleep(5000); } catch (InterruptedException ex1) { // Ignore } } } } } // Wait a while until all plugins have finished their startup process if (!isStartPluginsFinished()) { BootLog.info("Waiting for plugins to finished their startprocess"); final long start = System.currentTimeMillis(); long now = start; int loop = 0; while (!isStartPluginsFinished() && (now - start < START_TIMEOUT)) { try { if (++loop == 10) { System.out.print('.'); loop = 0; } Thread.sleep(100); } catch (InterruptedException ex) { // Ignore } now = System.currentTimeMillis(); } System.out.println(); if (now >= START_TIMEOUT) { // List all non-finished plugins listUnfinishedPlugins(); } } }
public void startSystemPlugins(List descriptors) throws PluginException { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(START_SYSTEM_PLUGINS_PERM); } // Resolve all plugins ((PluginRegistryModel) registry).resolveDescriptors(); // Set the context classloader Thread.currentThread().setContextClassLoader( registry.getPluginsClassLoader()); // Start the plugins final String cmdLine = (String)AccessController.doPrivileged(new GetPropertyAction("jnode.cmdline", "")); final boolean debug = (cmdLine.indexOf("debug") > 0); final List descrList = createPluginDescriptorList(); // 2 loops, first start all system plugins, // then start all auto-start plugins for (int type = 0; type < 2; type++) { for (Iterator i = descrList.iterator(); i.hasNext();) { final PluginDescriptor descr = (PluginDescriptor) i.next(); try { final boolean start; if (type == 0) { start = descr.isSystemPlugin(); } else { start = (!descr.isSystemPlugin()) && descr.isAutoStart(); } if (start) { if (debug) { Thread.sleep(250); } startSinglePlugin(descr.getPlugin()); } } catch (Throwable ex) { BootLog.error("Cannot start " + descr.getId(), ex); if (debug) { try { Thread.sleep(5000); } catch (InterruptedException ex1) { // Ignore } } } } } // Wait a while until all plugins have finished their startup process if (!isStartPluginsFinished()) { BootLog.info("Waiting for plugins to finished their startprocess"); final long start = System.currentTimeMillis(); long now = start; int loop = 0; while (!isStartPluginsFinished() && (now - start < START_TIMEOUT)) { try { if (++loop == 10) { System.out.print('.'); loop = 0; } Thread.sleep(100); } catch (InterruptedException ex) { // Ignore } now = System.currentTimeMillis(); } System.out.println(); if (now >= START_TIMEOUT) { // List all non-finished plugins listUnfinishedPlugins(); } } }
8,841
private final void emmitMOV() { int addr = getAddressingMode(2); switch (addr) { case RR_ADDR: X86Register r1 = X86Register.getRegister(((Register) args[0]).name); X86Register r2 = X86Register.getRegister(((Register) args[1]).name); if (r1 instanceof GPR && r2 instanceof GPR) { stream.writeMOV(operandSize, (GPR) r1, (GPR) r2); } else if (r1 instanceof CRX && r2 instanceof GPR) { stream.writeMOV((CRX) r1, (GPR) r2); } else if (r1 instanceof GPR && r2 instanceof CRX) { stream.writeMOV((GPR) r1, (CRX) r2); } else if (r1 instanceof SR && r2 instanceof GPR) { stream.writeMOV((SR) r1, (GPR) r2); } else if (r1 instanceof GPR && r2 instanceof SR) { stream.writeMOV((GPR) r1, (SR) r2); } else { throw new IllegalArgumentException("Invalid register usage: mov " + r1 + "," + r2); } break; case RC_ADDR: stream.writeMOV_Const(getReg(0), getInt(1)); break; case RE_ADDR: Address ind = getAddress(1); stream.writeMOV(operandSize, getReg(0), getRegister(ind.getImg()), ind.disp); break; case ER_ADDR: ind = getAddress(0); stream.writeMOV(operandSize, getRegister(ind.getImg()), ind.disp, getReg(1)); break; case EC_ADDR: ind = getAddress(0); stream.writeMOV_Const(operandSize, getRegister(ind.getImg()), ind.disp, getInt(1)); break; default: reportAddressingError(MOV_ISN, addr); } }
private final void emmitMOV() { int addr = getAddressingMode(2); switch (addr) { case RR_ADDR: X86Register r1 = X86Register.getRegister(((Register) args[0]).name); X86Register r2 = X86Register.getRegister(((Register) args[1]).name); if (r1 instanceof GPR && r2 instanceof GPR) { int s1 = r1.getSize(); int s2 = r2.getSize(); if(s1 != s2){ throw new IllegalArgumentException("Incompatible register pair: " + r1 + "," + r2); } stream.writeMOV(s1, (GPR) r1, (GPR) r2); } else if (r1 instanceof CRX && r2 instanceof GPR) { stream.writeMOV((CRX) r1, (GPR) r2); } else if (r1 instanceof GPR && r2 instanceof CRX) { stream.writeMOV((GPR) r1, (CRX) r2); } else if (r1 instanceof SR && r2 instanceof GPR) { stream.writeMOV((SR) r1, (GPR) r2); } else if (r1 instanceof GPR && r2 instanceof SR) { stream.writeMOV((GPR) r1, (SR) r2); } else { throw new IllegalArgumentException("Invalid register usage: mov " + r1 + "," + r2); } break; case RC_ADDR: stream.writeMOV_Const(getReg(0), getInt(1)); break; case RE_ADDR: Address ind = getAddress(1); stream.writeMOV(operandSize, getReg(0), getRegister(ind.getImg()), ind.disp); break; case ER_ADDR: ind = getAddress(0); stream.writeMOV(operandSize, getRegister(ind.getImg()), ind.disp, getReg(1)); break; case EC_ADDR: ind = getAddress(0); stream.writeMOV_Const(operandSize, getRegister(ind.getImg()), ind.disp, getInt(1)); break; default: reportAddressingError(MOV_ISN, addr); } }
8,849
private final void emmitMOV() { int addr = getAddressingMode(2); switch (addr) { case RR_ADDR: X86Register r1 = X86Register.getRegister(((Register) args[0]).name); X86Register r2 = X86Register.getRegister(((Register) args[1]).name); if (r1 instanceof GPR && r2 instanceof GPR) { stream.writeMOV(operandSize, (GPR) r1, (GPR) r2); } else if (r1 instanceof CRX && r2 instanceof GPR) { stream.writeMOV((CRX) r1, (GPR) r2); } else if (r1 instanceof GPR && r2 instanceof CRX) { stream.writeMOV((GPR) r1, (CRX) r2); } else if (r1 instanceof SR && r2 instanceof GPR) { stream.writeMOV((SR) r1, (GPR) r2); } else if (r1 instanceof GPR && r2 instanceof SR) { stream.writeMOV((GPR) r1, (SR) r2); } else { throw new IllegalArgumentException("Invalid register usage: mov " + r1 + "," + r2); } break; case RC_ADDR: stream.writeMOV_Const(getReg(0), getInt(1)); break; case RE_ADDR: Address ind = getAddress(1); stream.writeMOV(operandSize, getReg(0), getRegister(ind.getImg()), ind.disp); break; case ER_ADDR: ind = getAddress(0); stream.writeMOV(operandSize, getRegister(ind.getImg()), ind.disp, getReg(1)); break; case EC_ADDR: ind = getAddress(0); stream.writeMOV_Const(operandSize, getRegister(ind.getImg()), ind.disp, getInt(1)); break; default: reportAddressingError(MOV_ISN, addr); } }
private final void emmitMOV() { int addr = getAddressingMode(2); switch (addr) { case RR_ADDR: X86Register r1 = X86Register.getRegister(((Register) args[0]).name); X86Register r2 = X86Register.getRegister(((Register) args[1]).name); if (r1 instanceof GPR && r2 instanceof GPR) { stream.writeMOV(operandSize, (GPR) r1, (GPR) r2); } else if (r1 instanceof CRX && r2 instanceof GPR) { stream.writeMOV((CRX) r1, (GPR) r2); } else if (r1 instanceof GPR && r2 instanceof CRX) { stream.writeMOV((GPR) r1, (CRX) r2); } else if (r1 instanceof SR && r2 instanceof GPR) { stream.writeMOV((SR) r1, (GPR) r2); } else if (r1 instanceof GPR && r2 instanceof SR) { stream.writeMOV((GPR) r1, (SR) r2); } else { throw new IllegalArgumentException("Invalid register usage: mov " + r1 + "," + r2); } break; case RC_ADDR: stream.writeMOV_Const(getReg(0), getInt(1)); break; case RE_ADDR: Address ind = getAddress(1); stream.writeMOV(r.getSize(), r, getRegister(ind.getImg()), ind.disp); break; case RA_ADDR: stream.writeMOV(getReg(0), getAddress(1).disp); break; case ER_ADDR: ind = getAddress(0); stream.writeMOV(operandSize, getRegister(ind.getImg()), ind.disp, getReg(1)); break; case EC_ADDR: ind = getAddress(0); stream.writeMOV_Const(operandSize, getRegister(ind.getImg()), ind.disp, getInt(1)); break; default: reportAddressingError(MOV_ISN, addr); } }
8,850
private final void emmitXCHG() { int addr = getAddressingMode(2); switch (addr) { case RR_ADDR: stream.writeXCHG(getReg(0), getReg(1)); break; case ER_ADDR: Address ind = getAddress(0); stream.writeXCHG(getRegister(ind.getImg()), ind.disp, getReg(1)); break; default: reportAddressingError(XCHG_ISN, addr); } }
private final void emmitXCHG() { int addr = getAddressingMode(2); switch (addr) { case RR_ADDR: stream.writeXCHG(getReg(0), getReg(1)); break; case ER_ADDR: ind = getAddress(0); stream.writeXCHG(getRegister(ind.getImg()), ind.disp, getReg(1)); break; default: reportAddressingError(XCHG_ISN, addr); } }
8,855
private int getAddressingMode(int maxArgs) { int ret = N_ADDR; if (maxArgs > 3) { throw new Error("Invalid number of arguments: " + maxArgs); } for (int i = 0; i < maxArgs; i++) { try { if (operands == null) break; Object o = operands.get(i); if (o == null) break; if (o instanceof Integer) { ret |= CON_ARG << DISP * i; } else if (o instanceof Register) { ret |= REG_ARG << DISP * i; } else if (o instanceof Address) { Address ind = (Address) o; if (ind.reg != null && ind.sreg != null) { ret |= SCL_ARG << DISP * i; } else if (ind.reg != null && ind.sreg == null) { ret |= REL_ARG << DISP * i; } else if (ind.reg == null && ind.sreg != null) { ret |= ZSC_ARG << DISP * i; } else if (ind.reg == null && ind.sreg == null) { ret |= ABS_ARG << DISP * i; } else { throw new IllegalArgumentException("Unknown indirect: " + ind); } } else { throw new IllegalArgumentException("Unknown operand: " + o + " " + o.getClass().getName()); } args[i] = o; } catch (IndexOutOfBoundsException x) { break; } } return ret; }
private int getAddressingMode(int maxArgs) { int ret = N_ADDR; if (maxArgs > 3) { throw new Error("Invalid number of arguments: " + maxArgs); } for (int i = 0; i < maxArgs; i++) { try { if (operands == null) break; Object o = operands.get(i); if (o == null) break; if (o instanceof Integer) { ret |= CON_ARG << DISP * i; } else if (o instanceof Register) { ret |= REG_ARG << DISP * i; } else if (o instanceof Address) { Address ind = (Address) o; if (ind.segment){ ret |= SEG_ARG << DISP * i; } else if (ind.reg != null && ind.sreg != null) { ret |= SCL_ARG << DISP * i; } else if (ind.reg != null && ind.sreg == null) { ret |= REL_ARG << DISP * i; } else if (ind.reg == null && ind.sreg != null) { ret |= ZSC_ARG << DISP * i; } else if (ind.reg == null && ind.sreg == null) { ret |= ABS_ARG << DISP * i; } else { throw new IllegalArgumentException("Unknown indirect: " + ind); } } else { throw new IllegalArgumentException("Unknown operand: " + o + " " + o.getClass().getName()); } args[i] = o; } catch (IndexOutOfBoundsException x) { break; } } return ret; }
8,857
public Error(String s) { super(s); }
public Error() { super(s); }
8,858
public Error(String s) { super(s); }
public Error(String s) { }
8,859
public static ActionListener add(ActionListener a, ActionListener b) { return (ActionListener) addInternal(a, b); }
public static ComponentListener add(ComponentListener a, ComponentListener b) { return (ActionListener) addInternal(a, b); }
8,860
public static ActionListener add(ActionListener a, ActionListener b) { return (ActionListener) addInternal(a, b); }
public static ActionListener add(ActionListener a, ActionListener b) { return (ComponentListener) addInternal(a, b); }
8,861
public static ActionListener remove(ActionListener l, ActionListener oldl) { return (ActionListener) removeInternal(l, oldl); }
protected EventListener remove(EventListener oldl) { return (ActionListener) removeInternal(l, oldl); }
8,862
public static ActionListener remove(ActionListener l, ActionListener oldl) { return (ActionListener) removeInternal(l, oldl); }
public static ActionListener remove(ActionListener l, ActionListener oldl) { if (a == oldl) return b; if (b == oldl) return a; if (a instanceof AWTEventMulticaster) { EventListener newa = ((AWTEventMulticaster) a).remove(oldl); if (newa != a) return new AWTEventMulticaster(newa, b); } if (b instanceof AWTEventMulticaster) { EventListener newb = ((AWTEventMulticaster) b).remove(oldl); if (newb != b) return new AWTEventMulticaster(a, newb); } return this; }
8,863
public abstract byte get ();
public ByteBuffer get (byte[] dst, int offset, int length) { checkArraySize(dst.length, offset, length); checkForUnderflow(length); for (int i = offset; i < offset + length; i++) { dst [i] = get (); } return this; }
8,864
public abstract int get (int index);
public IntBuffer get (int[] dst, int offset, int length) { checkArraySize(dst.length, offset, length); checkForUnderflow(length); for (int i = offset; i < offset + length; i++) { dst [i] = get (); } return this; }
8,865
public abstract char get (int index);
public CharBuffer get (char[] dst, int offset, int length) { checkArraySize(dst.length, offset, length); checkForUnderflow(length); for (int i = offset; i < offset + length; i++) { dst [i] = get (); } return this; }
8,866
public abstract short get (int index);
public ShortBuffer get (short[] dst, int offset, int length) { checkArraySize(dst.length, offset, length); checkForUnderflow(length); for (int i = offset; i < offset + length; i++) { dst [i] = get (); } return this; }
8,867
public static NumberFormat getInstance (Locale loc) { // For now always return a number instance. return getNumberInstance (loc); }
public static final NumberFormat getInstance () { // For now always return a number instance. return getNumberInstance (loc); }
8,868
public static NumberFormat getInstance (Locale loc) { // For now always return a number instance. return getNumberInstance (loc); }
public static NumberFormat getInstance (Locale loc) { // For now always return a number instance. return getInstance (Locale.getDefault()); }
8,869
public static NumberFormat getCurrencyInstance (Locale loc) { return computeInstance (loc, "currencyFormat", "$#,##0.00;($#,##0.00)"); }
public static final NumberFormat getCurrencyInstance () { return computeInstance (loc, "currencyFormat", "$#,##0.00;($#,##0.00)"); }
8,870
public static NumberFormat getCurrencyInstance (Locale loc) { return computeInstance (loc, "currencyFormat", "$#,##0.00;($#,##0.00)"); }
public static NumberFormat getCurrencyInstance (Locale loc) { return getCurrencyInstance (Locale.getDefault()); }
8,871
public static NumberFormat getPercentInstance (Locale loc) { return computeInstance (loc, "percentFormat", "#,##0%"); }
public static final NumberFormat getPercentInstance () { return computeInstance (loc, "percentFormat", "#,##0%"); }
8,872
public static NumberFormat getPercentInstance (Locale loc) { return computeInstance (loc, "percentFormat", "#,##0%"); }
public static NumberFormat getPercentInstance (Locale loc) { return getPercentInstance (Locale.getDefault()); }
8,873
public static NumberFormat getNumberInstance (Locale loc) { return computeInstance (loc, "numberFormat", "#,##0.###"); }
public static final NumberFormat getNumberInstance () { return computeInstance (loc, "numberFormat", "#,##0.###"); }
8,874
public static NumberFormat getNumberInstance (Locale loc) { return computeInstance (loc, "numberFormat", "#,##0.###"); }
public static NumberFormat getNumberInstance (Locale loc) { return getNumberInstance (Locale.getDefault()); }
8,875
public static final DateFormat getDateInstance (int style, Locale loc) { return computeInstance (style, loc, true, false); }
public static final DateFormat getDateInstance () { return computeInstance (style, loc, true, false); }
8,876
public static final DateFormat getDateInstance (int style, Locale loc) { return computeInstance (style, loc, true, false); }
public static final DateFormat getDateInstance (int style, Locale loc) { return getDateInstance (DEFAULT, Locale.getDefault()); }
8,877
public void applyPattern(String pattern) { tokens = new Vector(); compileFormat(pattern); this.pattern = pattern; }
public void applyPattern(String pattern) { tokens = new ArrayList(); compileFormat(pattern); this.pattern = pattern; }
8,878
public FieldPosition (int field_id) { this.field_id = field_id; }
public FieldPosition (Format.Field field) { this.field_id = field_id; }
8,879
public FieldPosition (int field_id) { this.field_id = field_id; }
public FieldPosition (int field_id) { this(field, -1); }
8,880
public abstract StringBuffer format (Object obj, StringBuffer sb, FieldPosition pos) throws IllegalArgumentException;
public abstract StringBuffer format (Object obj, StringBuffer sb, FieldPosition pos) throws IllegalArgumentException;
8,881
public synchronized StringBuffer append(String str) { if (str == null) str = "null"; int len = str.count; ensureCapacity_unsynchronized(count + len); str.getChars(0, len, value, count); count += len; return this; }
public StringBuffer append(Object obj) { if (str == null) str = "null"; int len = str.count; ensureCapacity_unsynchronized(count + len); str.getChars(0, len, value, count); count += len; return this; }
8,882
public synchronized StringBuffer append(String str) { if (str == null) str = "null"; int len = str.count; ensureCapacity_unsynchronized(count + len); str.getChars(0, len, value, count); count += len; return this; }
public synchronized StringBuffer append(String str) { if (str == null) str = "null"; int len = str.count; ensureCapacity_unsynchronized(count + len); str.getChars(0, len, value, count); count += len; return this; }
8,883
public void append (String text) { append (text, null); }
public void append (AttributedCharacterIterator iterator) { append (text, null); }
8,884
public void append (String text) { append (text, null); }
public void append (String text) { char c = iterator.first(); Vector more_ranges = new Vector(); Vector more_attributes = new Vector(); do { formattedString = formattedString + String.valueOf (c); more_attributes.add (iterator.getAttributes()); more_ranges.add (new Integer (formattedString.length())); c = iterator.next(); } while (c != DONE); HashMap[] new_attributes = new HashMap[attributes.length + more_attributes.size()]; int[] new_ranges = new int[ranges.length + more_ranges.size()]; System.arraycopy (attributes, 0, new_attributes, 0, attributes.length); System.arraycopy (more_attributes.toArray(), 0, new_attributes, attributes.length, more_attributes.size()); System.arraycopy (ranges, 0, new_ranges, 0, ranges.length); Object[] new_ranges_array = more_ranges.toArray(); for (int i = 0; i < more_ranges.size();i++) new_ranges[i+ranges.length] = ((Integer) new_ranges_array[i]).intValue(); attributes = new_attributes; ranges = new_ranges; }
8,885
public abstract Object parseObject (String str, ParsePosition pos);
public Object parseObject (String str) throws ParseException { ParsePosition pos = new ParsePosition(0); Object result = parseObject (str, pos); if (result == null) { int index = pos.getErrorIndex(); if (index < 0) index = pos.getIndex(); throw new ParseException("parseObject failed", index); } return result; }
8,886
public abstract int getBeginIndex ();
int getBeginIndex();
8,887
public abstract int getEndIndex ();
int getEndIndex();
8,888
getAllAttributeKeys();
Set getAllAttributeKeys();
8,889
public abstract char setIndex (int index) throws IllegalArgumentException;
char setIndex (int index) throws IllegalArgumentException;
8,890
public ArrayList() { this(DEFAULT_CAPACITY); }
public ArrayList(int capacity) { this(DEFAULT_CAPACITY); }
8,891
public ArrayList() { this(DEFAULT_CAPACITY); }
public ArrayList() { if (capacity < 0) throw new IllegalArgumentException(); data = (E[]) new Object[capacity]; }
8,892
getRunLimit(AttributedCharacterIterator.Attribute attrib);
int getRunLimit();
8,893
getRunStart(AttributedCharacterIterator.Attribute attrib);
int getRunStart();
8,894
public abstract int getIndex ();
int getIndex();
8,895
getAttribute(AttributedCharacterIterator.Attribute attrib);
Object getAttribute (AttributedCharacterIterator.Attribute attrib);
8,896
public abstract char next ();
char next();
8,897
public <T> T[] toArray(T[] a) { if (a.length < size) a = (T[]) Array.newInstance(a.getClass().getComponentType(), size); else if (a.length > size) a[size] = null; System.arraycopy(data, 0, a, 0, size); return a; }
public Object[] toArray() { if (a.length < size) a = (T[]) Array.newInstance(a.getClass().getComponentType(), size); else if (a.length > size) a[size] = null; System.arraycopy(data, 0, a, 0, size); return a; }
8,898
public <T> T[] toArray(T[] a) { if (a.length < size) a = (T[]) Array.newInstance(a.getClass().getComponentType(), size); else if (a.length > size) a[size] = null; System.arraycopy(data, 0, a, 0, size); return a; }
public <T> T[] toArray(T[] a) { if (a.length < size) a = (T[]) Array.newInstance(a.getClass().getComponentType(), size); else if (a.length > size) a[size] = null; System.arraycopy(data, 0, a, 0, size); return a; }
8,899
public static File createTempFile(String prefix, String suffix) throws IOException { return createTempFile(prefix, suffix, null); }
public static synchronized File createTempFile(String prefix, String suffix, File directory) throws IOException { return createTempFile(prefix, suffix, null); }
8,900
public static File createTempFile(String prefix, String suffix) throws IOException { return createTempFile(prefix, suffix, null); }
public static File createTempFile(String prefix, String suffix) throws IOException { 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; }
8,901
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 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 { String currentDir = System.getProperty("user.dir"); if (currentDir.endsWith(separator)) return currentDir + path; else return currentDir + separator + path; } }
8,902
public String[] list() { return list(null); }
public String[] list(FilenameFilter filter) { return list(null); }
8,903
public String[] list() { return list(null); }
public String[] list() { checkRead(); if (!exists() || !isDirectory()) return null; String files[] = VMFile.list(path); if (files == null) return null; if (filter == null) return files; int count = 0; for (int i = 0; i < files.length; i++) { if (filter.accept(this, files[i])) ++count; else files[i] = null; } String[] retfiles = new String[count]; count = 0; for (int i = 0; i < files.length; i++) if (files[i] != null) retfiles[count++] = files[i]; return retfiles; }
8,904
public void checkWrite(String filename) { checkPermission(new FilePermission(filename, "write")); }
public void checkWrite(FileDescriptor desc) { checkPermission(new FilePermission(filename, "write")); }
8,905
public void checkWrite(String filename) { checkPermission(new FilePermission(filename, "write")); }
public void checkWrite(String filename) { if (desc == null) throw new NullPointerException(); checkPermission(new RuntimePermission("writeFileDescriptor")); }
8,906
public URI(String scheme, String userInfo, String host, int port, String path, String query, String fragment) throws URISyntaxException { this((scheme == null ? "" : scheme + ":") + (userInfo == null && host == null && port == -1 ? "" : "//") + (userInfo == null ? "" : quoteUserInfo(userInfo) + "@") + (host == null ? "" : quoteHost(host)) + (port == -1 ? "" : ":" + String.valueOf(port)) + (path == null ? "" : quotePath(path)) + (query == null ? "" : "?" + quote(query)) + (fragment == null ? "" : "#" + quote(fragment))); parseServerAuthority(); }
public URI(String scheme, String userInfo, String host, int port, String path, String query, String fragment) throws URISyntaxException { this((scheme == null ? "" : scheme + ":") + (userInfo == null && host == null && port == -1 ? "" : "//") + (userInfo == null ? "" : quoteUserInfo(userInfo) + "@") + (host == null ? "" : quoteHost(host)) + (port == -1 ? "" : ":" + String.valueOf(port)) + (path == null ? "" : quotePath(path)) + (query == null ? "" : "?" + quote(query)) + (fragment == null ? "" : "#" + quote(fragment))); parseServerAuthority(); }
8,907
public URI(String scheme, String userInfo, String host, int port, String path, String query, String fragment) throws URISyntaxException { this((scheme == null ? "" : scheme + ":") + (userInfo == null && host == null && port == -1 ? "" : "//") + (userInfo == null ? "" : quoteUserInfo(userInfo) + "@") + (host == null ? "" : quoteHost(host)) + (port == -1 ? "" : ":" + String.valueOf(port)) + (path == null ? "" : quotePath(path)) + (query == null ? "" : "?" + quote(query)) + (fragment == null ? "" : "#" + quote(fragment))); parseServerAuthority(); }
public URI(String scheme, String userInfo, String host, int port, String path, String query, String fragment) throws URISyntaxException { this((scheme == null ? "" : scheme + ":") + (userInfo == null && host == null && port == -1 ? "" : "//") + (userInfo == null ? "" : quoteUserInfo(userInfo) + "@") + (host == null ? "" : quoteHost(host)) + (port == -1 ? "" : ":" + String.valueOf(port)) + (path == null ? "" : quotePath(path)) + (query == null ? "" : "?" + quote(query)) + (fragment == null ? "" : "#" + quote(fragment))); parseServerAuthority(); }
8,908
public URL(String spec) throws MalformedURLException { this((URL) null, spec, (URLStreamHandler) null); }
public URL(String spec) throws MalformedURLException { this((URL) null, spec, (URLStreamHandler) null); }
8,909
public static SAXParserFactory newInstance() { try { return (SAXParserFactory) ClassStuff.createFactory ( defaultPropName, "gnu.xml.aelfred2.JAXPFactory"); } catch (ClassCastException e) { throw new FactoryConfigurationError (e, "Factory class is the wrong type"); } }
public static SAXParserFactory newInstance() { try { return (SAXParserFactory) ClassStuff.createFactory ( defaultPropName, "gnu.xml.aelfred2.JAXPFactory"); } catch (ClassCastException e) { throw new FactoryConfigurationError (e, "Factory class is the wrong type"); } }
8,910
public void setNamespaceAware(boolean value) { namespaceAware = value; } // setNamespaceAware()
public void setNamespaceAware(boolean value) { namespaceAware = value; } // setNamespaceAware()
8,911
public void setValidating(boolean value) { validating = value; } // setValidating()
public void setValidating(boolean value) { validating = value; } // setValidating()
8,912
public FactoryConfigurationError(Exception ex, String msg) { super(msg); exception = ex; } // FactoryConfigurationError()
public FactoryConfigurationError(Exception ex, String msg) { super(msg); exception = ex; } // FactoryConfigurationError()
8,913
public void componentAdded(ContainerEvent event) { final Component c = event.getChild(); if (c instanceof JInternalFrame) { taskBar.windowBar.addFrame((JInternalFrame) c); } else { log.info("componentAdded: " + c.getClass().getName()); } }
public void componentAdded(ContainerEvent event) { final Component c = event.getChild(); if (c instanceof JInternalFrame && !JNodeToolkit.getJNodeToolkit().isWindow(c)) { taskBar.windowBar.addFrame((JInternalFrame) c); } else { log.info("componentAdded: " + c.getClass().getName()); } }
8,914
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame frame; private JColorChooser colorChooser; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
8,915
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
8,916
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
8,917
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(colorChooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(colorChooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
8,918
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); frame.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); frame.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
8,919
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
8,920
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); } }); }
8,921
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame frame; private JColorChooser colorChooser; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
8,922
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
8,923
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
8,924
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(colorChooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(colorChooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
8,925
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); frame.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); frame.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
8,926
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
8,927
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
public void run() { final ClassLoader cl = getClass().getClassLoader(); final ExtensionPoint appsEP; if (cl instanceof PluginClassLoader) { appsEP = ((PluginClassLoader) cl).getDeclaringPluginDescriptor().getExtensionPoint("apps"); } else { throw new AWTError("Need to be loaded using a plugin classloader"); } Desktop.this.taskBar = new TaskBar(appsEP); final JNodeToolkit tk = JNodeToolkit.getJNodeToolkit(); final JNodeAwtContext ctx = tk.getAwtContext(); final JDesktopPane desktop = ctx.getDesktop(); final Container awtRoot = ctx.getAwtRoot(); taskBar.startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (taskBar.startMenu.isShowing()) { taskBar.startMenu.setVisible(false); } else { Point p = taskBar.startButton.getLocationOnScreen(); int h = taskBar.startMenu.getPreferredSize().height; taskBar.startMenu.show(desktop, 0, p.y - h); } } }); taskBar.quitMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { taskBar.startMenu.setVisible(false); JNodeToolkit.stopGui(); } }); taskBar.haltMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(false); } }); taskBar.restartMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JNodeToolkit.stopGui(); VmSystem.halt(true); } }); ActionListener desktopColorAction = new ActionListener() { private JFrame f; private Color oldColor; public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); } }; taskBar.desktopColorMI.addActionListener(desktopColorAction); class ChangeScreenResolution implements ActionListener, Runnable { private String resolution; public ChangeScreenResolution(String resolution) { this.resolution = resolution; } public void run() { ((JNodeToolkit) Toolkit.getDefaultToolkit()).changeScreenSize(resolution); AccessController.doPrivileged(new SetPropertyAction("jnode.awt.screensize", resolution)); } public void actionPerformed(ActionEvent event) { SwingUtilities.invokeLater(this); } } taskBar.changeResMI1.addActionListener(new ChangeScreenResolution("640x480/32")); taskBar.changeResMI2.addActionListener(new ChangeScreenResolution("800x600/32")); taskBar.changeResMI3.addActionListener(new ChangeScreenResolution("1024x768/32")); taskBar.changeResMI4.addActionListener(new ChangeScreenResolution("1280x1024/32")); awtRoot.removeAll(); awtRoot.setLayout(new BorderLayout()); final int controlBarHeight = 36; final int w = awtRoot.getWidth(); taskBar.setPreferredSize(new Dimension(w, controlBarHeight)); awtRoot.add(taskBar, BorderLayout.SOUTH); Image background = null;//loadImage("button_red_i_like.png"); if(background != null) { System.err.println("IMAGE FOUND"); awtRoot.add(new JLabel(new ImageIcon(background)), BorderLayout.CENTER); } else { System.err.println("IMAGE NOT FOUND"); awtRoot.add(desktop, BorderLayout.CENTER); } awtRoot.invalidate(); awtRoot.repaint(); // Update desktopmanager desktop.setDesktopManager(new DesktopManagerImpl()); desktop.addContainerListener(new DesktopContainerListener()); final JPopupMenu desktopMenu = new JPopupMenu("Desktop settings"); JMenuItem desktopColor = new JMenuItem("Desktop color"); desktopColor.addActionListener(desktopColorAction); desktopMenu.add(desktopColor); desktopMenu.add(taskBar.changeResMI1); desktopMenu.add(taskBar.changeResMI2); desktopMenu.add(taskBar.changeResMI3); desktopMenu.add(taskBar.changeResMI4); desktop.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if(event.getButton() == MouseEvent.BUTTON2){ if (desktopMenu .isShowing()) { desktopMenu .setVisible(false); } else { desktopMenu.show(desktop, event.getX(), event.getY()); } } } }); // Update desktop.doLayout(); desktop.repaint(); }
8,928
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
8,929
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
8,930
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(colorChooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(colorChooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
8,931
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); frame.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); frame.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
8,932
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
8,933
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
public void actionPerformed(ActionEvent e) { if (f == null) { f = new JFrame("Desktop color"); final JColorChooser color_chooser = new JColorChooser(); f.add(color_chooser, BorderLayout.CENTER); JButton ok = new JButton("OK"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); } }); JButton apply = new JButton("Apply"); apply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); } }); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); } }); JPanel buttons = new JPanel(); buttons.add(ok); buttons.add(apply); buttons.add(cancel); f.add(buttons, BorderLayout.SOUTH); } oldColor = desktop.getBackground(); Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); int x = (ss.width - 500) / 2; int y = (ss.height - 400) / 2; f.setSize(500, 400); f.setVisible(true); f.setLocation(x, y); }
8,934
public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); }
public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); f.setVisible(false); }
8,935
public void actionPerformed(ActionEvent event) { desktop.setBackground(color_chooser.getColor()); }
public void actionPerformed(ActionEvent event) { desktop.setBackground(colorChooser.getColor()); }
8,936
public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); f.setVisible(false); }
public void actionPerformed(ActionEvent event) { desktop.setBackground(oldColor); frame.setVisible(false); }
8,937
public String toString() { // Identical to toExternalForm(). return handler.toExternalForm(this); }
public String toString() { // Identical to toExternalForm(). return handler.toExternalForm(this); }
8,938
public Dimension(int w, int h) { width = w; height = h; }
public Dimension() { width = w; height = h; }
8,939
public Dimension(int w, int h) { width = w; height = h; }
public Dimension(int w, int h) { width = w; height = h; }
8,940
public JLabel(Icon image) { this("", image, 0); }
public JLabel(Icon image) { this("", image, 0); }
8,941
public void add(Component comp, Object constraints) { addImpl(comp, constraints, -1); }
public Component add(Component comp) { addImpl(comp, constraints, -1); }
8,942
public void add(Component comp, Object constraints) { addImpl(comp, constraints, -1); }
public void add(Component comp, Object constraints) { addImpl(comp, null, -1); return comp; }
8,943
public void repaint() { if (isShowing()) repaint(0, 0, 0, width, height); }
public void repaint() { repaint(0, 0, 0, width, height); }
8,944