Ejemplo n.º 1
0
  public void removeLayoutComponent(Component comp, boolean force) {
    synchronized (comp.getTreeLock()) {
      if (comp == free) {

        // There is a bug (feature) in the SWING JLayeredPane. When a component's
        // layer is set using setLayer() the component is removed from it's container
        // and then re-added. Unfortunately it is re-added with null constraints. This
        // would cause the free component to become a CENTER component. To get round
        // this DO NOT remove a free component from the layout.

        if (force) {
          System.out.println("Removed free component " + comp);
          free = null;
        } else {
          // on dragging and dropping a result into annotView this message comes
          // with the JScrollBar which seems bizarre to me and bears looking into.
          // For now im just commenting out the message.
          // their should be a if (Debug.DEBUG) or something
          // System.out.println("Attempt to removed free component " + comp);
        }
      } else {
        // System.out.println("Removed super component " + comp);
        super.removeLayoutComponent(comp);
      }
    }
  }
Ejemplo n.º 2
0
 public void addLayoutComponent(Component component, Object constraints) {
   synchronized (component.getTreeLock()) {
     if (constraints != null && ((String) constraints).equals(NONE)) {
       free = component;
       // System.out.println("Added free component " + component);
     } else {
       if (component != free) {
         // System.out.println("Added super component " + component);
         super.addLayoutComponent(component, constraints);
       } else {
         System.out.println("Tried to readd free component " + component);
       }
     }
   }
   // System.out.println("returned from addLayoutComponent");
 }
Ejemplo n.º 3
0
 public void paint(
     Component c,
     Graphics2D g,
     java.util.List 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;
     paint(c, g, x, y, imageWidth, imageHeight, gradient, isVertical);
   }
 }