bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
12,483
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
12,484
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args } argTypes[0] = nextClass(argTypes[0]); } throw new RuntimeException("Method not called: Could not find a public method named '" + action + "' in target " + targetClass + " which takes a '" + v[1] + "' argument or a property of this type."); } try { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
12,485
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
12,486
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
12,487
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); }
public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, null); } catch(InvocationTargetException ite) { throw new RuntimeException(ite.getCause()); } catch(IllegalAccessException iae) { throw (InternalError) new InternalError("Non-public method was invoked.").initCause(iae); } }
12,488
public String getDescription(File f) { return getInternalFileView().getDescription(f); }
public String getDescription(File f) { return getFileView().getDescription(f); }
12,491
public Icon getIcon(File f) { return getInternalFileView().getIcon(f); }
public Icon getIcon(File f) { return getFileView().getIcon(f); }
12,494
public String getName(File f) { return getInternalFileView().getName(f); }
public String getName(File f) { return getFileView().getName(f); }
12,495
public String getTypeDescription(File f) { return getInternalFileView().getTypeDescription(f); }
public String getTypeDescription(File f) { return getFileView().getTypeDescription(f); }
12,496
protected PropertyEditorSupport() { this.eventSource = this; this.pSupport = new PropertyChangeSupport(this); }
protected PropertyEditorSupport() { this.eventSource = this; this.pSupport = new PropertyChangeSupport(this); }
12,497
public void firePropertyChange() { pSupport.firePropertyChange(null,null,val); }
public void firePropertyChange() { pSupport.firePropertyChange(null,null,val); }
12,498
public String getAsText() { return val != null ? val.toString() : "null"; }
public String getAsText() { return val != null ? val.toString() : "null"; }
12,499
public Object getValue() { return val; }
public Object getValue() { return val; }
12,500
public void setAsText(String s) throws IllegalArgumentException { if(s.equals("null")) { setValue(null); } else { throw new IllegalArgumentException(); } }
public void setAsText(String s) throws IllegalArgumentException { if(s.equals("null")) { setValue(null); } else { throw new IllegalArgumentException(); } }
12,501
public void setAsText(String s) throws IllegalArgumentException { if(s.equals("null")) { setValue(null); } else { throw new IllegalArgumentException(); } }
public void setAsText(String s) throws IllegalArgumentException { if(s.equals("null")) { setValue(null); else throw new IllegalArgumentException(); } }
12,502
public void setAsText(String s) throws IllegalArgumentException { if(s.equals("null")) { setValue(null); } else { throw new IllegalArgumentException(); } }
public void setAsText(String s) throws IllegalArgumentException { if(s.equals("null")) { setValue(null); else { throw new IllegalArgumentException();
12,503
public void setValue(Object val) { Object oldVal = val; this.val = val; if(!oldVal.equals(val)) { pSupport.firePropertyChange(null,oldVal,val); } }
public void setValue(Object val) { Object oldVal = val; this.val = val; if(!oldVal.equals(val)) { pSupport.firePropertyChange(null,oldVal,val); } }
12,504
protected void installDefaults(JSeparator s) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); size = defaults.getDimension("ToolBar.separatorSize"); }
protected void installDefaults(JSeparator s) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); size = defaults.getDimension("ToolBar.separatorSize"); }
12,505
public void mousePressed(MouseEvent event) { int row = BasicListUI.this.convertYToRow(event.getY()); if (row == -1) return; BasicListUI.this.list.setSelectedIndex(row); }
public void mousePressed(MouseEvent event) { int row = BasicListUI.this.convertYToRow(event.getY()); if (row == -1) return; BasicListUI.this.list.setSelectedIndex(row); }
12,506
public void mousePressed(MouseEvent event) { int row = BasicListUI.this.convertYToRow(event.getY()); if (row == -1) return; BasicListUI.this.list.setSelectedIndex(row); }
public void mousePressed(MouseEvent event) { int row = BasicListUI.this.convertYToRow(event.getY()); if (row == -1) return; BasicListUI.this.list.setSelectedIndex(index); }
12,507
int convertRowToY(int row) { int y = 0; for (int i = 0; i < row; ++i) { int h = getRowHeight(i); if (h == -1) return -1; y += h; } return y; }
protected int convertRowToY(int row) { int y = 0; for (int i = 0; i < row; ++i) { int h = getRowHeight(i); if (h == -1) return -1; y += h; } return y; }
12,509
int convertYToRow(int y0) { for (int row = 0; row < cellHeights.length; ++row) { int h = getRowHeight(row); if (y0 < h) return row; y0 -= h; } return -1; }
protected int convertYToRow(int y0) { for (int row = 0; row < cellHeights.length; ++row) { int h = getRowHeight(row); if (y0 < h) return row; y0 -= h; } return -1; }
12,510
void damageLayout() { updateLayoutStateNeeded = 1; list.revalidate(); }
private void damageLayout() { updateLayoutStateNeeded = 1; list.revalidate(); }
12,511
public Rectangle getCellBounds(JList l, int index1, int index2) { maybeUpdateLayoutState(); if (l != list || cellWidth == -1) return null; int lo = Math.min(index1, index2); int hi = Math.max(index1, index2); Rectangle lobounds = new Rectangle(0, convertRowToY(lo), cellWidth, getRowHeight(lo)); Rectangle hibounds = new Rectangle(0, convertRowToY(hi), cellWidth, getRowHeight(hi)); return lobounds.union(hibounds); }
public Rectangle getCellBounds(JList l, int index1, int index2) { maybeUpdateLayoutState(); if (l != list || cellWidth == -1) return null; int lo = Math.min(index1, index2); int hi = Math.max(index1, index2); Rectangle lobounds = new Rectangle(0, convertRowToY(lo), cellWidth, getRowHeight(lo)); Rectangle hibounds = new Rectangle(0, convertRowToY(hi), cellWidth, getRowHeight(hi)); return lobounds.union(hibounds); }
12,512
public Rectangle getCellBounds(JList l, int index1, int index2) { maybeUpdateLayoutState(); if (l != list || cellWidth == -1) return null; int lo = Math.min(index1, index2); int hi = Math.max(index1, index2); Rectangle lobounds = new Rectangle(0, convertRowToY(lo), cellWidth, getRowHeight(lo)); Rectangle hibounds = new Rectangle(0, convertRowToY(hi), cellWidth, getRowHeight(hi)); return lobounds.union(hibounds); }
public Rectangle getCellBounds(JList l, int index1, int index2) { maybeUpdateLayoutState(); if (l != list || cellWidth == -1) return null; int lo = Math.min(index1, index2); int hi = Math.max(index1, index2); Rectangle lobounds = new Rectangle(0, convertRowToY(lo), cellWidth, getRowHeight(lo)); Rectangle hibounds = new Rectangle(0, convertRowToY(hi), cellWidth, getRowHeight(hi)); for (int i = minIndex + 1; i <= maxIndex; i++) { Point hiLoc = indexToLocation(list, i); Rectangle hibounds = new Rectangle(hiLoc.x, hiLoc.y, cellWidth, getRowHeight(i)); bounds = bounds.union(hibounds); } return bounds; }
12,513
public Dimension getPreferredSize(JComponent c) { if (list.getModel().getSize() == 0) return new Dimension(0, 0); Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1); return bounds.getSize(); }
public Dimension getPreferredSize(JComponent c) { int size = list.getModel().getSize(); if (size == 0) return new Dimension(0, 0); Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1); return bounds.getSize(); }
12,514
public Dimension getPreferredSize(JComponent c) { if (list.getModel().getSize() == 0) return new Dimension(0, 0); Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1); return bounds.getSize(); }
public Dimension getPreferredSize(JComponent c) { if (list.getModel().getSize() == 0) return new Dimension(0, 0); Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1); Dimension retVal = bounds.getSize(); Component parent = list.getParent(); if ((visibleRows == -1) && (parent instanceof JViewport)) { JViewport viewport = (JViewport) parent; if (layoutOrientation == JList.HORIZONTAL_WRAP) { int h = viewport.getSize().height; int cellsPerCol = h / cellHeight; int w = size / cellsPerCol * cellWidth; retVal = new Dimension(w, h); } else if (layoutOrientation == JList.VERTICAL_WRAP) { int w = viewport.getSize().width; int cellsPerRow = Math.max(w / cellWidth, 1); int h = size / cellsPerRow * cellHeight; retVal = new Dimension(w, h); } } return retVal; }
12,515
int getRowHeight(int row) { if (row < 0 || row >= cellHeights.length) return -1; else if (cellHeight != -1) return cellHeight; else return cellHeights[row]; }
protected int getRowHeight(int row) { if (row < 0 || row >= cellHeights.length) return -1; else if (cellHeight != -1) return cellHeight; else return cellHeights[row]; }
12,516
public Point indexToLocation(JList list, int index) { return new Point(0, convertRowToY(index)); }
public Point indexToLocation(JList list, int index) { int layoutOrientation = list.getLayoutOrientation(); Point loc = null; switch (layoutOrientation) { case JList.VERTICAL: loc = new Point(0, convertRowToY(index)); break; case JList.HORIZONTAL_WRAP: int visibleRows = list.getVisibleRowCount(); int numberOfCellsPerRow = -1; if (visibleRows <= 0) { Dimension listDim = list.getSize(); numberOfCellsPerRow = Math.max(listDim.width / cellWidth, 1); } else { int numberOfItems = list.getModel().getSize(); numberOfCellsPerRow = numberOfItems / visibleRows + 1; } int gridX = index % numberOfCellsPerRow; int gridY = index / numberOfCellsPerRow; int locX = gridX * cellWidth; int locY = gridY * cellHeight; loc = new Point(locX, locY); break; case JList.VERTICAL_WRAP: int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } if (visibleRows2 > 0) { int gridY2 = index % visibleRows2; int gridX2 = index / visibleRows2; int locX2 = gridX2 * cellWidth; int locY2 = gridY2 * cellHeight; loc = new Point(locX2, locY2); } else loc = new Point(0, convertRowToY(index)); break; } return loc; }
12,517
void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); list.setForeground(defaults.getColor("List.foreground")); list.setBackground(defaults.getColor("List.background")); list.setSelectionForeground(defaults.getColor("List.selectionForeground")); list.setSelectionBackground(defaults.getColor("List.selectionBackground")); list.setOpaque(true); }
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); list.setForeground(defaults.getColor("List.foreground")); list.setBackground(defaults.getColor("List.background")); list.setSelectionForeground(defaults.getColor("List.selectionForeground")); list.setSelectionBackground(defaults.getColor("List.selectionBackground")); list.setOpaque(true); }
12,518
void installKeyboardActions() { }
protected void installKeyboardActions() { }
12,519
void installListeners() { list.addFocusListener(focusListener); list.getModel().addListDataListener(listDataListener); list.addListSelectionListener(listSelectionListener); list.addMouseListener(mouseInputListener); list.addMouseMotionListener(mouseInputListener); list.addPropertyChangeListener(propertyChangeListener); }
protected void installListeners() { list.addFocusListener(focusListener); list.getModel().addListDataListener(listDataListener); list.addListSelectionListener(listSelectionListener); list.addMouseListener(mouseInputListener); list.addMouseMotionListener(mouseInputListener); list.addPropertyChangeListener(propertyChangeListener); }
12,520
public int locationToIndex(JList list, Point location) { return convertYToRow(location.y); }
public int locationToIndex(JList list, Point location) { int layoutOrientation = list.getLayoutOrientation(); int index = -1; switch (layoutOrientation) { case JList.VERTICAL: index = convertYToRow(location.y); break; case JList.HORIZONTAL_WRAP: int visibleRows = list.getVisibleRowCount(); int cellsPerRow = -1; int numberOfItems = list.getModel().getSize(); Dimension listDim = list.getSize(); if (visibleRows <= 0) { try { cellsPerRow = listDim.width / cellWidth; } catch (ArithmeticException ex) { cellsPerRow = 1; } } else { cellsPerRow = numberOfItems / visibleRows + 1; } int cellsPerColumn = numberOfItems / cellsPerRow + 1; int gridX = Math.min(location.x / cellWidth, cellsPerRow - 1); int gridY = Math.min(location.y / cellHeight, cellsPerColumn); index = gridX + gridY * cellsPerRow; break; case JList.VERTICAL_WRAP: int visibleRows2 = list.getVisibleRowCount(); if (visibleRows2 <= 0) { Dimension listDim2 = list.getSize(); visibleRows2 = listDim2.height / cellHeight; } int numberOfItems2 = list.getModel().getSize(); int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1; Dimension listDim2 = list.getSize(); int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1); int gridY2 = Math.min(location.y / cellHeight, visibleRows2); index = gridY2 + gridX2 * visibleRows2; break; } return index; }
12,522
void maybeUpdateLayoutState() { if (updateLayoutStateNeeded != 0) { updateLayoutState(); updateLayoutStateNeeded = 0; } }
protected void maybeUpdateLayoutState() { if (updateLayoutStateNeeded != 0) { updateLayoutState(); updateLayoutStateNeeded = 0; } }
12,523
public void paintBackground(Graphics g, JComponent c) { Dimension size = getPreferredSize(c); Color save = g.getColor(); g.setColor(c.getBackground()); g.fillRect(0, 0, size.width, size.height); g.setColor(save); }
private void paintBackground(Graphics g, JComponent c) { Dimension size = getPreferredSize(c); Color save = g.getColor(); g.setColor(c.getBackground()); g.fillRect(0, 0, size.width, size.height); g.setColor(save); }
12,524
void paintCell(Graphics g, int row, Rectangle bounds, ListCellRenderer rend, ListModel data, ListSelectionModel sel, int lead) { boolean is_sel = list.isSelectedIndex(row); boolean has_focus = false; Component comp = rend.getListCellRendererComponent(list, data.getElementAt(row), 0, is_sel, has_focus); g.translate(bounds.x, bounds.y); comp.setBounds(new Rectangle(0, 0, bounds.width, bounds.height)); comp.paint(g); g.translate(-bounds.x, -bounds.y); }
void paintCell(Graphics g, int row, Rectangle bounds, ListCellRenderer rend, ListModel data, ListSelectionModel sel, int lead) { boolean is_sel = list.isSelectedIndex(row); boolean has_focus = false; Component comp = rend.getListCellRendererComponent(list, data.getElementAt(row), 0, is_sel, has_focus); g.translate(bounds.x, bounds.y); comp.setBounds(new Rectangle(0, 0, bounds.width, bounds.height)); comp.paint(g); g.translate(-bounds.x, -bounds.y); }
12,525
void paintCell(Graphics g, int row, Rectangle bounds, ListCellRenderer rend, ListModel data, ListSelectionModel sel, int lead) { boolean is_sel = list.isSelectedIndex(row); boolean has_focus = false; Component comp = rend.getListCellRendererComponent(list, data.getElementAt(row), 0, is_sel, has_focus); g.translate(bounds.x, bounds.y); comp.setBounds(new Rectangle(0, 0, bounds.width, bounds.height)); comp.paint(g); g.translate(-bounds.x, -bounds.y); }
void paintCell(Graphics g, int row, Rectangle bounds, ListCellRenderer rend, ListModel data, ListSelectionModel sel, int lead) { boolean is_sel = list.isSelectedIndex(row); boolean has_focus = false; Component comp = rend.getListCellRendererComponent(list, data.getElementAt(row), 0, is_sel, has_focus); g.translate(bounds.x, bounds.y); comp.setBounds(new Rectangle(0, 0, bounds.width, bounds.height)); comp.paint(g); g.translate(-bounds.x, -bounds.y); }
12,526
void uninstallDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); list.setForeground(null); list.setBackground(null); list.setSelectionForeground(null); list.setSelectionBackground(null); }
protected void uninstallDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); list.setForeground(null); list.setBackground(null); list.setSelectionForeground(null); list.setSelectionBackground(null); }
12,527
void uninstallKeyboardActions() { }
protected void uninstallKeyboardActions() { }
12,528
void uninstallListeners() { list.removeFocusListener(focusListener); list.getModel().removeListDataListener(listDataListener); list.removeListSelectionListener(listSelectionListener); list.removeMouseListener(mouseInputListener); list.removeMouseMotionListener(mouseInputListener); list.removePropertyChangeListener(propertyChangeListener); }
protected void uninstallListeners() { list.removeFocusListener(focusListener); list.getModel().removeListDataListener(listDataListener); list.removeListSelectionListener(listSelectionListener); list.removeMouseListener(mouseInputListener); list.removeMouseMotionListener(mouseInputListener); list.removePropertyChangeListener(propertyChangeListener); }
12,529
void updateLayoutState() { int nrows = list.getModel().getSize(); cellHeight = -1; cellWidth = -1; if (cellHeights == null || cellHeights.length != nrows) cellHeights = new int[nrows]; if (list.getFixedCellHeight() == -1 || list.getFixedCellWidth() == -1) { ListCellRenderer rend = list.getCellRenderer(); for (int i = 0; i < nrows; ++i) { Component flyweight = rend.getListCellRendererComponent(list, list.getModel() .getElementAt(i), 0, false, false); Dimension dim = flyweight.getPreferredSize(); cellHeights[i] = dim.height; cellWidth = Math.max(cellWidth, dim.width); } } else { cellHeight = list.getFixedCellHeight(); cellWidth = list.getFixedCellWidth(); } }
protected void updateLayoutState() { int nrows = list.getModel().getSize(); cellHeight = -1; cellWidth = -1; if (cellHeights == null || cellHeights.length != nrows) cellHeights = new int[nrows]; if (list.getFixedCellHeight() == -1 || list.getFixedCellWidth() == -1) { ListCellRenderer rend = list.getCellRenderer(); for (int i = 0; i < nrows; ++i) { Component flyweight = rend.getListCellRendererComponent(list, list.getModel() .getElementAt(i), 0, false, false); Dimension dim = flyweight.getPreferredSize(); cellHeights[i] = dim.height; cellWidth = Math.max(cellWidth, dim.width); } } else { cellHeight = list.getFixedCellHeight(); cellWidth = list.getFixedCellWidth(); } }
12,530
private Point adjustLocation(Point p, Component c, Dimension d) { if (p.x + d.width > c.getWidth()) p.x -= d.width; if (p.x < 0) p.x = 0; if (p.y + d.height < c.getHeight()) p.y += d.height; else if (p.y + d.height > c.getHeight()) p.y -= d.height*2; return p; }
private Point adjustLocation(Point p, Component c, Dimension d) { if (p.x + d.width > c.getWidth()) p.x -= d.width; if (p.x < 0) p.x = 0; if (p.y + d.height < c.getHeight()) p.y += d.height; if (p.y + d.height > c.getHeight()) p.y -= d.height*2; return p; }
12,532
void showTip() { if (!enabled || currentComponent == null || !currentComponent.isEnabled() || (currentTip != null && currentTip.isVisible())) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); currentTip.setVisible(true); Container parent = currentComponent.getParent(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (parent instanceof JPopupMenu) setLightWeightPopupEnabled(((JPopupMenu) parent).isLightWeightPopupEnabled()); else setLightWeightPopupEnabled(true); if (isLightWeightPopupEnabled()) { JLayeredPane pane = ((JRootPane) SwingUtilities. getAncestorOfClass(JRootPane.class, currentComponent)). getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = SwingUtilities.convertPoint(currentComponent, p, pane); p = adjustLocation(p, pane, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); containerPanel.validate(); containerPanel.repaint(); } else if (currentComponent.isShowing()) { SwingUtilities.convertPointToScreen(p, currentComponent); p = adjustLocation(p, SwingUtilities.getWindowAncestor(currentComponent), dims); tooltipWindow = new JDialog(); tooltipWindow.setContentPane(currentTip); tooltipWindow.setUndecorated(true); tooltipWindow.getRootPane(). setWindowDecorationStyle(JRootPane.PLAIN_DIALOG); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); tooltipWindow.validate(); tooltipWindow.repaint(); currentTip.revalidate(); currentTip.repaint(); } }
void showTip() { if (!enabled || currentComponent == null || !currentComponent.isEnabled() || (currentTip != null && currentTip.isVisible())) return; if (currentTip == null || currentTip.getComponent() != currentComponent && currentComponent instanceof JComponent) currentTip = ((JComponent) currentComponent).createToolTip(); currentTip.setVisible(true); Container parent = currentComponent.getParent(); Point p = currentPoint; Dimension dims = currentTip.getPreferredSize(); if (parent instanceof JPopupMenu) setLightWeightPopupEnabled(((JPopupMenu) parent).isLightWeightPopupEnabled()); else setLightWeightPopupEnabled(true); if (isLightWeightPopupEnabled()) { JLayeredPane pane = ((JRootPane) SwingUtilities. getAncestorOfClass(JRootPane.class, currentComponent)). getLayeredPane(); // This should never happen, but just in case. if (pane == null) return; if (containerPanel != null) hideTip(); containerPanel = new Panel(); JRootPane root = new JRootPane(); root.getContentPane().add(currentTip); containerPanel.add(root); LayoutManager lm = containerPanel.getLayout(); if (lm instanceof FlowLayout) { FlowLayout fm = (FlowLayout) lm; fm.setVgap(0); fm.setHgap(0); } p = SwingUtilities.convertPoint(currentComponent, p, pane); p = adjustLocation(p, pane, dims); pane.add(containerPanel); containerPanel.setBounds(p.x, p.y, dims.width, dims.height); currentTip.setBounds(0, 0, dims.width, dims.height); containerPanel.validate(); containerPanel.repaint(); } else if (currentComponent.isShowing()) { SwingUtilities.convertPointToScreen(p, currentComponent); p = adjustLocation(p, SwingUtilities.getWindowAncestor(currentComponent), dims); tooltipWindow = new JDialog(); tooltipWindow.setContentPane(currentTip); tooltipWindow.setUndecorated(true); tooltipWindow.getRootPane(). setWindowDecorationStyle(JRootPane.PLAIN_DIALOG); tooltipWindow.pack(); tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height); tooltipWindow.show(); tooltipWindow.validate(); tooltipWindow.repaint(); currentTip.revalidate(); currentTip.repaint(); } }
12,533
public static void main(String[] args) throws Exception { SAXParser parser = new SAXParser(); InputSource input = new InputSource(args[0]); parser.parse(input, new org.xml.sax.helpers.DefaultHandler()); }
public static void main(String[] args) throws Exception { SAXParser parser = new SAXParser(); InputSource input = new InputSource(args[0]); parser.parse(input, new org.xml.sax.helpers.DefaultHandler()); }
12,534
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); Font f = comboBox.getFont(); Color fore = comboBox.getForeground(); Color back = comboBox.getBackground(); if (f == null || f instanceof UIResource) comboBox.setFont(defaults.getFont("ComboBox.font")); if (fore == null || fore instanceof UIResource) comboBox.setForeground(defaults.getColor("ComboBox.foreground")); if (back == null || back instanceof UIResource) comboBox.setBackground(defaults.getColor("ComboBox.background")); // fetch the button color scheme shadow = defaults.getColor("ComboBox.buttonShadow"); darkShadow = defaults.getColor("ComboBox.buttonDarkShadow"); highlight = defaults.getColor("ComboBox.buttonHighlight"); }
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); Font f = comboBox.getFont(); Color fore = comboBox.getForeground(); Color back = comboBox.getBackground(); if (f == null || f instanceof UIResource) comboBox.setFont(defaults.getFont("ComboBox.font")); if (fore == null || fore instanceof UIResource) comboBox.setForeground(defaults.getColor("ComboBox.foreground")); if (back == null || back instanceof UIResource) comboBox.setBackground(defaults.getColor("ComboBox.background")); // fetch the button color scheme shadow = defaults.getColor("ComboBox.buttonShadow"); darkShadow = defaults.getColor("ComboBox.buttonDarkShadow"); highlight = defaults.getColor("ComboBox.buttonHighlight"); }
12,535
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); Font f = comboBox.getFont(); Color fore = comboBox.getForeground(); Color back = comboBox.getBackground(); if (f == null || f instanceof UIResource) comboBox.setFont(defaults.getFont("ComboBox.font")); if (fore == null || fore instanceof UIResource) comboBox.setForeground(defaults.getColor("ComboBox.foreground")); if (back == null || back instanceof UIResource) comboBox.setBackground(defaults.getColor("ComboBox.background")); // fetch the button color scheme shadow = defaults.getColor("ComboBox.buttonShadow"); darkShadow = defaults.getColor("ComboBox.buttonDarkShadow"); highlight = defaults.getColor("ComboBox.buttonHighlight"); }
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); Font f = comboBox.getFont(); Color fore = comboBox.getForeground(); Color back = comboBox.getBackground(); if (f == null || f instanceof UIResource) comboBox.setFont(defaults.getFont("ComboBox.font")); if (fore == null || fore instanceof UIResource) comboBox.setForeground(defaults.getColor("ComboBox.foreground")); if (back == null || back instanceof UIResource) comboBox.setBackground(defaults.getColor("ComboBox.background")); // fetch the button color scheme shadow = defaults.getColor("ComboBox.buttonShadow"); darkShadow = defaults.getColor("ComboBox.buttonDarkShadow"); highlight = defaults.getColor("ComboBox.buttonHighlight"); }
12,536
protected JComponent createContentPane() { return new SwingFrameContentPane(); }
protected Container createContentPane() { return new SwingFrameContentPane(); }
12,537
public void paint(Graphics g) { RepaintManager rm = RepaintManager.currentManager(this); // We do a little stunt act here to switch on double buffering if it's // not already on. If we are not already doublebuffered, then we jump // into the method paintDoubleBuffered, which turns on the double buffer // and then calls paint(g) again. In the second call we go into the else // branch of this if statement and actually paint things to the double // buffer. When this method completes, the call stack unwinds back to // paintDoubleBuffered, where the buffer contents is finally drawn to the // screen. if (!isPaintingDoubleBuffered && isDoubleBuffered() && rm.isDoubleBufferingEnabled()) paintDoubleBuffered(g); else { if (g.getClip() == null) g.setClip(0, 0, getWidth(), getHeight()); paintComponent(g); paintChildren(g); paintBorder(g); } }
public void paint(Graphics g) { RepaintManager rm = RepaintManager.currentManager(this); // We do a little stunt act here to switch on double buffering if it's // not already on. If we are not already doublebuffered, then we jump // into the method paintDoubleBuffered, which turns on the double buffer // and then calls paint(g) again. In the second call we go into the else // branch of this if statement and actually paint things to the double // buffer. When this method completes, the call stack unwinds back to // paintDoubleBuffered, where the buffer contents is finally drawn to the // screen. if (!isPaintingDoubleBuffered && isDoubleBuffered() && rm.isDoubleBufferingEnabled()) paintDoubleBuffered(g); else { if (g.getClip() == null) g.setClip(0, 0, getWidth(), getHeight()); paintComponent(g); paintChildren(g); Rectangle clip = g.getClipBounds(); if (clip.x == 0 && clip.y == 0 && clip.width == getWidth() && clip.height == getHeight()) RepaintManager.currentManager(this).markCompletelyClean(this); } }
12,538
protected void paintChildren(Graphics g) { Shape originalClip = g.getClip(); Rectangle inner = SwingUtilities.calculateInnerArea(this, new Rectangle()); g.clipRect(inner.x, inner.y, inner.width, inner.height); Component[] children = getComponents(); for (int i = children.length - 1; i >= 0; --i) { if (!children[i].isVisible()) continue; Rectangle bounds = children[i].getBounds(); Rectangle oldClip = g.getClipBounds(); if (oldClip == null) oldClip = bounds; Rectangle clip = oldClip.intersection(bounds); if (clip.isEmpty()) continue; boolean translated = false; try { g.setClip(clip.x, clip.y, clip.width, clip.height); g.translate(bounds.x, bounds.y); translated = true; children[i].paint(g); } finally { if (translated) g.translate(-bounds.x, -bounds.y); g.setClip(oldClip); } } g.setClip(originalClip); }
protected void paintChildren(Graphics g) { Shape originalClip = g.getClip(); Rectangle inner = SwingUtilities.calculateInnerArea(this, rectCache); g.clipRect(inner.x, inner.y, inner.width, inner.height); Component[] children = getComponents(); for (int i = children.length - 1; i >= 0; --i) { if (!children[i].isVisible()) continue; Rectangle bounds = children[i].getBounds(); Rectangle oldClip = g.getClipBounds(); if (oldClip == null) oldClip = bounds; Rectangle clip = oldClip.intersection(bounds); if (clip.isEmpty()) continue; boolean translated = false; try { g.setClip(clip.x, clip.y, clip.width, clip.height); g.translate(bounds.x, bounds.y); translated = true; children[i].paint(g); } finally { if (translated) g.translate(-bounds.x, -bounds.y); g.setClip(oldClip); } } g.setClip(originalClip); }
12,539
protected void paintChildren(Graphics g) { Shape originalClip = g.getClip(); Rectangle inner = SwingUtilities.calculateInnerArea(this, new Rectangle()); g.clipRect(inner.x, inner.y, inner.width, inner.height); Component[] children = getComponents(); for (int i = children.length - 1; i >= 0; --i) { if (!children[i].isVisible()) continue; Rectangle bounds = children[i].getBounds(); Rectangle oldClip = g.getClipBounds(); if (oldClip == null) oldClip = bounds; Rectangle clip = oldClip.intersection(bounds); if (clip.isEmpty()) continue; boolean translated = false; try { g.setClip(clip.x, clip.y, clip.width, clip.height); g.translate(bounds.x, bounds.y); translated = true; children[i].paint(g); } finally { if (translated) g.translate(-bounds.x, -bounds.y); g.setClip(oldClip); } } g.setClip(originalClip); }
protected void paintChildren(Graphics g) { Shape originalClip = g.getClip(); Rectangle inner = SwingUtilities.calculateInnerArea(this, new Rectangle()); g.clipRect(inner.x, inner.y, inner.width, inner.height); Component[] children = getComponents(); for (int i = children.length - 1; i >= 0; --i) { if (!children[i].isVisible()) continue; Rectangle bounds = children[i].getBounds(rectCache); Rectangle oldClip = g.getClipBounds(); if (oldClip == null) oldClip = bounds; Rectangle clip = oldClip.intersection(bounds); if (clip.isEmpty()) continue; boolean translated = false; try { g.setClip(clip.x, clip.y, clip.width, clip.height); g.translate(bounds.x, bounds.y); translated = true; children[i].paint(g); } finally { if (translated) g.translate(-bounds.x, -bounds.y); g.setClip(oldClip); } } g.setClip(originalClip); }
12,540
protected void paintChildren(Graphics g) { Shape originalClip = g.getClip(); Rectangle inner = SwingUtilities.calculateInnerArea(this, new Rectangle()); g.clipRect(inner.x, inner.y, inner.width, inner.height); Component[] children = getComponents(); for (int i = children.length - 1; i >= 0; --i) { if (!children[i].isVisible()) continue; Rectangle bounds = children[i].getBounds(); Rectangle oldClip = g.getClipBounds(); if (oldClip == null) oldClip = bounds; Rectangle clip = oldClip.intersection(bounds); if (clip.isEmpty()) continue; boolean translated = false; try { g.setClip(clip.x, clip.y, clip.width, clip.height); g.translate(bounds.x, bounds.y); translated = true; children[i].paint(g); } finally { if (translated) g.translate(-bounds.x, -bounds.y); g.setClip(oldClip); } } g.setClip(originalClip); }
protected void paintChildren(Graphics g) { Shape originalClip = g.getClip(); Rectangle inner = SwingUtilities.calculateInnerArea(this, new Rectangle()); g.clipRect(inner.x, inner.y, inner.width, inner.height); Component[] children = getComponents(); for (int i = children.length - 1; i >= 0; --i) { if (!children[i].isVisible()) continue; Rectangle bounds = children[i].getBounds(); Rectangle oldClip = g.getClipBounds(); if (oldClip == null) oldClip = bounds; Rectangle clip = oldClip.intersection(bounds); if (clip.isEmpty()) continue; boolean translated = false; try { g.setClip(clip.x, clip.y, clip.width, clip.height); g.translate(bounds.x, bounds.y); translated = true; children[i].paint(g); } finally { if (translated) g.translate(-bounds.x, -bounds.y); g.setClip(oldClip); } } g.setClip(originalClip); }
12,541
protected void paintChildren(Graphics g) { Shape originalClip = g.getClip(); Rectangle inner = SwingUtilities.calculateInnerArea(this, new Rectangle()); g.clipRect(inner.x, inner.y, inner.width, inner.height); Component[] children = getComponents(); for (int i = children.length - 1; i >= 0; --i) { if (!children[i].isVisible()) continue; Rectangle bounds = children[i].getBounds(); Rectangle oldClip = g.getClipBounds(); if (oldClip == null) oldClip = bounds; Rectangle clip = oldClip.intersection(bounds); if (clip.isEmpty()) continue; boolean translated = false; try { g.setClip(clip.x, clip.y, clip.width, clip.height); g.translate(bounds.x, bounds.y); translated = true; children[i].paint(g); } finally { if (translated) g.translate(-bounds.x, -bounds.y); g.setClip(oldClip); } } g.setClip(originalClip); }
protected void paintChildren(Graphics g) { Shape originalClip = g.getClip(); Rectangle inner = SwingUtilities.calculateInnerArea(this, new Rectangle()); g.clipRect(inner.x, inner.y, inner.width, inner.height); Component[] children = getComponents(); for (int i = children.length - 1; i >= 0; --i) { if (!children[i].isVisible()) continue; Rectangle bounds = children[i].getBounds(); Rectangle oldClip = g.getClipBounds(); if (oldClip == null) oldClip = bounds; Rectangle clip = oldClip.intersection(bounds); if (clip.isEmpty()) continue; boolean translated = false; try { g.clipRect(bounds.x, bounds.y, bounds.width, bounds.height); g.translate(bounds.x, bounds.y); translated = true; children[i].paint(g); } finally { if (translated) g.translate(-bounds.x, -bounds.y); g.setClip(oldClip); } } g.setClip(originalClip); }
12,542
void paintDoubleBuffered(Graphics g) { Rectangle r = g.getClipBounds(); if (r == null) r = new Rectangle(0, 0, getWidth(), getHeight()); RepaintManager rm = RepaintManager.currentManager(this); // Paint on the offscreen buffer. synchronized (paintLock) { Image buffer = rm.getOffscreenBuffer(this, getWidth(), getHeight()); Graphics g2 = buffer.getGraphics(); g2 = getComponentGraphics(g2); g2.setClip(r.x, r.y, r.width, r.height); isPaintingDoubleBuffered = true; paint(g2); isPaintingDoubleBuffered = false; g2.dispose(); // Paint the buffer contents on screen. g.drawImage(buffer, 0, 0, this); } }
void paintDoubleBuffered(Graphics g) { Rectangle r = g.getClipBounds(); if (r == null) r = new Rectangle(0, 0, getWidth(), getHeight()); RepaintManager rm = RepaintManager.currentManager(this); // Paint on the offscreen buffer. synchronized (paintLock) { Image buffer = rm.getOffscreenBuffer(this, getWidth(), getHeight()); Graphics g2 = buffer.getGraphics(); g2 = getComponentGraphics(g2); g2.setClip(r.x, r.y, r.width, r.height); isPaintingDoubleBuffered = true; paint(g2); isPaintingDoubleBuffered = false; g2.dispose(); // Paint the buffer contents on screen. g.drawImage(buffer, 0, 0, this); } }
12,543
void paintDoubleBuffered(Graphics g) { Rectangle r = g.getClipBounds(); if (r == null) r = new Rectangle(0, 0, getWidth(), getHeight()); RepaintManager rm = RepaintManager.currentManager(this); // Paint on the offscreen buffer. synchronized (paintLock) { Image buffer = rm.getOffscreenBuffer(this, getWidth(), getHeight()); Graphics g2 = buffer.getGraphics(); g2 = getComponentGraphics(g2); g2.setClip(r.x, r.y, r.width, r.height); isPaintingDoubleBuffered = true; paint(g2); isPaintingDoubleBuffered = false; g2.dispose(); // Paint the buffer contents on screen. g.drawImage(buffer, 0, 0, this); } }
void paintDoubleBuffered(Graphics g) { Rectangle r = g.getClipBounds(); if (r == null) r = new Rectangle(0, 0, getWidth(), getHeight()); RepaintManager rm = RepaintManager.currentManager(this); // Paint on the offscreen buffer. synchronized (paintLock) { Image buffer = rm.getOffscreenBuffer(this, getWidth(), getHeight()); Graphics g2 = buffer.getGraphics(); g2 = getComponentGraphics(g2); g2.setClip(r.x, r.y, r.width, r.height); isPaintingDoubleBuffered = true; paint(g2); isPaintingDoubleBuffered = false; g2.dispose(); // Paint the buffer contents on screen. g.drawImage(buffer, 0, 0, this);
12,544
public void setBorder(Border newBorder) { Border oldBorder = border; border = newBorder; firePropertyChange("border", oldBorder, newBorder); }
public void setBorder(Border newBorder) { Border oldBorder = getBorder(); if (oldBorder == newBorder) return; border = newBorder; firePropertyChange("border", oldBorder, newBorder); }
12,547
public void setEnabled(boolean enable) { boolean oldEnabled = isEnabled(); super.setEnabled(enable); firePropertyChange("enabled", oldEnabled, enable); }
public void setEnabled(boolean enable) { if (enable == isEnabled()) return; super.setEnabled(enable); firePropertyChange("enabled", oldEnabled, enable); }
12,549
public void setEnabled(boolean enable) { boolean oldEnabled = isEnabled(); super.setEnabled(enable); firePropertyChange("enabled", oldEnabled, enable); }
public void setEnabled(boolean enable) { boolean oldEnabled = isEnabled(); super.setEnabled(enable); firePropertyChange("enabled", !enable, enable); repaint(); }
12,550
public void concatenateTransform(AffineTransform post) { xform.concatenate(post); }
public void concatenateTransform(AffineTransform post) { concetenateTransform (post); }
12,555
public void concetenateTransform(AffineTransform post) { concatenateTransform(post); }
public void concetenateTransform(AffineTransform post) { xform.concatenate (post); }
12,556
public void preConcatenateTransform(AffineTransform pre) { xform.preConcatenate(pre); }
public void preConcatenateTransform(AffineTransform pre) { preConcetenateTransform (pre); }
12,557
public void preConcetenateTransform(AffineTransform pre) { preConcetenateTransform(pre); }
public void preConcetenateTransform(AffineTransform pre) { xform.preConcatenate (pre); }
12,558
public Component getTreeCellRendererComponent(JTree tree, Object val, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { this.selected = selected; this.hasFocus = hasFocus; if (leaf) setIcon(getLeafIcon()); else if (expanded) setIcon(getOpenIcon()); else setIcon(getClosedIcon()); setText(val.toString()); setHorizontalAlignment(LEFT); setVerticalAlignment(TOP); return this; }
public Component getTreeCellRendererComponent(JTree tree, Object val, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { this.selected = selected; this.hasFocus = hasFocus; if (leaf) setLeafIcon(getLeafIcon()); else if (expanded) setIcon(getOpenIcon()); else setIcon(getClosedIcon()); setText(val.toString()); setHorizontalAlignment(LEFT); setVerticalAlignment(TOP); return this; }
12,559
public Component getTreeCellRendererComponent(JTree tree, Object val, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { this.selected = selected; this.hasFocus = hasFocus; if (leaf) setIcon(getLeafIcon()); else if (expanded) setIcon(getOpenIcon()); else setIcon(getClosedIcon()); setText(val.toString()); setHorizontalAlignment(LEFT); setVerticalAlignment(TOP); return this; }
public Component getTreeCellRendererComponent(JTree tree, Object val, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { this.selected = selected; this.hasFocus = hasFocus; if (leaf) setIcon(getLeafIcon()); else if (expanded) setOpenIcon(getOpenIcon()); else setIcon(getClosedIcon()); setText(val.toString()); setHorizontalAlignment(LEFT); setVerticalAlignment(TOP); return this; }
12,560
public Component getTreeCellRendererComponent(JTree tree, Object val, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { this.selected = selected; this.hasFocus = hasFocus; if (leaf) setIcon(getLeafIcon()); else if (expanded) setIcon(getOpenIcon()); else setIcon(getClosedIcon()); setText(val.toString()); setHorizontalAlignment(LEFT); setVerticalAlignment(TOP); return this; }
public Component getTreeCellRendererComponent(JTree tree, Object val, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { this.selected = selected; this.hasFocus = hasFocus; if (leaf) setIcon(getLeafIcon()); else if (expanded) setIcon(getOpenIcon()); else setClosedIcon(getClosedIcon()); setText(val.toString()); setHorizontalAlignment(LEFT); setVerticalAlignment(TOP); return this; }
12,561
getAttribute(AttributedCharacterIterator.Attribute attrib){ if (attribs == null) return(null); for (int i = 0; i < attribs.length; i++) { Set key_set = attribs[i].attribs.keySet(); Iterator iter = key_set.iterator(); while (iter.hasNext()) { Object obj = iter.next(); // Check for attribute match and range match if (obj.equals(attrib)) if ((ci.getIndex() >= attribs[i].begin_index) && (ci.getIndex() <= attribs[i].end_index)) return(attribs[i].attribs.get(obj)); } } return(null);}
getAttribute(AttributedCharacterIterator.Attribute attrib){ if (attribs == null) return(null); for (int i = 0; i < attribs.length; i++) { Set key_set = attribs[i].attribs.keySet(); Iterator iter = key_set.iterator(); while (iter.hasNext()) { Object obj = iter.next(); // Check for attribute match and range match if (obj.equals(attrib)) if ((ci.getIndex() >= attribs[i].begin_index) && (ci.getIndex() < attribs[i].end_index)) return(attribs[i].attribs.get(obj)); } } return(null);}
12,564
getAttributes(){ HashMap m = new HashMap(); if (attribs == null) return(m); for (int i = 0; i < attribs.length; i++) { if ((ci.getIndex() >= attribs[i].begin_index) && (ci.getIndex() <= attribs[i].end_index)) m.putAll(attribs[i].attribs); } return(m);}
getAttributes(){ HashMap m = new HashMap(); if (attribs == null) return(m); for (int i = 0; i < attribs.length; i++) { if ((ci.getIndex() >= attribs[i].begin_index) && (ci.getIndex() < attribs[i].end_index)) m.putAll(attribs[i].attribs); } return(m);}
12,565
private ThreadGroup() { this.parent = null; this.name = "Root Thread Group"; this.maxPriority = java.lang.Thread.MAX_PRIORITY; this.daemon = false; this.process = VmProcess.getRootProcess(this); }
private ThreadGroup() { this.parent = null; this.name = "Root Thread Group"; this.maxPriority = java.lang.Thread.MAX_PRIORITY; this.daemon = false; this.process = VmProcess.getRootProcess(this); }
12,566
public int activeCount() { return allThreadsCount(); }
public int activeCount() { return allThreadsCount(); }
12,567
public int activeGroupCount() { return allGroupsCount(); }
public int activeGroupCount() { return allGroupsCount(); }
12,568
public boolean allowThreadSuspension(boolean b) { // Ignore return true; }
public boolean allowThreadSuspension(boolean b) { // Ignore return true; }
12,569
public final void checkAccess() { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkAccess(this); }
public final void checkAccess() { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkAccess(this); }
12,570
public final void destroy() { checkAccess(); if (destroyed) throw new IllegalThreadStateException("ThreadGroup has already been destroyed"); if (threads.size() > 0) throw new IllegalThreadStateException("ThreadGroup has Threads remaining"); Enumeration e = groups.elements(); while (e.hasMoreElements()) { ThreadGroup g = (ThreadGroup) e.nextElement(); g.destroy(); } parent.remove(this); destroyed = true; }
public final void destroy() { checkAccess(); if (destroyed) throw new IllegalThreadStateException("ThreadGroup has already been destroyed"); if (threads.size() > 0) throw new IllegalThreadStateException("ThreadGroup has Threads remaining"); Enumeration e = groups.elements(); while (e.hasMoreElements()) { ThreadGroup g = (ThreadGroup) e.nextElement(); g.destroy(); } parent.remove(this); destroyed = true; }
12,571
public int enumerate(Thread[] list) { return enumerate(list, false); }
public int enumerate(Thread[] list) { return enumerate(list, false); }
12,572
public final int getMaxPriority() { return maxPriority; }
public final int getMaxPriority() { return maxPriority; }
12,573
public final ThreadGroup getParent() { return parent; }
public final ThreadGroup getParent() { return parent; }
12,574
public final boolean isDaemon() { return daemon; }
public final boolean isDaemon() { return daemon; }
12,575
public boolean isDestroyed() { return destroyed; }
public boolean isDestroyed() { return destroyed; }
12,576
public final boolean parentOf(ThreadGroup g) { return (this == g) || parentOf(g.getParent()); }
public final boolean parentOf(ThreadGroup g) { return (this == g) || parentOf(g.getParent()); }
12,577
public final void resume() { checkAccess(); Enumeration et = threads.elements(); while (et.hasMoreElements()) { Thread t = (Thread) et.nextElement(); t.resume(); } Enumeration eg = groups.elements(); while (eg.hasMoreElements()) { ThreadGroup g = (ThreadGroup) et.nextElement(); g.resume(); } }
public final void resume() { checkAccess(); Enumeration et = threads.elements(); while (et.hasMoreElements()) { Thread t = (Thread) et.nextElement(); t.resume(); } Enumeration eg = groups.elements(); while (eg.hasMoreElements()) { ThreadGroup g = (ThreadGroup) et.nextElement(); g.resume(); } }
12,578
public final void setDaemon(boolean daemon) { checkAccess(); this.daemon = daemon; }
public final void setDaemon(boolean daemon) { checkAccess(); this.daemon = daemon; }
12,579
public final void setMaxPriority(int n) { checkAccess(); if (n < Thread.MIN_PRIORITY || n > Thread.MAX_PRIORITY) throw new IllegalArgumentException("Invalid priority: " + n); if (parent != null && n > parent.maxPriority) n = parent.maxPriority; maxPriority = n; Enumeration e = groups.elements(); while (e.hasMoreElements()) { ThreadGroup g = (ThreadGroup) e.nextElement(); g.setMaxPriority(n); } }
public final void setMaxPriority(int n) { checkAccess(); if (n < Thread.MIN_PRIORITY || n > Thread.MAX_PRIORITY) throw new IllegalArgumentException("Invalid priority: " + n); if (parent != null && n > parent.maxPriority) n = parent.maxPriority; maxPriority = n; Enumeration e = groups.elements(); while (e.hasMoreElements()) { ThreadGroup g = (ThreadGroup) e.nextElement(); g.setMaxPriority(n); } }
12,580
public final void stop() { checkAccess(); Enumeration et = threads.elements(); while (et.hasMoreElements()) { Thread t = (Thread) et.nextElement(); t.stop(); } Enumeration eg = groups.elements(); while (eg.hasMoreElements()) { ThreadGroup g = (ThreadGroup) eg.nextElement(); g.stop(); } }
public final void stop() { checkAccess(); Enumeration et = threads.elements(); while (et.hasMoreElements()) { Thread t = (Thread) et.nextElement(); t.stop(); } Enumeration eg = groups.elements(); while (eg.hasMoreElements()) { ThreadGroup g = (ThreadGroup) eg.nextElement(); g.stop(); } }
12,581
public final void suspend() { checkAccess(); Enumeration et = threads.elements(); while (et.hasMoreElements()) { Thread t = (Thread) et.nextElement(); t.suspend(); } Enumeration eg = groups.elements(); while (eg.hasMoreElements()) { ThreadGroup g = (ThreadGroup) eg.nextElement(); g.suspend(); } }
public final void suspend() { checkAccess(); Enumeration et = threads.elements(); while (et.hasMoreElements()) { Thread t = (Thread) et.nextElement(); t.suspend(); } Enumeration eg = groups.elements(); while (eg.hasMoreElements()) { ThreadGroup g = (ThreadGroup) eg.nextElement(); g.suspend(); } }
12,582
public String toString() { return getClass().getName() + "[name=" + name + ",maxpri=" + maxPriority + "]"; }
public String toString() { return getClass().getName() + "[name=" + name + ",maxpri=" + maxPriority + "]"; }
12,583
public void uncaughtException(Thread t, Throwable e) { if (parent != null) parent.uncaughtException(t, e); else if (!(e instanceof ThreadDeath)) e.printStackTrace(); }
public void uncaughtException(Thread t, Throwable e) { if (parent != null) parent.uncaughtException(t, e); else if (!(e instanceof ThreadDeath)) e.printStackTrace(); }
12,584
public JInternalFrame createInternalFrame(Component parentComponent, String title) throws RuntimeException { JDesktopPane toUse = getDesktopPaneForComponent(parentComponent); if (toUse == null) throw new RuntimeException("parentComponent does not have a valid parent"); JInternalFrame frame = new JInternalFrame(title); inputValue = UNINITIALIZED_VALUE; value = UNINITIALIZED_VALUE; frame.setClosable(true); toUse.add(frame); // FIXME: JLayeredPane broken? See bug # 16576 // frame.setLayer(JLayeredPane.MODAL_LAYER); return frame; }
public JInternalFrame createInternalFrame(Component parentComponent, String title) throws RuntimeException { JLayeredPane toUse = getDesktopPaneForComponent(parentComponent); if (toUse == null) throw new RuntimeException("parentComponent does not have a valid parent"); JInternalFrame frame = new JInternalFrame(title); inputValue = UNINITIALIZED_VALUE; value = UNINITIALIZED_VALUE; frame.setClosable(true); toUse.add(frame); // FIXME: JLayeredPane broken? See bug # 16576 // frame.setLayer(JLayeredPane.MODAL_LAYER); return frame; }
12,586
public JInternalFrame createInternalFrame(Component parentComponent, String title) throws RuntimeException { JDesktopPane toUse = getDesktopPaneForComponent(parentComponent); if (toUse == null) throw new RuntimeException("parentComponent does not have a valid parent"); JInternalFrame frame = new JInternalFrame(title); inputValue = UNINITIALIZED_VALUE; value = UNINITIALIZED_VALUE; frame.setClosable(true); toUse.add(frame); // FIXME: JLayeredPane broken? See bug # 16576 // frame.setLayer(JLayeredPane.MODAL_LAYER); return frame; }
public JInternalFrame createInternalFrame(Component parentComponent, String title) throws RuntimeException { JDesktopPane toUse = getDesktopPaneForComponent(parentComponent); if (toUse == null) toUse = JLayeredPane.getLayeredPaneAbove(parentComponent); if (toUse == null) throw new RuntimeException ("parentComponent does not have a valid parent"); JInternalFrame frame = new JInternalFrame(title); inputValue = UNINITIALIZED_VALUE; value = UNINITIALIZED_VALUE; frame.setClosable(true); toUse.add(frame); // FIXME: JLayeredPane broken? See bug # 16576 // frame.setLayer(JLayeredPane.MODAL_LAYER); return frame; }
12,587
public static int showInternalConfirmDialog(Component parentComponent, Object message) { JOptionPane pane = new JOptionPane(message); JInternalFrame frame = pane.createInternalFrame(parentComponent, null); startModal(frame, pane); return ((Integer) pane.getValue()).intValue(); }
public static int showInternalConfirmDialog(Component parentComponent, Object message) { JOptionPane pane = new JOptionPane(message); JInternalFrame frame = pane.createInternalFrame(parentComponent, null); startModal(frame); return ((Integer) pane.getValue()).intValue(); }
12,589
public static String showInternalInputDialog(Component parentComponent, Object message) { JOptionPane pane = new JOptionPane(message); pane.setWantsInput(true); JInternalFrame frame = pane.createInternalFrame(parentComponent, null); startModal(frame, pane); return (String) pane.getInputValue(); }
public static String showInternalInputDialog(Component parentComponent, Object message) { JOptionPane pane = new JOptionPane(message); pane.setWantsInput(true); JInternalFrame frame = pane.createInternalFrame(parentComponent, null); startModal(frame); return (String) pane.getInputValue(); }
12,590
public static void showInternalMessageDialog(Component parentComponent, Object message) { JOptionPane pane = new JOptionPane(message); JInternalFrame frame = pane.createInternalFrame(parentComponent, null); startModal(frame, pane); }
public static void showInternalMessageDialog(Component parentComponent, Object message) { JOptionPane pane = new JOptionPane(message); JInternalFrame frame = pane.createInternalFrame(parentComponent, null); startModal(frame); }
12,591
public static int showInternalOptionDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue) { JOptionPane pane = new JOptionPane(message, messageType, optionType, icon, options, initialValue); JInternalFrame frame = pane.createInternalFrame(parentComponent, title); startModal(frame, pane); return ((Integer) pane.getValue()).intValue(); }
public static int showInternalOptionDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue) { JOptionPane pane = new JOptionPane(message, messageType, optionType, icon, options, initialValue); JInternalFrame frame = pane.createInternalFrame(parentComponent, title); startModal(frame); return ((Integer) pane.getValue()).intValue(); }
12,592
private static void startModal(JInternalFrame f, JOptionPane pane) { f.getContentPane().add(pane); f.pack(); f.show(); Dimension pref = f.getPreferredSize(); f.setBounds(0, 0, pref.width, pref.height); synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { } } }
private static void startModal(JInternalFrame f) { f.getContentPane().add(pane); f.pack(); f.show(); Dimension pref = f.getPreferredSize(); f.setBounds(0, 0, pref.width, pref.height); synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { } } }
12,593
private static void startModal(JInternalFrame f, JOptionPane pane) { f.getContentPane().add(pane); f.pack(); f.show(); Dimension pref = f.getPreferredSize(); f.setBounds(0, 0, pref.width, pref.height); synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { } } }
private static void startModal(JInternalFrame f, JOptionPane pane) { f.getContentPane().add(pane); f.pack(); f.show(); Dimension pref = f.getPreferredSize(); f.setBounds(0, 0, pref.width, pref.height); synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { } } }
12,594
protected final Class defineClass( String name, byte[] b, int off, int len, CodeSource cs) { // FIXME: Need to cache ProtectionDomains according to 1.3 docs. if (cs != null) { ProtectionDomain protectionDomain = new ProtectionDomain(cs, getPermissions(cs)); return super.defineClass(name, b, off, len, protectionDomain); } else return super.defineClass(name, b, off, len); }
protected final Class defineClass( String name, byte[] b, int off, int len, CodeSource cs) { // FIXME: Need to cache ProtectionDomains according to 1.3 docs. if (cs != null) { ProtectionDomain protectionDomain = new ProtectionDomain(cs, getPermissions(cs)); return super.defineClass(name, b, off, len, protectionDomain); } else return super.defineClass(name, b, off, len); }
12,595
protected PermissionCollection getPermissions(CodeSource cs) { Policy policy = Policy.getPolicy(); return policy.getPermissions(cs); }
protected PermissionCollection getPermissions(CodeSource cs) { Policy policy = Policy.getPolicy(); return policy.getPermissions(cs); }
12,596
public ProtectionDomain(CodeSource code_source, PermissionCollection perms) { this.code_source = code_source; this.perms = perms; if (perms != null) perms.setReadOnly(); }
public ProtectionDomain(CodeSource code_source, PermissionCollection perms) { this.code_source = code_source; this.perms = perms; if (perms != null) perms.setReadOnly(); }
12,597
protected final Class defineClass(String name, byte[] data, int offset, int length, ProtectionDomain protDomain) { if (data == null) { throw new NullPointerException(); } if (offset < 0 || length < 0 || (offset + length) > data.length) { throw new IndexOutOfBoundsException(); } if (protDomain == null) { protDomain = (ProtectionDomain) AccessController .doPrivileged(new PrivilegedAction() { public Object run() { return getDefaultProtectionDomain(); } }); } return vmClassLoader .defineClass(name, data, offset, length, protDomain).asClass(); }
protected final Class defineClass(String name, byte[] data, int offset, int length, ProtectionDomain protDomain) { if (data == null) { throw new NullPointerException(); } if (offset < 0 || length < 0 || (offset + length) > data.length) { throw new IndexOutOfBoundsException(); } if (protDomain == null) { protDomain = (ProtectionDomain) AccessController .doPrivileged(new PrivilegedAction() { public Object run() { return getDefaultProtectionDomain(); } }); } return vmClassLoader .defineClass(name, data, offset, length, protDomain).asClass(); }
12,598
public void eventDispatched(AWTEvent event) { int id = event == null ? 0 : event.getID(); if (((mask & AWTEvent.ACTION_EVENT_MASK) != 0 && event instanceof ActionEvent) || ((mask & AWTEvent.ADJUSTMENT_EVENT_MASK) != 0 && event instanceof AdjustmentEvent) || ((mask & AWTEvent.COMPONENT_EVENT_MASK) != 0 && event instanceof ComponentEvent && (id >= ComponentEvent.COMPONENT_FIRST && id <= ComponentEvent.COMPONENT_LAST)) || ((mask & AWTEvent.CONTAINER_EVENT_MASK) != 0 && event instanceof ContainerEvent) || ((mask & AWTEvent.FOCUS_EVENT_MASK) != 0 && event instanceof FocusEvent) || ((mask & AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) != 0 && event instanceof HierarchyEvent && (id == HierarchyEvent.ANCESTOR_MOVED || id == HierarchyEvent.ANCESTOR_RESIZED)) || ((mask & AWTEvent.HIERARCHY_EVENT_MASK) != 0 && event instanceof HierarchyEvent && id == HierarchyEvent.HIERARCHY_CHANGED) || ((mask & AWTEvent.INPUT_METHOD_EVENT_MASK) != 0 && event instanceof InputMethodEvent) || ((mask & AWTEvent.INVOCATION_EVENT_MASK) != 0 && event instanceof InvocationEvent) || ((mask & AWTEvent.ITEM_EVENT_MASK) != 0 && event instanceof ItemEvent) || ((mask & AWTEvent.KEY_EVENT_MASK) != 0 && event instanceof KeyEvent) || ((mask & AWTEvent.MOUSE_EVENT_MASK) != 0 && event instanceof MouseEvent && (id == MouseEvent.MOUSE_PRESSED || id == MouseEvent.MOUSE_RELEASED || id == MouseEvent.MOUSE_CLICKED || id == MouseEvent.MOUSE_ENTERED || id == MouseEvent.MOUSE_EXITED)) || ((mask & AWTEvent.MOUSE_MOTION_EVENT_MASK) != 0 && event instanceof MouseEvent && (id == MouseEvent.MOUSE_MOVED || id == MouseEvent.MOUSE_DRAGGED)) || ((mask & AWTEvent.MOUSE_WHEEL_EVENT_MASK) != 0 && event instanceof MouseWheelEvent) || ((mask & AWTEvent.PAINT_EVENT_MASK) != 0 && event instanceof PaintEvent) || ((mask & AWTEvent.TEXT_EVENT_MASK) != 0 && event instanceof TextEvent) || ((mask & AWTEvent.WINDOW_EVENT_MASK) != 0 && event instanceof WindowEvent && (id == WindowEvent.WINDOW_OPENED || id == WindowEvent.WINDOW_CLOSING || id == WindowEvent.WINDOW_CLOSED || id == WindowEvent.WINDOW_ICONIFIED || id == WindowEvent.WINDOW_DEICONIFIED || id == WindowEvent.WINDOW_ACTIVATED || id == WindowEvent.WINDOW_DEACTIVATED)) || ((mask & AWTEvent.WINDOW_FOCUS_EVENT_MASK) != 0 && event instanceof WindowEvent && (id == WindowEvent.WINDOW_GAINED_FOCUS || id == WindowEvent.WINDOW_LOST_FOCUS)) || ((mask & AWTEvent.WINDOW_STATE_EVENT_MASK) != 0 && event instanceof WindowEvent && id == WindowEvent.WINDOW_STATE_CHANGED)) ((AWTEventListener) getListener()).eventDispatched(event); }
public void eventDispatched(AWTEvent event) { int id = event == null ? 0 : event.getID(); if (((mask & AWTEvent.ACTION_EVENT_MASK) != 0 && event instanceof ActionEvent) || ((mask & AWTEvent.ADJUSTMENT_EVENT_MASK) != 0 && event instanceof AdjustmentEvent) || ((mask & AWTEvent.COMPONENT_EVENT_MASK) != 0 && event instanceof ComponentEvent && (id >= ComponentEvent.COMPONENT_FIRST && id <= ComponentEvent.COMPONENT_LAST)) || ((mask & AWTEvent.CONTAINER_EVENT_MASK) != 0 && event instanceof ContainerEvent) || ((mask & AWTEvent.FOCUS_EVENT_MASK) != 0 && event instanceof FocusEvent) || ((mask & AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) != 0 && event instanceof HierarchyEvent && (id == HierarchyEvent.ANCESTOR_MOVED || id == HierarchyEvent.ANCESTOR_RESIZED)) || ((mask & AWTEvent.HIERARCHY_EVENT_MASK) != 0 && event instanceof HierarchyEvent && id == HierarchyEvent.HIERARCHY_CHANGED) || ((mask & AWTEvent.INPUT_METHOD_EVENT_MASK) != 0 && event instanceof InputMethodEvent) || ((mask & AWTEvent.INVOCATION_EVENT_MASK) != 0 && event instanceof InvocationEvent) || ((mask & AWTEvent.ITEM_EVENT_MASK) != 0 && event instanceof ItemEvent) || ((mask & AWTEvent.KEY_EVENT_MASK) != 0 && event instanceof KeyEvent) || ((mask & AWTEvent.MOUSE_EVENT_MASK) != 0 && event instanceof MouseEvent && (id == MouseEvent.MOUSE_PRESSED || id == MouseEvent.MOUSE_RELEASED || id == MouseEvent.MOUSE_CLICKED || id == MouseEvent.MOUSE_ENTERED || id == MouseEvent.MOUSE_EXITED)) || ((mask & AWTEvent.MOUSE_MOTION_EVENT_MASK) != 0 && event instanceof MouseEvent && (id == MouseEvent.MOUSE_MOVED || id == MouseEvent.MOUSE_DRAGGED)) || ((mask & AWTEvent.MOUSE_WHEEL_EVENT_MASK) != 0 && event instanceof MouseWheelEvent) || ((mask & AWTEvent.PAINT_EVENT_MASK) != 0 && event instanceof PaintEvent) || ((mask & AWTEvent.TEXT_EVENT_MASK) != 0 && event instanceof TextEvent) || ((mask & AWTEvent.WINDOW_EVENT_MASK) != 0 && event instanceof WindowEvent && (id == WindowEvent.WINDOW_OPENED || id == WindowEvent.WINDOW_CLOSING || id == WindowEvent.WINDOW_CLOSED || id == WindowEvent.WINDOW_ICONIFIED || id == WindowEvent.WINDOW_DEICONIFIED || id == WindowEvent.WINDOW_ACTIVATED || id == WindowEvent.WINDOW_DEACTIVATED)) || ((mask & AWTEvent.WINDOW_FOCUS_EVENT_MASK) != 0 && event instanceof WindowEvent && (id == WindowEvent.WINDOW_GAINED_FOCUS || id == WindowEvent.WINDOW_LOST_FOCUS)) || ((mask & AWTEvent.WINDOW_STATE_EVENT_MASK) != 0 && event instanceof WindowEvent && id == WindowEvent.WINDOW_STATE_CHANGED)) ((AWTEventListener) getListener()).eventDispatched(event); }
12,599
public void installDefaults(JPanel p) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); p.setBackground(defaults.getColor("Panel.background")); p.setOpaque(true); }
public void installDefaults(JPanel p) { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); p.setBackground(defaults.getColor("Panel.background")); p.setOpaque(true); }
12,606