/**
  * Now, in this function, that will be called manually at the end of each operation, we repaint
  * the whole drawing area.
  */
 public void paintAll() {
   super.addDirtyRegion(
       drawingArea,
       drawingArea.getX(),
       drawingArea.getY(),
       drawingArea.getWidth(),
       drawingArea.getHeight());
   super.paintDirtyRegions();
 }
 @Override
 public void mouseMoved(MouseEvent e) {
   Point p =
       SwingUtilities.convertPoint(
           e.getComponent(), e.getX(), e.getY(), VsketchPreviewPane.this);
   boolean visible = buttonVisible;
   buttonVisible =
       p.getX() > getFitModeButtonX() - 40
           && p.getX() < getFitModeButtonX() + getFitModeButtonWidth();
   buttonVisible &=
       p.getY() > getFitModeButtonY() - 40
           && p.getY() < getFitModeButtonY() + getFitModeButtonHeight();
   if (visible != buttonVisible) {
     RepaintManager rm = RepaintManager.currentManager(VsketchPreviewPane.this);
     rm.addDirtyRegion(
         VsketchPreviewPane.this,
         getFitModeButtonX(),
         getFitModeButtonY(),
         getFitModeButtonWidth(),
         getFitModeButtonHeight());
   }
 }
Example #3
0
  @Override
  public void addDirtyRegion(JComponent c, int x, int y, int w, int h) {
    try {
      throw new Exception();
    } catch (Exception exc) {
      StringBuffer sb = new StringBuffer();
      StackTraceElement[] stack = exc.getStackTrace();
      int count = 0;
      for (StackTraceElement stackEntry : stack) {
        if (count++ > 8) break;
        sb.append("\t");
        sb.append(stackEntry.getClassName() + ".");
        sb.append(stackEntry.getMethodName() + " [");
        sb.append(stackEntry.getLineNumber() + "]");
        sb.append("\n");
      }
      System.out.println("**** Repaint stack ****");
      System.out.println(sb.toString());
    }

    super.addDirtyRegion(c, x, y, w, h);
  }
 @Override
 public void addDirtyRegion(JComponent component, int x, int y, int w, int h) {
   checkThreadViolations(component);
   super.addDirtyRegion(component, x, y, w, h);
 }
 public synchronized void addDirtyRegion(JComponent component, int x, int y, int w, int h) {
   checkEDTRule(component);
   super.addDirtyRegion(component, x, y, w, h);
 }