Ejemplo n.º 1
1
 final void disableTrueDoubleBuffering() {
   if (useTrueDoubleBuffering) {
     if (!IGNORE_DISABLE_TRUE_DOUBLE_BUFFERING) {
       if (LOG_DISABLE_TRUE_DOUBLE_BUFFERING) {
         System.out.println("Disabling true double buffering for " + this);
         Thread.dumpStack();
       }
       useTrueDoubleBuffering = false;
       RepaintManager.currentManager(this).doubleBufferingChanged(this);
     }
   }
 }
Ejemplo n.º 2
0
 /**
  * Repaints the specified rectangle of this component within <code>time</code> milliseconds. Refer
  * to <code>RepaintManager</code> for details on how the repaint is handled.
  *
  * @param time maximum time in milliseconds before update
  * @param x the <i>x</i> coordinate
  * @param y the <i>y</i> coordinate
  * @param width the width
  * @param height the height
  * @see RepaintManager
  * @since 1.6
  */
 public void repaint(long time, int x, int y, int width, int height) {
   if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
     RepaintManager.currentManager(this).addDirtyRegion(this, x, y, width, height);
   } else {
     super.repaint(time, x, y, width, height);
   }
 }
Ejemplo n.º 3
0
  public void propertyChange(PropertyChangeEvent event) {
    debug(this + " " + "propertyChange: " + event.getSource() + " " + event.getPropertyName());

    if (event.getSource() == searchnav) {
      String changeName = event.getPropertyName();
      if (changeName.equals("helpModel")) {

        reloadData((HelpModel) event.getNewValue());

      } else if (changeName.equals("font")) {
        debug("Font change");
        Font newFont = (Font) event.getNewValue();
        searchparams.setFont(newFont);
        RepaintManager.currentManager(searchparams).markCompletelyDirty(searchparams);
        tree.setFont(newFont);
        RepaintManager.currentManager(tree).markCompletelyDirty(tree);
      }
      // changes to UI property?
    }
  }
Ejemplo n.º 4
0
 /** [Internal] */
 public int print(Graphics g, PageFormat pf, int pi) throws PrinterException {
   if (pi >= 1) {
     return Printable.NO_SUCH_PAGE;
   }
   RepaintManager currentManager = RepaintManager.currentManager(this);
   currentManager.setDoubleBufferingEnabled(false);
   Graphics2D g2 = (Graphics2D) g;
   initState(g2, true);
   g2.translate((int) (pf.getImageableX() + 1), (int) (pf.getImageableY() + 1));
   g2.scale(printScale, printScale);
   doBuffer(g2, true, null);
   currentManager.setDoubleBufferingEnabled(true);
   return Printable.PAGE_EXISTS;
 }
Ejemplo n.º 5
0
 public static void enableDoubleBuffering(Component c) {
   RepaintManager currentManager = RepaintManager.currentManager(c);
   currentManager.setDoubleBufferingEnabled(true);
 }
  private void dragFrameFaster(JComponent f, int newX, int newY) {

    Rectangle previousBounds =
        new Rectangle(currentBounds.x, currentBounds.y, currentBounds.width, currentBounds.height);

    // move the frame
    currentBounds.x = newX;
    currentBounds.y = newY;

    if (didDrag) {
      // Only initiate cleanup if we have actually done a drag.
      emergencyCleanup(f);
    } else {
      didDrag = true;
      // We reset the danger field as until now we haven't actually
      // moved the internal frame so we don't need to initiate repaint.
      ((JInternalFrame) f).danger = false;
    }

    boolean floaterCollision = isFloaterCollision(previousBounds, currentBounds);

    // System.out.println(previousBounds);
    JComponent parent = (JComponent) f.getParent();
    Rectangle visBounds = previousBounds.intersection(desktopBounds);
    //  System.out.println(previousBounds);

    // System.out.println(visBounds);

    RepaintManager currentManager = RepaintManager.currentManager(f);

    currentManager.beginPaint();
    try {
      if (!floaterCollision) {
        currentManager.copyArea(
            parent,
            desktopGraphics,
            visBounds.x,
            visBounds.y,
            visBounds.width,
            visBounds.height,
            newX - previousBounds.x,
            newY - previousBounds.y,
            true);
      }

      f.setBounds(currentBounds);

      if (floaterCollision) {
        // since we couldn't blit we just redraw as fast as possible
        // the isDragging mucking is to avoid activating emergency
        // cleanup
        ((JInternalFrame) f).isDragging = false;
        parent.paintImmediately(currentBounds);
        ((JInternalFrame) f).isDragging = true;
      }

      // fake out the repaint manager.  We'll take care of everything

      currentManager.markCompletelyClean(parent);
      currentManager.markCompletelyClean(f);

      // compute the minimal newly exposed area
      // if the rects intersect then we use computeDifference.  Otherwise
      // we'll repaint the entire previous bounds
      Rectangle[] dirtyRects = null;
      if (previousBounds.intersects(currentBounds)) {
        dirtyRects = SwingUtilities.computeDifference(previousBounds, currentBounds);
      } else {
        dirtyRects = new Rectangle[1];
        dirtyRects[0] = previousBounds;
        //  System.out.println("no intersection");
      }
      ;

      // Fix the damage
      for (int i = 0; i < dirtyRects.length; i++) {
        parent.paintImmediately(dirtyRects[i]);
      }

      // new areas of blit were exposed
      if (!(visBounds.equals(previousBounds))) {
        dirtyRects = SwingUtilities.computeDifference(previousBounds, desktopBounds);
        for (int i = 0; i < dirtyRects.length; i++) {
          dirtyRects[i].x += newX - previousBounds.x;
          dirtyRects[i].y += newY - previousBounds.y;
          ((JInternalFrame) f).isDragging = false;

          parent.paintImmediately(dirtyRects[i]);
          ((JInternalFrame) f).isDragging = true;

          // System.out.println(dirtyRects[i]);
        }
      }
    } finally {
      currentManager.endPaint();
    }

    // update window if it's non-opaque
    Window topLevel = SwingUtilities.getWindowAncestor(f);
    Toolkit tk = Toolkit.getDefaultToolkit();
    if (!AWTAccessor.getWindowAccessor().isOpaque(topLevel)
        && (tk instanceof SunToolkit)
        && ((SunToolkit) tk).needUpdateWindow()) {
      AWTAccessor.getWindowAccessor().updateWindow(topLevel);
    }
  }
Ejemplo n.º 7
0
 /**
  * {@inheritDoc}
  *
  * @since 1.6
  */
 public void setDoubleBuffered(boolean aFlag) {
   if (isDoubleBuffered() != aFlag) {
     super.setDoubleBuffered(aFlag);
     RepaintManager.currentManager(this).doubleBufferingChanged(this);
   }
 }