4639N/A/*
4639N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
4639N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4639N/A *
4639N/A * This code is free software; you can redistribute it and/or modify it
4639N/A * under the terms of the GNU General Public License version 2 only, as
4639N/A * published by the Free Software Foundation. Oracle designates this
4639N/A * particular file as subject to the "Classpath" exception as provided
4639N/A * by Oracle in the LICENSE file that accompanied this code.
4639N/A *
4639N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4639N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4639N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4639N/A * version 2 for more details (a copy is included in the LICENSE file that
4639N/A * accompanied this code).
4639N/A *
4639N/A * You should have received a copy of the GNU General Public License version
4639N/A * 2 along with this work; if not, write to the Free Software Foundation,
4639N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4639N/A *
4639N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4639N/A * or visit www.oracle.com if you need additional information or have any
4639N/A * questions.
4639N/A */
4639N/A
4639N/A
4639N/Apackage sun.lwawt;
4639N/A
4639N/Aimport sun.awt.RepaintArea;
4639N/A
4639N/Aimport java.awt.Component;
4639N/Aimport java.awt.Graphics;
4639N/A
4639N/A/**
4639N/A * @author Sergey Bylokhov
4639N/A */
4639N/Afinal class LWRepaintArea extends RepaintArea {
4639N/A
4639N/A @Override
4639N/A protected void updateComponent(final Component comp, final Graphics g) {
4639N/A if (comp != null) {
4639N/A super.updateComponent(comp, g);
4796N/A flushBuffers((LWComponentPeer) comp.getPeer());
4639N/A }
4639N/A }
4639N/A
4639N/A @Override
4639N/A protected void paintComponent(final Component comp, final Graphics g) {
4639N/A if (comp != null) {
4639N/A final LWComponentPeer peer = (LWComponentPeer) comp.getPeer();
4639N/A if (peer != null) {
4639N/A peer.paintPeer(g);
4639N/A }
4639N/A super.paintComponent(comp, g);
4639N/A flushBuffers(peer);
4639N/A }
4639N/A }
4639N/A
4639N/A private static void flushBuffers(final LWComponentPeer peer) {
4639N/A if (peer != null) {
4639N/A peer.flushOnscreenGraphics();
4639N/A }
4639N/A }
4639N/A}