jdk/src/share/classes/sun/swing/JLightweightFrame.java
author ant
Tue, 30 Jul 2013 16:15:31 +0400
changeset 19026 96141cb8d7eb
parent 17415 62b97a10da72
child 20127 a3a34675d847
permissions -rw-r--r--
8020927: JLightweightFrame API should export layout properties change notifications Reviewed-by: anthony
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
     1
/*
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
     4
 *
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    10
 *
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    15
 * accompanied this code).
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    16
 *
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    20
 *
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    23
 * questions.
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    24
 */
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    25
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    26
package sun.swing;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    27
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    28
import java.awt.BorderLayout;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    29
import java.awt.Color;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    30
import java.awt.Component;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    31
import java.awt.Container;
19026
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
    32
import java.awt.Dimension;
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    33
import java.awt.EventQueue;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    34
import java.awt.Graphics;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    35
import java.awt.Graphics2D;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    36
import java.awt.Rectangle;
19026
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
    37
import java.awt.event.ComponentListener;
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
    38
import java.awt.event.ContainerEvent;
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
    39
import java.awt.event.ContainerListener;
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    40
import java.awt.image.BufferedImage;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    41
import java.awt.image.DataBufferInt;
19026
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
    42
import java.beans.PropertyChangeEvent;
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
    43
import java.beans.PropertyChangeListener;
17415
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    44
import java.security.AccessController;
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    45
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    46
import javax.swing.JLayeredPane;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    47
import javax.swing.JPanel;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    48
import javax.swing.JRootPane;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    49
import javax.swing.LayoutFocusTraversalPolicy;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    50
import javax.swing.RootPaneContainer;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    51
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    52
import sun.awt.LightweightFrame;
17415
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    53
import sun.security.action.GetPropertyAction;
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    54
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    55
/**
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    56
 * The frame serves as a lightweight container which paints its content
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    57
 * to an offscreen image and provides access to the image's data via the
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    58
 * {@link LightweightContent} interface. Note, that it may not be shown
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    59
 * as a standalone toplevel frame. Its purpose is to provide functionality
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    60
 * for lightweight embedding.
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    61
 *
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    62
 * @author Artem Ananiev
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    63
 * @author Anton Tarasov
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    64
 */
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    65
public final class JLightweightFrame extends LightweightFrame implements RootPaneContainer {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    66
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    67
    private final JRootPane rootPane = new JRootPane();
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    68
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    69
    private LightweightContent content;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    70
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    71
    private Component component;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    72
    private JPanel contentPane;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    73
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    74
    private BufferedImage bbImage;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    75
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    76
    /**
17415
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    77
     * {@code copyBufferEnabled}, true by default, defines the following strategy.
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    78
     * A duplicating (copy) buffer is created for the original pixel buffer.
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    79
     * The copy buffer is synchronized with the original buffer every time the
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    80
     * latter changes. {@code JLightweightFrame} passes the copy buffer array
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    81
     * to the {@link LightweightContent#imageBufferReset} method. The code spot
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    82
     * which synchronizes two buffers becomes the only critical section guarded
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    83
     * by the lock (managed with the {@link LightweightContent#paintLock()},
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    84
     * {@link LightweightContent#paintUnlock()} methods).
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    85
     */
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    86
    private boolean copyBufferEnabled;
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    87
    private int[] copyBuffer;
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    88
19026
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
    89
    private PropertyChangeListener layoutSizeListener;
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
    90
17415
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    91
    /**
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    92
     * Constructs a new, initially invisible {@code JLightweightFrame}
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    93
     * instance.
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    94
     */
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    95
    public JLightweightFrame() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
    96
        super();
17415
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    97
        copyBufferEnabled = "true".equals(AccessController.
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    98
            doPrivileged(new GetPropertyAction("jlf.copyBufferEnabled", "true")));
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
    99
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   100
        add(rootPane, BorderLayout.CENTER);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   101
        setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
16706
4b243017cd27 8010375: sun.swing.JLightweightFrame should be implemented for XToolkit
ant
parents: 15983
diff changeset
   102
        if (getGraphicsConfiguration().isTranslucencyCapable()) {
4b243017cd27 8010375: sun.swing.JLightweightFrame should be implemented for XToolkit
ant
parents: 15983
diff changeset
   103
            setBackground(new Color(0, 0, 0, 0));
4b243017cd27 8010375: sun.swing.JLightweightFrame should be implemented for XToolkit
ant
parents: 15983
diff changeset
   104
        }
19026
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   105
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   106
        layoutSizeListener = new PropertyChangeListener() {
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   107
            @Override
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   108
            public void propertyChange(PropertyChangeEvent e) {
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   109
                Dimension d = (Dimension)e.getNewValue();
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   110
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   111
                if ("preferredSize".equals(e.getPropertyName())) {
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   112
                    content.preferredSizeChanged(d.width, d.height);
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   113
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   114
                } else if ("maximumSize".equals(e.getPropertyName())) {
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   115
                    content.maximumSizeChanged(d.width, d.height);
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   116
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   117
                } else if ("minimumSize".equals(e.getPropertyName())) {
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   118
                    content.minimumSizeChanged(d.width, d.height);
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   119
                }
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   120
            }
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   121
        };
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   122
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   123
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   124
    /**
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   125
     * Sets the {@link LightweightContent} instance for this frame.
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   126
     * The {@code JComponent} object returned by the
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   127
     * {@link LightweightContent#getComponent()} method is immediately
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   128
     * added to the frame's content pane.
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   129
     *
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   130
     * @param content the {@link LightweightContent} instance
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   131
     */
19026
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   132
    public void setContent(final LightweightContent content) {
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   133
        if (content == null) {
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   134
            System.err.println("JLightweightFrame.setContent: content may not be null!");
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   135
            return;
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   136
        }
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   137
        this.content = content;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   138
        this.component = content.getComponent();
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   139
19026
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   140
        Dimension d = this.component.getPreferredSize();
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   141
        content.preferredSizeChanged(d.width, d.height);
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   142
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   143
        d = this.component.getMaximumSize();
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   144
        content.maximumSizeChanged(d.width, d.height);
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   145
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   146
        d = this.component.getMinimumSize();
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   147
        content.minimumSizeChanged(d.width, d.height);
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   148
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   149
        initInterior();
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   150
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   151
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   152
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   153
    public Graphics getGraphics() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   154
        if (bbImage == null) return null;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   155
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   156
        Graphics2D g = bbImage.createGraphics();
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   157
        g.setBackground(getBackground());
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   158
        g.setColor(getForeground());
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   159
        g.setFont(getFont());
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   160
        return g;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   161
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   162
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   163
    /**
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   164
     * {@inheritDoc}
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   165
     *
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   166
     * @see LightweightContent#focusGrabbed()
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   167
     */
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   168
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   169
    public void grabFocus() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   170
        if (content != null) content.focusGrabbed();
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   171
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   172
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   173
    /**
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   174
     * {@inheritDoc}
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   175
     *
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   176
     * @see LightweightContent#focusUngrabbed()
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   177
     */
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   178
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   179
    public void ungrabFocus() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   180
        if (content != null) content.focusUngrabbed();
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   181
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   182
17415
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   183
    private void syncCopyBuffer(boolean reset, int x, int y, int w, int h) {
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   184
        content.paintLock();
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   185
        try {
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   186
            int[] srcBuffer = ((DataBufferInt)bbImage.getRaster().getDataBuffer()).getData();
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   187
            if (reset) {
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   188
                copyBuffer = new int[srcBuffer.length];
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   189
            }
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   190
            int linestride = bbImage.getWidth();
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   191
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   192
            for (int i=0; i<h; i++) {
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   193
                int from = (y + i) * linestride + x;
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   194
                System.arraycopy(srcBuffer, from, copyBuffer, from, w);
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   195
            }
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   196
        } finally {
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   197
            content.paintUnlock();
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   198
        }
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   199
    }
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   200
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   201
    private void initInterior() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   202
        contentPane = new JPanel() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   203
            @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   204
            public void paint(Graphics g) {
17415
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   205
                if (!copyBufferEnabled) {
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   206
                    content.paintLock();
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   207
                }
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   208
                try {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   209
                    super.paint(g);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   210
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   211
                    final Rectangle clip = g.getClipBounds() != null ?
17415
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   212
                            g.getClipBounds() :
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   213
                            new Rectangle(0, 0, contentPane.getWidth(), contentPane.getHeight());
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   214
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   215
                    clip.x = Math.max(0, clip.x);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   216
                    clip.y = Math.max(0, clip.y);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   217
                    clip.width = Math.min(contentPane.getWidth(), clip.width);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   218
                    clip.height = Math.min(contentPane.getHeight(), clip.height);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   219
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   220
                    EventQueue.invokeLater(new Runnable() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   221
                        @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   222
                        public void run() {
17415
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   223
                            if (copyBufferEnabled) {
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   224
                                syncCopyBuffer(false, clip.x, clip.y, clip.width, clip.height);
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   225
                            }
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   226
                            content.imageUpdated(clip.x, clip.y, clip.width, clip.height);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   227
                        }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   228
                    });
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   229
                } finally {
17415
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   230
                    if (!copyBufferEnabled) {
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   231
                        content.paintUnlock();
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   232
                    }
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   233
                }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   234
            }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   235
            @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   236
            protected boolean isPaintingOrigin() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   237
                return true;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   238
            }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   239
        };
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   240
        contentPane.setLayout(new BorderLayout());
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   241
        contentPane.add(component);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   242
        setContentPane(contentPane);
19026
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   243
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   244
        contentPane.addContainerListener(new ContainerListener() {
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   245
            @Override
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   246
            public void componentAdded(ContainerEvent e) {
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   247
                Component c = JLightweightFrame.this.component;
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   248
                if (e.getChild() == c) {
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   249
                    c.addPropertyChangeListener("preferredSize", layoutSizeListener);
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   250
                    c.addPropertyChangeListener("maximumSize", layoutSizeListener);
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   251
                    c.addPropertyChangeListener("minimumSize", layoutSizeListener);
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   252
                }
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   253
            }
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   254
            @Override
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   255
            public void componentRemoved(ContainerEvent e) {
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   256
                Component c = JLightweightFrame.this.component;
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   257
                if (e.getChild() == c) {
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   258
                    c.removePropertyChangeListener(layoutSizeListener);
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   259
                }
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   260
            }
96141cb8d7eb 8020927: JLightweightFrame API should export layout properties change notifications
ant
parents: 17415
diff changeset
   261
        });
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   262
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   263
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   264
    @SuppressWarnings("deprecation")
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   265
    @Override public void reshape(int x, int y, int width, int height) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   266
        super.reshape(x, y, width, height);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   267
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   268
        if (width == 0 || height == 0) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   269
            return;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   270
        }
17415
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   271
        if (!copyBufferEnabled) {
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   272
            content.paintLock();
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   273
        }
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   274
        try {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   275
            if ((bbImage == null) || (width != bbImage.getWidth()) || (height != bbImage.getHeight())) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   276
                boolean createBB = true;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   277
                int newW = width;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   278
                int newH = height;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   279
                if (bbImage != null) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   280
                    int oldW = bbImage.getWidth();
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   281
                    int oldH = bbImage.getHeight();
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   282
                    if ((oldW >= newW) && (oldH >= newH)) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   283
                        createBB = false;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   284
                    } else {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   285
                        if (oldW >= newW) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   286
                            newW = oldW;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   287
                        } else {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   288
                            newW = Math.max((int)(oldW * 1.2), width);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   289
                        }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   290
                        if (oldH >= newH) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   291
                            newH = oldH;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   292
                        } else {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   293
                            newH = Math.max((int)(oldH * 1.2), height);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   294
                        }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   295
                    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   296
                }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   297
                if (createBB) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   298
                    BufferedImage oldBB = bbImage;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   299
                    bbImage = new BufferedImage(newW, newH, BufferedImage.TYPE_INT_ARGB_PRE);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   300
                    if (oldBB != null) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   301
                        Graphics g = bbImage.getGraphics();
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   302
                        try {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   303
                            g.drawImage(oldBB, 0, 0, newW, newH, null);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   304
                        } finally {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   305
                            g.dispose();
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   306
                            oldBB.flush();
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   307
                        }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   308
                    }
17415
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   309
                    int[] pixels = ((DataBufferInt)bbImage.getRaster().getDataBuffer()).getData();
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   310
                    if (copyBufferEnabled) {
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   311
                        syncCopyBuffer(true, 0, 0, width, height);
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   312
                        pixels = copyBuffer;
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   313
                    }
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   314
                    content.imageBufferReset(pixels, 0, 0, width, height, bbImage.getWidth());
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   315
                    return;
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   316
                }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   317
            }
17415
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   318
            content.imageReshaped(0, 0, width, height);
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   319
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   320
        } finally {
17415
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   321
            if (!copyBufferEnabled) {
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   322
                content.paintUnlock();
62b97a10da72 8014227: JLightweightFrame needs another synchronization policy
ant
parents: 16706
diff changeset
   323
            }
15983
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   324
        }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   325
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   326
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   327
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   328
    public JRootPane getRootPane() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   329
        return rootPane;
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   330
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   331
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   332
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   333
    public void setContentPane(Container contentPane) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   334
        getRootPane().setContentPane(contentPane);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   335
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   336
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   337
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   338
    public Container getContentPane() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   339
        return getRootPane().getContentPane();
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   340
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   341
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   342
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   343
    public void setLayeredPane(JLayeredPane layeredPane) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   344
        getRootPane().setLayeredPane(layeredPane);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   345
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   346
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   347
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   348
    public JLayeredPane getLayeredPane() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   349
        return getRootPane().getLayeredPane();
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   350
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   351
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   352
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   353
    public void setGlassPane(Component glassPane) {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   354
        getRootPane().setGlassPane(glassPane);
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   355
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   356
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   357
    @Override
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   358
    public Component getGlassPane() {
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   359
        return getRootPane().getGlassPane();
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   360
    }
26a673dec5b2 8006406: lightweight embedding in other Java UI toolkits
ant
parents:
diff changeset
   361
}