Ejemplo n.º 1
0
 @Override
 public void removeLayoutComponent(Component comp) {
   if (comp instanceof JRibbon) {
     throw new IllegalArgumentException("Can't remove JRibbon component");
   }
   super.removeLayoutComponent(comp);
 }
Ejemplo n.º 2
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);
      }
    }
  }