jdk/test/java/awt/applet/Applet/AppletFlipBuffer.java
author ssadetsky
Tue, 21 Jul 2015 09:35:04 +0300
changeset 31897 7be531b4df44
child 32427 c22b7e41adf3
permissions -rw-r--r--
8130390: Applet fails to launch on virtual desktop Reviewed-by: azvegint, serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31897
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
     1
/*
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
     4
 *
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
     7
 * published by the Free Software Foundation.
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
     8
 *
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    13
 * accompanied this code).
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    14
 *
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    18
 *
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    21
 * questions.
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    22
 */
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    23
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    24
/* @test
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    25
   @bug 8130390
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    26
   @summary Applet fails to launch on virtual desktop
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    27
   @author Semyon Sadetsky
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    28
  */
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    29
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    30
import sun.awt.AWTAccessor;
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    31
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    32
import java.applet.Applet;
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    33
import java.awt.*;
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    34
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    35
public class AppletFlipBuffer {
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    36
    public static void main(String[] args) throws Exception {
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    37
        Applet applet = new Applet();
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    38
        AWTAccessor.ComponentAccessor componentAccessor
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    39
                = AWTAccessor.getComponentAccessor();
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    40
        BufferCapabilities caps = new BufferCapabilities(
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    41
                new ImageCapabilities(true), new ImageCapabilities(true),
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    42
                BufferCapabilities.FlipContents.BACKGROUND);
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    43
        Frame frame = new Frame();
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    44
        try {
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    45
            frame.add(applet);
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    46
            frame.setUndecorated(true);
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    47
            frame.setVisible(true);
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    48
            componentAccessor.createBufferStrategy(applet, 2, caps);
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    49
            System.out.println("ok");
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    50
        }
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    51
        finally {
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    52
            frame.dispose();
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    53
        }
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    54
    }
7be531b4df44 8130390: Applet fails to launch on virtual desktop
ssadetsky
parents:
diff changeset
    55
}