Skip to content

Commit b2baa4e

Browse files
author
duke
committed
Backport a1fbbffb5e0d7e41a9c3041b7e64382780e86f50
1 parent e1b5f3c commit b2baa4e

File tree

3 files changed

+40
-60
lines changed

3 files changed

+40
-60
lines changed

test/jdk/javax/swing/JColorChooser/8065098/JColorChooserDnDTest.java

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -34,21 +34,17 @@
3434
public class JColorChooserDnDTest {
3535

3636
public static void main(String[] args) {
37-
SwingUtilities.invokeLater(new Runnable() {
38-
39-
@Override
40-
public void run() {
41-
JFrame frame = new JFrame();
42-
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
43-
JPanel panel = new JPanel();
44-
JColorChooser colorChooser = new JColorChooser();
45-
colorChooser.setDragEnabled(true);
46-
panel.setBorder(BorderFactory.createTitledBorder("JColorChoosers"));
47-
panel.add(colorChooser);
48-
frame.setContentPane(panel);
49-
frame.pack();
50-
frame.setVisible(true);
51-
}
37+
SwingUtilities.invokeLater(() -> {
38+
JFrame frame = new JFrame();
39+
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
40+
JPanel panel = new JPanel();
41+
JColorChooser colorChooser = new JColorChooser();
42+
colorChooser.setDragEnabled(true);
43+
panel.setBorder(BorderFactory.createTitledBorder("JColorChoosers"));
44+
panel.add(colorChooser);
45+
frame.setContentPane(panel);
46+
frame.pack();
47+
frame.setVisible(true);
5248
});
5349
}
5450
}

test/jdk/javax/swing/JColorChooser/8065098/bug8065098.html

Lines changed: 0 additions & 40 deletions
This file was deleted.

test/jdk/javax/swing/JColorChooser/8065098/bug8065098.java

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -20,15 +20,39 @@
2020
* or visit www.oracle.com if you need additional information or have any
2121
* questions.
2222
*/
23-
import javax.swing.JApplet;
2423

2524
/*
2625
* @test
2726
* @bug 8065098
27+
* @library /java/awt/regtesthelpers
28+
* @build PassFailJFrame
2829
* @summary JColorChooser no longer supports drag and drop
2930
* between two JVM instances
30-
* @run applet/manual=yesno bug8065098.html
31+
* @run main/manual bug8065098
3132
*/
32-
public class bug8065098 extends JApplet {
3333

34+
public class bug8065098 {
35+
private static final String INSTRUCTIONS = """
36+
1. Compile the java test JColorChooserDnDTest.java:
37+
> <path-to-the-tested-jdk>/bin/javac JColorChooserDnDTest.java
38+
2. Run the first instance of the java test:
39+
> <path-to-the-tested-jdk>/bin/java JColorChooserDnDTest
40+
3. Select a color in the color chooser.
41+
4. Run the second instance of the java test:
42+
> <path-to-the-tested-jdk>/bin/java JColorChooserDnDTest
43+
5. Drag and drop the selected color from the first color chooser
44+
preview panel to the second color chooser preview panel
45+
6. If the color is dragged to the second color chooser, then the
46+
test passes. Otherwise, the test fails.
47+
""";
48+
49+
public static void main(String[] args) throws Exception {
50+
PassFailJFrame.builder()
51+
.title("bug8065098 Test Instructions")
52+
.instructions(INSTRUCTIONS)
53+
.rows((int) INSTRUCTIONS.lines().count() + 2)
54+
.columns(40)
55+
.build()
56+
.awaitAndCheck();
57+
}
3458
}

0 commit comments

Comments
 (0)