예제 #1
0
 /**
  * Add a component in the list of components that should be refreshed. If <i>c</i> already has a
  * dirty region, the rectangle <i>(x,y,w,h)</i> will be unioned with the region that should be
  * redrawn.
  *
  * @param c Component to repaint, null results in nothing happening.
  * @param x X coordinate of the region to repaint
  * @param y Y coordinate of the region to repaint
  * @param w Width of the region to repaint
  * @param h Height of the region to repaint
  * @see JComponent#repaint
  */
 @Override
 public void addDirtyRegion(JComponent c, int x, int y, int w, int h) {
   Rectangle dirtyRegion = getDirtyRegion(c);
   if (dirtyRegion.width == 0 && dirtyRegion.height == 0) {
     int lastDeltaX = c.getX();
     int lastDeltaY = c.getY();
     Container parent = c.getParent();
     while (parent instanceof JComponent) {
       if (!parent.isVisible() || !parent.isDisplayable()) {
         return;
       }
       if (parent instanceof JXPanel
           && (((JXPanel) parent).getAlpha() < 1f || !parent.isOpaque())) {
         x += lastDeltaX;
         y += lastDeltaY;
         lastDeltaX = lastDeltaY = 0;
         c = (JComponent) parent;
       }
       lastDeltaX += parent.getX();
       lastDeltaY += parent.getY();
       parent = parent.getParent();
     }
   }
   super.addDirtyRegion(c, x, y, w, h);
 }
 private void setupDragMode(JComponent f) {
   JDesktopPane p = getDesktopPane(f);
   Container parent = f.getParent();
   dragMode = DEFAULT_DRAG_MODE;
   if (p != null) {
     String mode = (String) p.getClientProperty("JDesktopPane.dragMode");
     Window window = SwingUtilities.getWindowAncestor(f);
     if (window != null && !AWTUtilities.isWindowOpaque(window)) {
       dragMode = DEFAULT_DRAG_MODE;
     } else if (mode != null && mode.equals("outline")) {
       dragMode = OUTLINE_DRAG_MODE;
     } else if (mode != null
         && mode.equals("faster")
         && f instanceof JInternalFrame
         && ((JInternalFrame) f).isOpaque()
         && (parent == null || parent.isOpaque())) {
       dragMode = FASTER_DRAG_MODE;
     } else {
       if (p.getDragMode() == JDesktopPane.OUTLINE_DRAG_MODE) {
         dragMode = OUTLINE_DRAG_MODE;
       } else if (p.getDragMode() == JDesktopPane.LIVE_DRAG_MODE
           && f instanceof JInternalFrame
           && ((JInternalFrame) f).isOpaque()) {
         dragMode = FASTER_DRAG_MODE;
       } else {
         dragMode = DEFAULT_DRAG_MODE;
       }
     }
   }
 }
예제 #3
0
 /**
  * Print Oarent of Component
  *
  * @param c component
  */
 static void printParents(JComponent c) {
   if (c.getName() == null) c.setName("C" + String.valueOf(s_no++));
   System.out.print(c.getName());
   System.out.print(" - " + c.getClass().getName());
   System.out.println(
       " ** "
           + c.isOpaque()
           + " bg="
           + (c.getClientProperty(CompiereLookAndFeel.BACKGROUND) != null));
   //
   Container container = c.getParent();
   while (container != null) {
     System.out.print(
         " - "
             + container.getName()
             + " "
             + container.getClass().getName()
             + " ** "
             + container.isOpaque());
     if (container instanceof JComponent)
       System.out.print(
           " bg="
               + (((JComponent) container).getClientProperty(CompiereLookAndFeel.BACKGROUND)
                   != null));
     System.out.println();
     container = container.getParent();
   }
 } //  printParents
예제 #4
0
    public WrapperContainer(Container c) {
      alpha = 1.0f;
      collapsedState = false;
      setView(c);

      // we must ensure the container is opaque. It is not opaque it introduces
      // painting glitches specially on Linux with JDK 1.5 and GTK look and feel.
      // GTK look and feel calls setOpaque(false)
      if (c instanceof JComponent && !c.isOpaque()) {
        ((JComponent) c).setOpaque(true);
      }
    }