Java Code Examples for java.awt.event.PaintEvent#PAINT

The following examples show how to use java.awt.event.PaintEvent#PAINT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WComponentPeer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void coalescePaintEvent(PaintEvent e) {
    Rectangle r = e.getUpdateRect();
    if (!(e instanceof IgnorePaintEvent)) {
        paintArea.add(r, e.getID());
    }

    if (log.isLoggable(PlatformLogger.Level.FINEST)) {
        switch(e.getID()) {
        case PaintEvent.UPDATE:
            log.finest("coalescePaintEvent: UPDATE: add: x = " +
                r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height);
            return;
        case PaintEvent.PAINT:
            log.finest("coalescePaintEvent: PAINT: add: x = " +
                r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height);
            return;
        }
    }
}
 
Example 2
Source File: WComponentPeer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void coalescePaintEvent(PaintEvent e) {
    Rectangle r = e.getUpdateRect();
    if (!(e instanceof IgnorePaintEvent)) {
        paintArea.add(r, e.getID());
    }

    if (log.isLoggable(PlatformLogger.Level.FINEST)) {
        switch(e.getID()) {
        case PaintEvent.UPDATE:
            log.finest("coalescePaintEvent: UPDATE: add: x = " +
                r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height);
            return;
        case PaintEvent.PAINT:
            log.finest("coalescePaintEvent: PAINT: add: x = " +
                r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height);
            return;
        }
    }
}
 
Example 3
Source File: XComponentPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void coalescePaintEvent(PaintEvent e) {
    Rectangle r = e.getUpdateRect();
    if (!(e instanceof IgnorePaintEvent)) {
        paintArea.add(r, e.getID());
    }
    if (true) {
        switch(e.getID()) {
          case PaintEvent.UPDATE:
              if (log.isLoggable(PlatformLogger.Level.FINER)) {
                  log.finer("XCP coalescePaintEvent : UPDATE : add : x = " +
                        r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
              }
              return;
          case PaintEvent.PAINT:
              if (log.isLoggable(PlatformLogger.Level.FINER)) {
                  log.finer("XCP coalescePaintEvent : PAINT : add : x = " +
                        r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
              }
              return;
        }
    }
}
 
Example 4
Source File: RepaintArea.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds a <code>Rectangle</code> to this <code>RepaintArea</code>.
 * PAINT Rectangles are divided into mostly vertical and mostly horizontal.
 * Each group is unioned together.
 * UPDATE Rectangles are unioned.
 *
 * @param   r   the specified <code>Rectangle</code>
 * @param   id  possible values PaintEvent.UPDATE or PaintEvent.PAINT
 * @since   1.3
 */
public synchronized void add(Rectangle r, int id) {
    // Make sure this new rectangle has positive dimensions
    if (r.isEmpty()) {
        return;
    }
    int addTo = UPDATE;
    if (id == PaintEvent.PAINT) {
        addTo = (r.width > r.height) ? HORIZONTAL : VERTICAL;
    }
    if (paintRects[addTo] != null) {
        paintRects[addTo].add(r);
    } else {
        paintRects[addTo] = new Rectangle(r);
    }
}
 
Example 5
Source File: WComponentPeer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void coalescePaintEvent(PaintEvent e) {
    Rectangle r = e.getUpdateRect();
    if (!(e instanceof IgnorePaintEvent)) {
        paintArea.add(r, e.getID());
    }

    if (log.isLoggable(PlatformLogger.Level.FINEST)) {
        switch(e.getID()) {
        case PaintEvent.UPDATE:
            log.finest("coalescePaintEvent: UPDATE: add: x = " +
                r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height);
            return;
        case PaintEvent.PAINT:
            log.finest("coalescePaintEvent: PAINT: add: x = " +
                r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height);
            return;
        }
    }
}
 
Example 6
Source File: XComponentPeer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public void coalescePaintEvent(PaintEvent e) {
    Rectangle r = e.getUpdateRect();
    if (!(e instanceof IgnorePaintEvent)) {
        paintArea.add(r, e.getID());
    }
    if (true) {
        switch(e.getID()) {
          case PaintEvent.UPDATE:
              if (log.isLoggable(PlatformLogger.Level.FINER)) {
                  log.finer("XCP coalescePaintEvent : UPDATE : add : x = " +
                        r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
              }
              return;
          case PaintEvent.PAINT:
              if (log.isLoggable(PlatformLogger.Level.FINER)) {
                  log.finer("XCP coalescePaintEvent : PAINT : add : x = " +
                        r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
              }
              return;
        }
    }
}
 
Example 7
Source File: XComponentPeer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void coalescePaintEvent(PaintEvent e) {
    Rectangle r = e.getUpdateRect();
    if (!(e instanceof IgnorePaintEvent)) {
        paintArea.add(r, e.getID());
    }
    if (true) {
        switch(e.getID()) {
          case PaintEvent.UPDATE:
              if (log.isLoggable(PlatformLogger.Level.FINER)) {
                  log.finer("XCP coalescePaintEvent : UPDATE : add : x = " +
                        r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
              }
              return;
          case PaintEvent.PAINT:
              if (log.isLoggable(PlatformLogger.Level.FINER)) {
                  log.finer("XCP coalescePaintEvent : PAINT : add : x = " +
                        r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
              }
              return;
        }
    }
}
 
Example 8
Source File: RepaintArea.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds a {@code Rectangle} to this {@code RepaintArea}.
 * PAINT Rectangles are divided into mostly vertical and mostly horizontal.
 * Each group is unioned together.
 * UPDATE Rectangles are unioned.
 *
 * @param   r   the specified {@code Rectangle}
 * @param   id  possible values PaintEvent.UPDATE or PaintEvent.PAINT
 * @since   1.3
 */
public synchronized void add(Rectangle r, int id) {
    // Make sure this new rectangle has positive dimensions
    if (r.isEmpty()) {
        return;
    }
    int addTo = UPDATE;
    if (id == PaintEvent.PAINT) {
        addTo = (r.width > r.height) ? HORIZONTAL : VERTICAL;
    }
    if (paintRects[addTo] != null) {
        paintRects[addTo].add(r);
    } else {
        paintRects[addTo] = new Rectangle(r);
    }
}
 
Example 9
Source File: XComponentPeer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void coalescePaintEvent(PaintEvent e) {
    Rectangle r = e.getUpdateRect();
    if (!(e instanceof IgnorePaintEvent)) {
        paintArea.add(r, e.getID());
    }
    if (true) {
        switch(e.getID()) {
          case PaintEvent.UPDATE:
              if (log.isLoggable(PlatformLogger.Level.FINER)) {
                  log.finer("XCP coalescePaintEvent : UPDATE : add : x = " +
                        r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
              }
              return;
          case PaintEvent.PAINT:
              if (log.isLoggable(PlatformLogger.Level.FINER)) {
                  log.finer("XCP coalescePaintEvent : PAINT : add : x = " +
                        r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
              }
              return;
        }
    }
}
 
Example 10
Source File: RepaintArea.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds a <code>Rectangle</code> to this <code>RepaintArea</code>.
 * PAINT Rectangles are divided into mostly vertical and mostly horizontal.
 * Each group is unioned together.
 * UPDATE Rectangles are unioned.
 *
 * @param   r   the specified <code>Rectangle</code>
 * @param   id  possible values PaintEvent.UPDATE or PaintEvent.PAINT
 * @since   1.3
 */
public synchronized void add(Rectangle r, int id) {
    // Make sure this new rectangle has positive dimensions
    if (r.isEmpty()) {
        return;
    }
    int addTo = UPDATE;
    if (id == PaintEvent.PAINT) {
        addTo = (r.width > r.height) ? HORIZONTAL : VERTICAL;
    }
    if (paintRects[addTo] != null) {
        paintRects[addTo].add(r);
    } else {
        paintRects[addTo] = new Rectangle(r);
    }
}
 
Example 11
Source File: WComponentPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void coalescePaintEvent(PaintEvent e) {
    Rectangle r = e.getUpdateRect();
    if (!(e instanceof IgnorePaintEvent)) {
        paintArea.add(r, e.getID());
    }

    if (log.isLoggable(PlatformLogger.Level.FINEST)) {
        switch(e.getID()) {
        case PaintEvent.UPDATE:
            log.finest("coalescePaintEvent: UPDATE: add: x = " +
                r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height);
            return;
        case PaintEvent.PAINT:
            log.finest("coalescePaintEvent: PAINT: add: x = " +
                r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height);
            return;
        }
    }
}
 
Example 12
Source File: RepaintArea.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Adds a {@code Rectangle} to this {@code RepaintArea}.
 * PAINT Rectangles are divided into mostly vertical and mostly horizontal.
 * Each group is unioned together.
 * UPDATE Rectangles are unioned.
 *
 * @param   r   the specified {@code Rectangle}
 * @param   id  possible values PaintEvent.UPDATE or PaintEvent.PAINT
 * @since   1.3
 */
public synchronized void add(Rectangle r, int id) {
    // Make sure this new rectangle has positive dimensions
    if (r.isEmpty()) {
        return;
    }
    int addTo = UPDATE;
    if (id == PaintEvent.PAINT) {
        addTo = (r.width > r.height) ? HORIZONTAL : VERTICAL;
    }
    if (paintRects[addTo] != null) {
        paintRects[addTo].add(r);
    } else {
        paintRects[addTo] = new Rectangle(r);
    }
}
 
Example 13
Source File: WComponentPeer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings("fallthrough")
public void handleEvent(AWTEvent e) {
    int id = e.getID();

    if ((e instanceof InputEvent) && !((InputEvent)e).isConsumed() &&
        ((Component)target).isEnabled())
    {
        if (e instanceof MouseEvent && !(e instanceof MouseWheelEvent)) {
            handleJavaMouseEvent((MouseEvent) e);
        } else if (e instanceof KeyEvent) {
            if (handleJavaKeyEvent((KeyEvent)e)) {
                return;
            }
        }
    }

    switch(id) {
        case PaintEvent.PAINT:
            // Got native painting
            paintPending = false;
            // Fallthrough to next statement
        case PaintEvent.UPDATE:
            // Skip all painting while layouting and all UPDATEs
            // while waiting for native paint
            if (!isLayouting && ! paintPending) {
                paintArea.paint(target,shouldClearRectBeforePaint());
            }
            return;
        case FocusEvent.FOCUS_LOST:
        case FocusEvent.FOCUS_GAINED:
            handleJavaFocusEvent((FocusEvent)e);
        default:
        break;
    }

    // Call the native code
    nativeHandleEvent(e);
}
 
Example 14
Source File: EventLock.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public PaintPriorityEvent(RWLock m, Toolkit source, Runnable runnable, Object notifier, boolean catchExceptions) {
    super(source, PaintEvent.PAINT, runnable, notifier, catchExceptions);
    this.m = m;
}
 
Example 15
Source File: XComponentPeer.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public void handleEvent(java.awt.AWTEvent e) {
    if ((e instanceof InputEvent) && !((InputEvent)e).isConsumed() && target.isEnabled())  {
        if (e instanceof MouseEvent) {
            if (e instanceof MouseWheelEvent) {
                handleJavaMouseWheelEvent((MouseWheelEvent) e);
            }
            else
                handleJavaMouseEvent((MouseEvent) e);
        }
        else if (e instanceof KeyEvent) {
            handleF10JavaKeyEvent((KeyEvent)e);
            handleJavaKeyEvent((KeyEvent)e);
        }
    }
    else if (e instanceof KeyEvent && !((InputEvent)e).isConsumed()) {
        // even if target is disabled.
        handleF10JavaKeyEvent((KeyEvent)e);
    }
    else if (e instanceof InputMethodEvent) {
        handleJavaInputMethodEvent((InputMethodEvent) e);
    }

    int id = e.getID();

    switch(id) {
      case PaintEvent.PAINT:
          // Got native painting
          paintPending = false;
          // Fallthrough to next statement
      case PaintEvent.UPDATE:
          // Skip all painting while layouting and all UPDATEs
          // while waiting for native paint
          if (!isLayouting && !paintPending) {
              paintArea.paint(target,false);
          }
          return;
      case FocusEvent.FOCUS_LOST:
      case FocusEvent.FOCUS_GAINED:
          handleJavaFocusEvent(e);
          break;
      case WindowEvent.WINDOW_LOST_FOCUS:
      case WindowEvent.WINDOW_GAINED_FOCUS:
          handleJavaWindowFocusEvent(e);
          break;
      default:
          break;
    }

}
 
Example 16
Source File: XComponentPeer.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public void handleEvent(java.awt.AWTEvent e) {
    if ((e instanceof InputEvent) && !((InputEvent)e).isConsumed() && target.isEnabled())  {
        if (e instanceof MouseEvent) {
            if (e instanceof MouseWheelEvent) {
                handleJavaMouseWheelEvent((MouseWheelEvent) e);
            }
            else
                handleJavaMouseEvent((MouseEvent) e);
        }
        else if (e instanceof KeyEvent) {
            handleF10JavaKeyEvent((KeyEvent)e);
            handleJavaKeyEvent((KeyEvent)e);
        }
    }
    else if (e instanceof KeyEvent && !((InputEvent)e).isConsumed()) {
        // even if target is disabled.
        handleF10JavaKeyEvent((KeyEvent)e);
    }
    else if (e instanceof InputMethodEvent) {
        handleJavaInputMethodEvent((InputMethodEvent) e);
    }

    int id = e.getID();

    switch(id) {
      case PaintEvent.PAINT:
          // Got native painting
          paintPending = false;
          // Fallthrough to next statement
      case PaintEvent.UPDATE:
          // Skip all painting while layouting and all UPDATEs
          // while waiting for native paint
          if (!isLayouting && !paintPending) {
              paintArea.paint(target,false);
          }
          return;
      case FocusEvent.FOCUS_LOST:
      case FocusEvent.FOCUS_GAINED:
          handleJavaFocusEvent(e);
          break;
      case WindowEvent.WINDOW_LOST_FOCUS:
      case WindowEvent.WINDOW_GAINED_FOCUS:
          handleJavaWindowFocusEvent(e);
          break;
      default:
          break;
    }

}
 
Example 17
Source File: XComponentPeer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void handleEvent(java.awt.AWTEvent e) {
    if ((e instanceof InputEvent) && !((InputEvent)e).isConsumed() && target.isEnabled())  {
        if (e instanceof MouseEvent) {
            if (e instanceof MouseWheelEvent) {
                handleJavaMouseWheelEvent((MouseWheelEvent) e);
            }
            else
                handleJavaMouseEvent((MouseEvent) e);
        }
        else if (e instanceof KeyEvent) {
            handleF10JavaKeyEvent((KeyEvent)e);
            handleJavaKeyEvent((KeyEvent)e);
        }
    }
    else if (e instanceof KeyEvent && !((InputEvent)e).isConsumed()) {
        // even if target is disabled.
        handleF10JavaKeyEvent((KeyEvent)e);
    }
    else if (e instanceof InputMethodEvent) {
        handleJavaInputMethodEvent((InputMethodEvent) e);
    }

    int id = e.getID();

    switch(id) {
      case PaintEvent.PAINT:
          // Got native painting
          paintPending = false;
          // Fallthrough to next statement
      case PaintEvent.UPDATE:
          // Skip all painting while layouting and all UPDATEs
          // while waiting for native paint
          if (!isLayouting && !paintPending) {
              paintArea.paint(target,false);
          }
          return;
      case FocusEvent.FOCUS_LOST:
      case FocusEvent.FOCUS_GAINED:
          handleJavaFocusEvent(e);
          break;
      case WindowEvent.WINDOW_LOST_FOCUS:
      case WindowEvent.WINDOW_GAINED_FOCUS:
          handleJavaWindowFocusEvent(e);
          break;
      default:
          break;
    }

}
 
Example 18
Source File: XComponentPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("fallthrough")
public void handleEvent(java.awt.AWTEvent e) {
    if ((e instanceof InputEvent) && !((InputEvent)e).isConsumed() && target.isEnabled())  {
        if (e instanceof MouseEvent) {
            if (e instanceof MouseWheelEvent) {
                handleJavaMouseWheelEvent((MouseWheelEvent) e);
            }
            else
                handleJavaMouseEvent((MouseEvent) e);
        }
        else if (e instanceof KeyEvent) {
            handleF10JavaKeyEvent((KeyEvent)e);
            handleJavaKeyEvent((KeyEvent)e);
        }
    }
    else if (e instanceof KeyEvent && !((InputEvent)e).isConsumed()) {
        // even if target is disabled.
        handleF10JavaKeyEvent((KeyEvent)e);
    }
    else if (e instanceof InputMethodEvent) {
        handleJavaInputMethodEvent((InputMethodEvent) e);
    }

    int id = e.getID();

    switch(id) {
      case PaintEvent.PAINT:
          // Got native painting
          paintPending = false;
          // Fallthrough to next statement
      case PaintEvent.UPDATE:
          // Skip all painting while layouting and all UPDATEs
          // while waiting for native paint
          if (!isLayouting && !paintPending) {
              paintArea.paint(target,false);
          }
          return;
      case FocusEvent.FOCUS_LOST:
      case FocusEvent.FOCUS_GAINED:
          handleJavaFocusEvent(e);
          break;
      case WindowEvent.WINDOW_LOST_FOCUS:
      case WindowEvent.WINDOW_GAINED_FOCUS:
          handleJavaWindowFocusEvent(e);
          break;
      default:
          break;
    }

}
 
Example 19
Source File: XComponentPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void handleEvent(java.awt.AWTEvent e) {
    if ((e instanceof InputEvent) && !((InputEvent)e).isConsumed() && target.isEnabled())  {
        if (e instanceof MouseEvent) {
            if (e instanceof MouseWheelEvent) {
                handleJavaMouseWheelEvent((MouseWheelEvent) e);
            }
            else
                handleJavaMouseEvent((MouseEvent) e);
        }
        else if (e instanceof KeyEvent) {
            handleF10JavaKeyEvent((KeyEvent)e);
            handleJavaKeyEvent((KeyEvent)e);
        }
    }
    else if (e instanceof KeyEvent && !((InputEvent)e).isConsumed()) {
        // even if target is disabled.
        handleF10JavaKeyEvent((KeyEvent)e);
    }
    else if (e instanceof InputMethodEvent) {
        handleJavaInputMethodEvent((InputMethodEvent) e);
    }

    int id = e.getID();

    switch(id) {
      case PaintEvent.PAINT:
          // Got native painting
          paintPending = false;
          // Fallthrough to next statement
      case PaintEvent.UPDATE:
          // Skip all painting while layouting and all UPDATEs
          // while waiting for native paint
          if (!isLayouting && !paintPending) {
              paintArea.paint(target,false);
          }
          return;
      case FocusEvent.FOCUS_LOST:
      case FocusEvent.FOCUS_GAINED:
          handleJavaFocusEvent(e);
          break;
      case WindowEvent.WINDOW_LOST_FOCUS:
      case WindowEvent.WINDOW_GAINED_FOCUS:
          handleJavaWindowFocusEvent(e);
          break;
      default:
          break;
    }

}
 
Example 20
Source File: PaintEventDispatcher.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates and returns the <code>PaintEvent</code> that should be
 * dispatched for the specified component.  If this returns null
 * no <code>PaintEvent</code> is dispatched.
 * <p>
 * <b>WARNING:</b> This is invoked from the native thread, be careful
 * what methods you end up invoking here.
 */
public PaintEvent createPaintEvent(Component target, int x, int y, int w,
                                   int h) {

    return new PaintEvent(target, PaintEvent.PAINT,
                          new Rectangle(x, y, w, h));
}