src/macosx/classes/sun/lwawt/LWRepaintArea.java

Print this page




  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 
  27 package sun.lwawt;
  28 
  29 import sun.awt.RepaintArea;
  30 
  31 import java.awt.Component;
  32 import java.awt.Graphics;
  33 
  34 /**
  35  * @author Sergey Bylokhov
  36  */
  37 final class LWRepaintArea extends RepaintArea {
  38 
  39     @Override
  40     protected void updateComponent(final Component comp, final Graphics g) {
  41         if (comp != null) {
  42             final LWComponentPeer peer = (LWComponentPeer) comp.getPeer();
  43             if (peer != null) {
  44                 peer.paintPeer(g);
  45             }
  46             super.updateComponent(comp, g);
  47             flushBuffers(peer);
  48         }
  49     }
  50 
  51     @Override
  52     protected void paintComponent(final Component comp, final Graphics g) {
  53         if (comp != null) {
  54             final LWComponentPeer peer = (LWComponentPeer) comp.getPeer();
  55             if (peer != null) {
  56                 peer.paintPeer(g);
  57             }
  58             super.paintComponent(comp, g);
  59             flushBuffers(peer);
  60         }
  61     }
  62 
  63     private static void flushBuffers(final LWComponentPeer peer) {
  64         if (peer != null) {
  65             if (!peer.getWindowPeerOrSelf().isOpaque()) {
  66                 peer.flushOffscreenGraphics();
  67             }


  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 
  27 package sun.lwawt;
  28 
  29 import sun.awt.RepaintArea;
  30 
  31 import java.awt.Component;
  32 import java.awt.Graphics;
  33 
  34 /**
  35  * @author Sergey Bylokhov
  36  */
  37 final class LWRepaintArea extends RepaintArea {
  38 
  39     @Override
  40     protected void updateComponent(final Component comp, final Graphics g) {
  41         if (comp != null) {




  42             super.updateComponent(comp, g);
  43             flushBuffers((LWComponentPeer) comp.getPeer());
  44         }
  45     }
  46 
  47     @Override
  48     protected void paintComponent(final Component comp, final Graphics g) {
  49         if (comp != null) {
  50             final LWComponentPeer peer = (LWComponentPeer) comp.getPeer();
  51             if (peer != null) {
  52                 peer.paintPeer(g);
  53             }
  54             super.paintComponent(comp, g);
  55             flushBuffers(peer);
  56         }
  57     }
  58 
  59     private static void flushBuffers(final LWComponentPeer peer) {
  60         if (peer != null) {
  61             if (!peer.getWindowPeerOrSelf().isOpaque()) {
  62                 peer.flushOffscreenGraphics();
  63             }