jdk/test/java/awt/dnd/DragInterceptorAppletTest/SourceFrame.java
author bagiras
Thu, 15 May 2014 20:09:38 +0400
changeset 24563 33eb483cebec
permissions -rw-r--r--
8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests Reviewed-by: serb, pchelko
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24563
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
     1
/*
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
     2
 * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
     4
 *
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
     7
 * published by the Free Software Foundation.
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
     8
 *
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    13
 * accompanied this code).
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    14
 *
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    18
 *
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    21
 * questions.
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    22
 */
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    23
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    24
import test.java.awt.regtesthelpers.Util;
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    25
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    26
import java.awt.*;
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    27
import java.awt.datatransfer.StringSelection;
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    28
import java.awt.dnd.DragGestureListener;
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    29
import java.awt.dnd.DragSource;
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    30
import java.awt.dnd.DnDConstants;
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    31
import java.awt.dnd.DragGestureEvent;
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    32
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    33
class SourceFrame extends Frame implements DragGestureListener {
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    34
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    35
    SourceFrame() {
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    36
        super("Source File List Frame");
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    37
        initGUI();
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    38
        new DragSource().createDefaultDragGestureRecognizer(this,
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    39
                DnDConstants.ACTION_COPY,this);
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    40
    }
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    41
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    42
    private void initGUI() {
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    43
        this.addWindowListener(Util.getClosingWindowAdapter());
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    44
        this.setLocation(300,250);
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    45
        this.setSize(200,200);
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    46
        this.setVisible(true);
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    47
    }
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    48
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    49
    int getNextLocationX() {
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    50
        return getX()+getWidth();
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    51
    }
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    52
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    53
    int getNextLocationY() {
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    54
        return getY();
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    55
    }
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    56
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    57
    int getDragSourcePointX() {
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    58
        return (int)getLocationOnScreen().getX()+(getWidth()/2);
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    59
    }
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    60
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    61
   int getDragSourcePointY() {
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    62
        return (int)getLocationOnScreen().getY()+ (getHeight()/2);
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    63
    }
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    64
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    65
    public void dragGestureRecognized(DragGestureEvent dge) {
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    66
        dge.startDrag(null, new StringSelection("A TEXT"));
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    67
    }
33eb483cebec 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests
bagiras
parents:
diff changeset
    68
}