synchronized (target.getTreeLock()) { int hgap = getHgap(); int vgap = getVgap(); synchronized (target.getTreeLock()) { int minx = Integer.MAX_VALUE; int miny = Integer.MIN_VALUE;
public void paint(Component c, Graphics2D g, List<Object> gradient, int x, int y, int w, int h, boolean isVertical) { int imageWidth; int imageHeight; if (isVertical) { imageWidth = IMAGE_SIZE; imageHeight = h; } else { imageWidth = w; imageHeight = IMAGE_SIZE; } synchronized(c.getTreeLock()) { this.w = w; this.h = h; this.paint(c, g, x, y, imageWidth, imageHeight, gradient, isVertical); } }
public static BufferedImage componentToImage(Component component, boolean visible) { if (visible) { BufferedImage img = new BufferedImage(component.getWidth(), component.getHeight(), BufferedImage.TRANSLUCENT); Graphics2D g2d = (Graphics2D) img.getGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); component.paintAll(g2d); return img; } else { component.setSize(component.getPreferredSize()); layoutComponent(component); BufferedImage img = new BufferedImage(component.getWidth(), component.getHeight(), BufferedImage.TRANSLUCENT); CellRendererPane crp = new CellRendererPane(); crp.add(component); crp.paintComponent(img.createGraphics(), component, crp, component.getBounds()); return img; } } private static void layoutComponent(Component c) { synchronized (c.getTreeLock()) { c.doLayout(); if (c instanceof Container) { for (Component child : ((Container) c).getComponents()) { layoutComponent(child); } } } }
synchronized (c.getTreeLock()) { c.doLayout(); if (c instanceof Container) {
synchronized (target.getTreeLock()) synchronized (target.getTreeLock()) synchronized (target.getTreeLock())
/** * {@inheritDoc} */ @Override public void removeLayoutComponent(final Component comp) { synchronized (comp.getTreeLock()) { components.remove(comp); } }
public void removeLayoutComponent(Component _comp) { synchronized(_comp.getTreeLock()) { // Object name=table_.get(_comp); // if(name!=null) // { table_.remove(_comp); // table_.remove(name); // } } }
/** * @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component) */ public void removeLayoutComponent( final Component aComponent ) { synchronized ( aComponent.getTreeLock() ) { this.components.remove( aComponent ); } } }
/** * {@inheritDoc} */ @Override public void removeLayoutComponent(final Component comp) { synchronized (comp.getTreeLock()) { components.remove(comp); } }
/** * {@inheritDoc} */ public void removeLayoutComponent(final Component comp) { synchronized (comp.getTreeLock()) { components.remove(comp); } }
/** * {@inheritDoc} */ @Override public void removeLayoutComponent(final Component comp) { synchronized (comp.getTreeLock()) { components.remove(comp); } }
/** * {@inheritDoc} */ @Override public void removeLayoutComponent(final Component comp) { synchronized (comp.getTreeLock()) { components.remove(comp); } }
public void removeLayoutComponent(Component _comp) { synchronized(_comp.getTreeLock()) { // Object name=table_.get(_comp); // if(name!=null) // { table_.remove(_comp); // table_.remove(name); // } } }
private static Object getLock(Object obj) { if (obj == null) return null; if (obj instanceof Component) { return ((Component) obj).getTreeLock(); } if (obj instanceof Model) { // this is incorrect but is an exmple return ((Model) obj).getLock(); } return null; }
public void addLayoutComponent(Component comp, Object constraints) { synchronized (comp.getTreeLock()) { if ((constraints == null) || (constraints instanceof String)) { addLayoutComponent((String) constraints, comp); } else { throw new IllegalArgumentException("cannot add to layout: constraint must be a string (or null)"); } } }
public void addLayoutComponent(Component _comp, Object _constraints) { synchronized(_comp.getTreeLock()) { if((_constraints==null)||(_constraints instanceof String)) addLayoutComponent2((String)_constraints,_comp); else throw new IllegalArgumentException ("Can not add to layout: constraint must be a string (or null)"); } }
public void addLayoutComponent(Component _comp, Object _constraints) { synchronized(_comp.getTreeLock()) { if((_constraints==null)||(_constraints instanceof String)) addLayoutComponent2((String)_constraints,_comp); else throw new IllegalArgumentException ("Can not add to layout: constraint must be a string (or null)"); } }
private static final void layoutComponent(final Component c) { synchronized (c.getTreeLock()) { c.doLayout(); if (c instanceof Container) { for (final Component child : ((Container)c).getComponents()) { layoutComponent(child); } } } c.validate(); } }
public void componentRemoved(ContainerEvent e) { //System.out.println(e.getChild().getClass().getName() + " removed from container = " + e.getContainer().getClass().getName()); synchronized (e.getChild().getTreeLock()) { removeInternalListeners(e.getChild()); } } }
public void componentAdded(ContainerEvent e) { //System.out.println(e.getChild().getClass().getName() + " add to container = " + e.getContainer().getClass().getName()); synchronized (e.getChild().getTreeLock()) { addInternalListeners(e.getChild()); } }