1 /* 2 * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 test 26 @bug 6242241 27 @summary Tests basic DnD functionality in an applet 28 @requires (os.family == "windows") 29 @author Your Name: Alexey Utkin area=dnd 30 @run applet/manual=yesno DnDFileGroupDescriptor.html 31 */ 32 33 import java.applet.Applet; 34 import java.awt.*; 35 36 public class DnDFileGroupDescriptor extends Applet { 37 public void init() { 38 setLayout(new BorderLayout()); 39 40 String[] instructions = { 41 "The applet window contains a red field.", 42 "1. Start MS Outlook program. Find and open ", 43 " the mail form with attachments.", 44 "2. Select attachments from the mail and drag into a red field of applet.", 45 " When the mouse enters the field during the drag, the application ", 46 " should change the cursor form to OLE-copy and field color to yellow.", 47 "3. Release the mouse button (drop attachments) over the field.", 48 "", 49 "File paths in temporary folder should appear.", 50 "", 51 "You should be able to repeat this operation multiple times.", 52 "Please, select \"Pass\" just in case of success or \"Fail\" for another." 53 }; 54 Sysout.createDialogWithInstructions( instructions ); 55 } 56 57 public void start() { 58 Panel mainPanel; 59 Component dropTarget; 60 61 mainPanel = new Panel(); 62 mainPanel.setLayout(new BorderLayout()); 63 64 mainPanel.setBackground(Color.blue); 65 dropTarget = new DnDTarget(Color.red, Color.yellow); 66 67 mainPanel.add(dropTarget, "Center"); | 1 /* 2 * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 test 26 @bug 6242241 8080185 27 @summary Tests basic DnD functionality in an applet 28 @requires (os.family == "windows") 29 @author Your Name: Alexey Utkin area=dnd 30 @run applet/manual=yesno DnDFileGroupDescriptor.html 31 */ 32 33 import java.applet.Applet; 34 import java.awt.*; 35 36 public class DnDFileGroupDescriptor extends Applet { 37 public void init() { 38 setLayout(new BorderLayout()); 39 40 String[] instructions = { 41 "The applet window contains a red field.", 42 "1. Select any file from any location and drag into a red field of applet", 43 "2. You can also start MS Outlook program. Find and open ", 44 " the mail form with attachments.", 45 "3. Select attachments from the mail and drag into a red field of applet.", 46 " When the mouse enters the field during the drag, the application ", 47 " should change the cursor form to OLE-copy and field color to yellow.", 48 "4. Release the mouse button (drop attachments) over the field.", 49 "", 50 "File paths in temporary folder should appear.", 51 "", 52 "You should be able to repeat this operation multiple times.", 53 "Please, select \"Pass\" just in case of success or \"Fail\" for another." 54 }; 55 Sysout.createDialogWithInstructions( instructions ); 56 } 57 58 public void start() { 59 Panel mainPanel; 60 Component dropTarget; 61 62 mainPanel = new Panel(); 63 mainPanel.setLayout(new BorderLayout()); 64 65 mainPanel.setBackground(Color.blue); 66 dropTarget = new DnDTarget(Color.red, Color.yellow); 67 68 mainPanel.add(dropTarget, "Center"); |