Skip to content

Commit 1e76e1f

Browse files
author
Alisen Chung
committed
8328403: Remove applet usage from JColorChooser tests Test6977726
Reviewed-by: tr, honkar
1 parent 9d052e9 commit 1e76e1f

File tree

2 files changed

+31
-42
lines changed

2 files changed

+31
-42
lines changed

test/jdk/javax/swing/JColorChooser/Test6977726.html

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

test/jdk/javax/swing/JColorChooser/Test6977726.java

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 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
@@ -21,22 +21,42 @@
2121
* questions.
2222
*/
2323

24+
import java.awt.Color;
25+
import javax.swing.JColorChooser;
26+
import javax.swing.JLabel;
27+
2428
/*
2529
* @test
2630
* @bug 6977726
27-
* @summary Checks if JColorChooser.setPreviewPanel removes the old one
28-
* @author Sergey Malenkov
29-
* @run applet/manual=yesno Test6977726.html
31+
* @library /java/awt/regtesthelpers
32+
* @build PassFailJFrame
33+
* @summary Checks if JColorChooser.setPreviewPanel(JLabel) doesn't remove the preview panel but
34+
* removes the content of the default preview panel
35+
* @run main/manual Test6977726
3036
*/
3137

32-
import javax.swing.JApplet;
33-
import javax.swing.JColorChooser;
34-
import javax.swing.JLabel;
38+
public class Test6977726 {
39+
40+
public static void main(String[] args) throws Exception {
41+
String instructions = """
42+
Check that there is a panel with "Text Preview Panel" text
43+
and with title "Preview" in the JColorChooser.
44+
Test passes if the panel is as described, test fails otherwise.""";
45+
46+
PassFailJFrame.builder()
47+
.title("Test6977726")
48+
.instructions(instructions)
49+
.rows(5)
50+
.columns(40)
51+
.testTimeOut(2)
52+
.testUI(Test6977726::createColorChooser)
53+
.build()
54+
.awaitAndCheck();
55+
}
3556

36-
public class Test6977726 extends JApplet {
37-
public void init() {
38-
JColorChooser chooser = new JColorChooser();
57+
private static JColorChooser createColorChooser() {
58+
JColorChooser chooser = new JColorChooser(Color.BLUE);
3959
chooser.setPreviewPanel(new JLabel("Text Preview Panel"));
40-
getContentPane().add(chooser);
60+
return chooser;
4161
}
4262
}

0 commit comments

Comments
 (0)