diff --git a/test/jdk/performance/client/SwingMark/Makefile b/test/jdk/performance/client/SwingMark/Makefile
new file mode 100644
index 00000000000..ea4ae1ce256
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/Makefile
@@ -0,0 +1,106 @@
+#
+# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# - Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# - Neither the name of Oracle nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+SOURCEPATH=src
+CLASSES=build
+DIST=dist
+RESOURCES=resources
+
+SWINGMARK_CLASSES = \
+ $(CLASSES)/AbstractSwingTest.class \
+ $(CLASSES)/AdvancedTextAreaTest.class \
+ $(CLASSES)/InternalFrameTest.class \
+ $(CLASSES)/JMTest_01.class \
+ $(CLASSES)/JMTest_02.class \
+ $(CLASSES)/JMTest_03.class \
+ $(CLASSES)/JMTest_04.class \
+ $(CLASSES)/JMTest_05.class \
+ $(CLASSES)/LabelTest.class \
+ $(CLASSES)/ListTest.class \
+ $(CLASSES)/MenuTest.class \
+ $(CLASSES)/NullRunnable.class \
+ $(CLASSES)/SliderTest.class \
+ $(CLASSES)/SwingMark.class \
+ $(CLASSES)/SwingMarkPanel.class \
+ $(CLASSES)/TableColMoveTest.class \
+ $(CLASSES)/TableColTest.class \
+ $(CLASSES)/TableRowTest.class \
+ $(CLASSES)/TableScrollTest.class \
+ $(CLASSES)/TextAreaTest.class \
+ $(CLASSES)/TextPaneTest.class \
+ $(CLASSES)/TreeTest.class \
+ $(CLASSES)/TypingTest.class \
+ $(CLASSES)/resources/TableRowTest.class \
+ $(CLASSES)/resources/TableRowTest_ja.class
+
+SWINGMARK_RESOURCES = \
+ $(CLASSES)/resources/TestList.txt \
+ $(CLASSES)/resources/JMTest_04.properties \
+ $(CLASSES)/resources/JMTest_04_ja.properties \
+ $(CLASSES)/resources/ListTest.properties \
+ $(CLASSES)/resources/ListTest_ja.properties \
+ $(CLASSES)/resources/TextAreaTest.properties \
+ $(CLASSES)/resources/TextAreaTest_ja.properties
+
+all: mkdirs SwingMark.jar
+
+run: mkdirs SwingMark.jar
+ cd $(DIST) && java -jar SwingMark.jar -q
+
+SwingMark.jar: \
+ $(SWINGMARK_CLASSES) \
+ $(SWINGMARK_RESOURCES) \
+ $(CLASSES)/swingmark.manifest
+ jar cvmf $(CLASSES)/swingmark.manifest $(DIST)/SwingMark.jar -C $(CLASSES) .
+
+$(CLASSES)/swingmark.manifest:
+ echo "Main-Class: SwingMark" > $@
+
+$(DIST):
+ mkdir $(DIST)
+
+$(CLASSES):
+ mkdir $(CLASSES)
+
+mkdirs: $(DIST) $(CLASSES)
+
+$(CLASSES)/%.class: $(SOURCEPATH)/%.java
+ javac -d $(CLASSES) -sourcepath $(SOURCEPATH) $<
+
+$(CLASSES)/resources/%.properties: $(SOURCEPATH)/resources/%.properties
+ cp -r $< $@
+
+$(CLASSES)/resources/TestList.txt: $(SOURCEPATH)/resources/TestList.txt
+ cp -r $< $@
+
+clean:
+ rm -rf $(CLASSES)
+ rm -rf $(DIST)
diff --git a/test/jdk/performance/client/SwingMark/README b/test/jdk/performance/client/SwingMark/README
new file mode 100644
index 00000000000..3862cd3169c
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/README
@@ -0,0 +1,112 @@
+A Basic Performance Benchmark for Swing components.
+==================================================
+
+Introduction
+------------
+SwingMark is a small suite of automated benchmark tests created to test
+the speed of the Swing components. It is designed to be extensible so that
+it is easy to add new tests. Each test can be run inside the SwingMarkPanel
+test harness, or as a stand alone application.
+
+Getting Started
+---------------
+
+To build and run, add make, java and javac to your PATH and just type
+% make run
+
+This will build if needed, then execute
+
+% java -jar dist/SwingMark.jar -q
+
+Results will be output to the console.
+The "-q" causes SwingMark to exit when it is finished.
+
+If you run directly as below without -q you can click on the close item of the SwingMark window.
+
+% java -jar dist/SwingMark.jar
+
+In addition the tests can be run individually.
+For example, you could type the following:
+
+% java -cp SwingMark.jar SliderTest
+
+This will run the SliderTest as a stand alone application.
+
+Command Line Options
+====================
+
+There are several command line options you can use to control the harness.
+These include:
+
+* Repeat (-r)
+-------------
+The repeat option can be used to run the test suite multiple times inside the
+same VM invocation. For example:
+
+% java -jar SwingMark.jar -r 5
+
+will run the suite 5 times in succession.
+
+* LookAndFeel (-lf)
+-----------------
+
+You can use the -lf option to choose the Swing L&F with which to run the test.
+For example:
+
+% java SwingMark -lf com.sun.java.swing.plaf.motif.MotifLookAndFeel
+
+will run the suite using the Motif L&F.
+
+Quit (-q)
+------------
+
+The -q option will cause the suite to automatically exit when the run is completed.
+
+Version (-version)
+------------------
+
+The -version option will cause a string to be printed to the console
+which indicates the version of the suite you are running.
+
+Generate Report File (-f)
+-------------------------
+
+The -f option will cause a text file to be generate containing information
+about the time it took to execute each test.
+This is a simple XML file which contains run times for each test.
+For example:
+% java -jar SwingMark.jar -f TestTimes.txt
+
+Generate Memory Report (-m)
+--------------------------
+
+The -m option will cause a text file to be generate containing information
+the amount of memory used during the test.
+For example:
+% java -jar SwingMark.jar -m MemoryData.txt
+
+Note that all these options can be combined in any order desired.
+For example:
+% java SwingMark -q -r 4 -lf com.me.MyLookAndFeel -f Test.txt
+
+Test Selection
+==============
+
+A file called TestList.txt in the CWD can be used to over-ride which sets of tests are run.
+A default file is built-in to SwingMark as a resource.
+
+The default file content looks like this :-
+JMTest_04
+TextAreaTest
+SliderTest
+ListTest
+TableRowTest
+TreeTest
+
+Creating New Tests
+==================
+
+To create a new test, you'll need to extend AbstractSwingTest.
+See the JavaDoc for details on what each method does.
+Then add the name of your class to the "TestList.txt" file.
+This makes it easy to run arbitrary combinations of tests.
diff --git a/test/jdk/performance/client/SwingMark/src/AbstractSwingTest.java b/test/jdk/performance/client/SwingMark/src/AbstractSwingTest.java
new file mode 100644
index 00000000000..52394054f29
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/AbstractSwingTest.java
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.awt.ActiveEvent;
+import java.awt.Component;
+import java.awt.EventQueue;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
+import java.awt.event.PaintEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+
+/**
+ * Derive from this abstract base class when ever
+ * you want to create a new benchmark test which
+ * will be run in the SwingMark harness
+ *.
+ * The SwingMarkPanel class requires that tests subclass AbstractSwingTest.
+ *
+ * @see SwingMarkPanel
+ *
+ */
+
+public abstract class AbstractSwingTest {
+
+ public int paintCount = 0;
+
+ /**
+ * Override this when subclassing AbstractSwingTest.
+ *
+ * @return A very short description of the test
+ */
+ public abstract String getTestName();
+
+ /**
+ * Override this when subclassing AbstractSwingTest.
+ * Here you create and initialize the component, or
+ * group of components, which will be exercised by
+ * your test.
+ *
+ * Typically you will create a JPanel and insert
+ * components into the panel.
+ *
+ * @return The JComponent which will be made visible for your test
+ */
+ public abstract JComponent getTestComponent();
+
+ /**
+ * Override this when subclassing AbstractSwingTest.
+ * Here you create the code to automate your test,
+ * This code can be written in many ways. For example, you
+ * could directly modify the component, or its' model.
+ * You could also post events to the EventQueue.
+ * It's up to you
+ */
+ public abstract void runTest();
+
+ /**
+ * This method is used to determine if a test can be run from within
+ * an applet. If your test will cause security exceptions when run as
+ * an applet then you should return false from this method.
+ */
+ public boolean canRunInApplet() {
+ return true;
+ }
+
+ public int getPaintCount() {
+ return paintCount;
+ }
+ /**
+ * This static method is used to run your test as a stand-alone
+ * application. Just pass an instance of your test to this function.
+ * This is especially useful when you're developing your test, or
+ * when you want to concentrate on a single area.
+ *
+ * To allow your test to be run stand-alone, you need to add a main() that
+ * looks like this
+ *
+ * public static void main(String[] args) {
+ * runStandAloneTest( new MyTestName() );
+ * }
+ */
+ @SuppressWarnings("deprecation")
+ public static void runStandAloneTest(AbstractSwingTest test) {
+ long startTime = System.currentTimeMillis();
+ JFrame f = new JFrame();
+ f.addWindowListener( new WindowAdapter(){
+ public void windowClosing(WindowEvent e){
+ System.exit(0);}} );
+ f.getContentPane().add( test.getTestComponent() );
+ f.pack();
+ f.show();
+ rest();
+ syncRam();
+ long endStartup = System.currentTimeMillis();
+ test.runTest();
+ rest();
+ long endTests = System.currentTimeMillis();
+ System.out.println("Startup Time: " + (endStartup - startTime));
+ System.out.println("Test Time: " + (endTests - endStartup));
+
+ if (test.getPaintCount() > 0) {
+ System.out.println("Called Paint: " + test.getPaintCount() + " times");
+ } else {
+ System.out.println("Painting calls not counted.");
+ }
+
+ }
+
+ @SuppressWarnings("removal")
+ public static void syncRam() {
+ System.gc();
+ System.runFinalization();
+ System.gc();
+ try {
+ Thread.sleep(100);
+ } catch (Exception e) {
+ System.out.println( "failed sleeping " + e);
+ }
+ }
+
+ private static Component BOGUS_COMPONENT = new JPanel();
+ private static EventQueue Q = Toolkit.getDefaultToolkit().getSystemEventQueue();
+
+ // Invoked during tests to wait until the current event has finished
+ // processing. At the time of this writing AWT's EventQueue has 3
+ // queues: LOW, NORMAL and HIGH. Swing's repaint events end up on
+ // the NORMAL queue, AWT's paint events end up on the LOW queue. Runnable
+ // events end up on the NORMAL queue. The code to rest blocks until ALL
+ // queues are empty. This is accomplished by adding an event
+ // (NotifyingPaintEvent) to the EventQueue. When the event is dispatched
+ // the EventQueue is checked, if the EQ is empty rest exits, otherwise
+ // rest loops through adding another event to the EQ.
+
+ public static void rest() {
+ Thread.yield();
+ boolean qEmpty = false;
+ while (!qEmpty) {
+ NotifyingPaintEvent e = new NotifyingPaintEvent(BOGUS_COMPONENT);
+ Q.postEvent(e);
+ synchronized(e) {
+ // Wait until the event has been dispatched
+ while (!e.isDispatched()) {
+ try {
+ e.wait();
+ } catch (InterruptedException ie) {
+ System.out.println("IE: " + ie);
+ }
+ }
+ // Check if the q is empty
+ qEmpty = e.qEmpty();
+ }
+ }
+ Toolkit.getDefaultToolkit().sync();
+ }
+
+
+ private static class NotifyingPaintEvent extends PaintEvent
+ implements ActiveEvent {
+ private static int nextLocation;
+
+ boolean dispatched = false;
+ boolean qEmpty;
+ private int location;
+
+ NotifyingPaintEvent(Component x) {
+ super(x, PaintEvent.UPDATE, null);
+ synchronized(NotifyingPaintEvent.class) {
+ location = nextLocation++;
+ }
+ }
+
+ // 1.3 uses this for coalescing. To avoid having these events
+ // coalesce return a new location for each event.
+ public Rectangle getUpdateRect() {
+ return new Rectangle(location, location, 1, 1);
+ }
+
+ public synchronized boolean isDispatched() {
+ return dispatched;
+ }
+
+ public synchronized boolean qEmpty() {
+ return qEmpty;
+ }
+
+ public void dispatch() {
+ qEmpty = (Q.peekEvent() == null);
+ synchronized(this) {
+ dispatched = true;
+ notifyAll();
+ }
+ }
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/AdvancedTextAreaTest.java b/test/jdk/performance/client/SwingMark/src/AdvancedTextAreaTest.java
new file mode 100644
index 00000000000..898bc586de8
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/AdvancedTextAreaTest.java
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Random;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Toolkit;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+/**
+ * This test is mean to isolate the speed of the JTextArea
+ * It creates a JTextArea and then perform the following
+ * behavios :
+ * (1) Append text
+ * (2) Change Font with random size and type
+ * (3) Cut with random selection
+ * (4) Copy with random selection
+ * (5) Paste with random selection
+ *
+ */
+
+public class AdvancedTextAreaTest extends AbstractSwingTest {
+
+ JTextArea textArea1;
+ final int repeat = 100;
+
+ public JComponent getTestComponent() {
+ JPanel panel = new JPanel();
+ textArea1 = new JTextArea(10, 30);
+ textArea1.setLineWrap(true);
+ JScrollPane scroller = new JScrollPane(textArea1);
+ panel.add(scroller);
+ return panel;
+ }
+
+ public String getTestName() {
+ return "Adv TextArea";
+ }
+
+ public void runTest() {
+ testTextArea(textArea1, "Swing is Fast! ");
+ }
+
+ public void testTextArea(JTextArea currentTextArea, String appendThis) {
+ TextAppender appender = new TextAppender(currentTextArea, appendThis);
+ TextSelector selector = new TextSelector(currentTextArea);
+ TextCutter cutter = new TextCutter (currentTextArea);
+ TextPaster paster = new TextPaster (currentTextArea);
+ CaretSetter caretSetter = new CaretSetter(currentTextArea);
+ TextCopier copier = new TextCopier(currentTextArea);
+ TextFontSetter fonter = new TextFontSetter(currentTextArea);
+
+ for (int i = 0; i < repeat; i++) {
+ try {
+ SwingUtilities.invokeLater(appender);
+ currentTextArea.repaint();
+ rest();
+ } catch (Exception e) {System.out.println(e);}
+ }
+
+
+ for (int i = 0; i < repeat; i++) {
+ try {
+ // Change font
+ SwingUtilities.invokeAndWait(fonter);
+
+ // Cut
+ selector.setSelection();
+ SwingUtilities.invokeAndWait(selector);
+ SwingUtilities.invokeAndWait(cutter);
+
+ // Copy
+ caretSetter.setCaretPosition();
+ SwingUtilities.invokeAndWait(caretSetter);
+ SwingUtilities.invokeAndWait(copier);
+
+ // Paste
+ caretSetter.setCaretPosition();
+ SwingUtilities.invokeAndWait(caretSetter);
+ SwingUtilities.invokeAndWait(paster);
+
+ } catch (Exception e) {System.out.println(e);}
+ }
+ }
+
+ public static void main(String[] args) {
+ runStandAloneTest(new AdvancedTextAreaTest());
+ }
+
+ static class TextAppender implements Runnable {
+ JTextArea area;
+ String appendString;
+
+
+ public TextAppender(JTextArea textArea, String appendThis) {
+ area = textArea;
+ appendString = appendThis;
+ }
+
+ public void run() {
+ area.append(appendString);
+ }
+ }
+
+ static class TextCutter implements Runnable {
+ JTextArea area;
+
+ public TextCutter(JTextArea textArea) {
+ area = textArea;
+ }
+
+ public void run() {
+ area.cut();
+ }
+ }
+
+ static class TextCopier implements Runnable {
+ JTextArea area;
+
+ public TextCopier(JTextArea textArea) {
+ area = textArea;
+ }
+
+ public void run() {
+ area.copy();
+ }
+ }
+
+ static class TextFontSetter implements Runnable {
+ JTextArea area;
+ String[] fonts;
+ Random random;
+ int index = 0;
+
+ @SuppressWarnings("deprecation")
+ public TextFontSetter(JTextArea textArea) {
+ area = textArea;
+ random = new Random();
+ fonts = Toolkit.getDefaultToolkit().getFontList();
+ }
+
+ public void run() {
+ area.setFont(new Font( fonts[index],
+ Math.abs(random.nextInt()) % 3,
+ Math.abs(random.nextInt()) % 20));
+ area.repaint();
+ index ++ ;
+ index = index % fonts.length ;
+ }
+ }
+
+ static class TextPaster implements Runnable {
+ JTextArea area;
+
+ public TextPaster(JTextArea textArea) {
+ area = textArea;
+ }
+
+ public void run() {
+ area.paste();
+ }
+ }
+
+ static class TextSelector implements Runnable {
+ JTextArea area;
+ int start;
+ int end;
+ Random random;
+
+ public TextSelector(JTextArea textArea) {
+ area = textArea;
+ random = new Random();
+ }
+
+ public void setSelection() {
+ int length = area.getText().length();
+ start = Math.abs( random.nextInt()) % length;
+ end = start + 50;
+
+ if ( end >= length ) {
+ end = length - 1 ;
+ }
+ }
+
+ public void run() {
+ area.setSelectionStart(start);
+ area.setSelectionEnd(end);
+ area.setSelectionColor(new Color(Math.abs(random.nextInt()) % 256,
+ Math.abs(random.nextInt()) % 256,
+ Math.abs(random.nextInt()) % 256));
+ }
+ }
+
+ static class CaretSetter implements Runnable {
+ JTextArea area;
+ int position;
+ Random random;
+
+ public CaretSetter(JTextArea textArea) {
+ area = textArea;
+ random = new Random();
+ }
+
+ public void setCaretPosition() {
+ position =Math.abs( random.nextInt()) % area.getText().length();
+ }
+
+ public void run() {
+ area.setCaretPosition(position);
+ }
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/InternalFrameTest.java b/test/jdk/performance/client/SwingMark/src/InternalFrameTest.java
new file mode 100644
index 00000000000..b3cb2dd1bf8
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/InternalFrameTest.java
@@ -0,0 +1,331 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Rectangle;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JDesktopPane;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JLayeredPane;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+
+/**
+ * A SwingMark to test two different aspects of InternalFrames.
+ * -repaint Brings each internal frame to the front of the
+ * other internal frames and message each widget to repaint.
+ * -move Moves each of the internal frames around the desktop.
+ *
+ * If you you do not specify one the default is to do both.
+ * The following options are also available:
+ * -numLevels Number of levels to create, default is 1.
+ * -numInternalFrames Number of internal frames to create per level,
+ default is 10.
+ * -numButtons Number of widgets to create, default is 10.
+ * -laf Look and feel to use, default is metal.
+ *
+ */
+
+public class InternalFrameTest extends AbstractSwingTest {
+
+ JDesktopPane desktop;
+ JFrame frame;
+ int numInternalFrames;
+ int numButtons;
+ int numLevels;
+ JInternalFrame[][] frames;
+ int whatTest;
+
+ JComponent widget;
+
+ public InternalFrameTest(int numLevels, int numInternalFrames,
+ int numButtons, int whatTest) {
+ this.numLevels = numLevels;
+ this.numInternalFrames = numInternalFrames;
+ this.numButtons = numButtons;
+ this.whatTest = whatTest;
+ frames = new JInternalFrame[numLevels][];
+ createDesktopPane();
+ createInternalFrames();
+ }
+
+ public InternalFrameTest() {
+ this( 1, 10, 10, 3);
+ }
+
+ public String getTestName() {
+ return "InternalFrame";
+ }
+
+ public JComponent getTestComponent() {
+ return desktop;
+ }
+
+ public void runTest() {
+ if ((whatTest & 1) != 0) {
+ testMove();
+ }
+ if ((whatTest & 2) != 0) {
+ testRepaint();
+ }
+ }
+
+ protected void createDesktopPane() {
+ desktop = new JDesktopPane();
+ desktop.setPreferredSize(new Dimension(425, 425));
+ desktop.setMinimumSize(new Dimension(425, 425));
+ }
+
+ protected void createInternalFrames() {
+ Container parent = desktop;
+
+ for (int counter = 0; counter < numLevels; counter++) {
+ Integer level = Integer.valueOf(JLayeredPane.DEFAULT_LAYER.
+ intValue() + counter);
+
+ frames[counter] = new JInternalFrame[numInternalFrames];
+ for (int iCounter = 0; iCounter < numInternalFrames; iCounter++) {
+ JInternalFrame internalFrame;
+
+ internalFrame = createInternalFrame(level, iCounter);
+ parent.add(internalFrame);
+ frames[counter][iCounter] = internalFrame;
+ }
+ }
+ }
+
+ protected JInternalFrame createInternalFrame(Integer id, int number) {
+ JInternalFrame jif;
+
+ jif = new JInternalFrame("Internal Frame " + id + " " + number,
+ true, true, true, true);
+ createWidgets(jif);
+
+ jif.setBounds((number * 50) % 220, (number * 50) % 220,
+ 100 + (number * 50) % 125,
+ 100 + (number * 25) % 125);
+
+ return jif;
+ }
+
+ protected void createWidgets(JInternalFrame jif) {
+ Container parent = jif.getContentPane();
+ JComponent child = null;
+
+ parent.setLayout(new FlowLayout());
+ for (int counter = 0; counter < numButtons; counter++) {
+ switch (counter % 4) {
+ case 0:
+ child = new JButton("Button " + counter);
+ break;
+ case 1:
+ child = new JCheckBox("CheckBox " + counter);
+ break;
+ case 2:
+ child = new JTextField("TF " + counter);
+ break;
+ case 3:
+ child = new JLabel("Label " + counter);
+ break;
+ }
+ parent.add(child);
+ }
+ if (widget == null) {
+ widget = child;
+ }
+ }
+
+ protected void slide(MoveRunnable mv, JInternalFrame frame,
+ int x, int y, int newX, int newY) {
+ int xInc = (newX - x) / 10;
+ int yInc = (newY - y) / 10;
+
+ mv.jif = frame;
+ mv.moveToFront = true;
+ if (xInc != 0 || yInc != 0) {
+ mv.jif = frame;
+ for (int counter = 0; counter < 10; counter++) {
+ x += xInc;
+ y += yInc;
+ mv.newX = x;
+ mv.newY = y;
+ try {
+ SwingUtilities.invokeLater(mv);
+ rest();
+ }
+ catch (Exception ex) {
+ System.out.println("--> " + ex);
+ }
+ }
+ }
+ }
+
+ protected void testMove() {
+ Rectangle tempRect = new Rectangle();
+ int width = desktop.getWidth();
+ int height = desktop.getHeight();
+ int tempWidth;
+ int tempHeight;
+ MoveRunnable mv = new MoveRunnable();
+
+
+ for (int counter = frames.length - 1; counter >= 0; counter--) {
+ for (int iCounter = frames[counter].length - 1; iCounter >= 0;
+ iCounter--) {
+ JInternalFrame iFrame = frames[counter][iCounter];
+
+ iFrame.getBounds(tempRect);
+ tempWidth = width - tempRect.width;
+ tempHeight = height - tempRect.height;
+ // Slide to origin
+ slide(mv, iFrame, tempRect.x, tempRect.y, 0, 0);
+ // Slide to the right
+ slide(mv, iFrame, 0, 0, tempWidth, 0);
+ // Slide down
+ slide(mv, iFrame, tempWidth, 0, tempWidth, tempHeight);
+ // Slide to the left
+ slide(mv, iFrame, tempWidth, tempHeight, 0, tempHeight);
+ // Slide to original spot.
+ slide(mv, iFrame, 0, tempHeight, tempRect.x, tempRect.y);
+ }
+ }
+ }
+
+ public void testRepaint() {
+ MoveRunnable mr = new MoveRunnable();
+ Rectangle tempRect = new Rectangle();
+
+ for (int counter = frames.length - 1; counter >= 0; counter--) {
+ for (int iCounter = frames[counter].length - 1; iCounter >= 0;
+ iCounter--) {
+ JInternalFrame iFrame = frames[counter][iCounter];
+ Container c = iFrame.getContentPane();
+
+ iFrame.getBounds(tempRect);
+
+ mr.moveToFront = true;
+ mr.newX = tempRect.x;
+ mr.newY = tempRect.y;
+ mr.jif = iFrame;
+ try {
+ SwingUtilities.invokeLater(mr);
+ rest();
+ }
+ catch (Exception ex) {
+ System.out.println("--> " + ex);
+ }
+
+ iFrame.repaint();
+ rest();
+ for (int cCounter = c.getComponentCount() - 1;
+ cCounter >= 0; cCounter--) {
+ JComponent comp = (JComponent)c.getComponent(cCounter);
+
+ comp.getBounds(tempRect);
+ comp.repaint();
+ rest();
+ }
+ }
+ }
+ }
+
+ public static void main(String args[]) {
+ int whatTest = 0;
+ int numInternalFrames = 10;
+ int numButtons = 10;
+ int numLevels = 1;
+
+ for (int counter = args.length - 1; counter >= 0; counter--) {
+ if (args[counter].equals("-repaint")) {
+ whatTest |= 2;
+ }
+ else if (args[counter].equals("-move")) {
+ whatTest |= 1;
+ }
+ else if (args[counter].equals("-numButtons")) {
+ try {
+ numButtons = Integer.parseInt(args[counter + 1]);
+ }
+ catch (NumberFormatException nfe) {}
+ }
+ else if (args[counter].equals("-numInternalFrames")) {
+ try {
+ numInternalFrames =Integer.parseInt(args[counter + 1]);
+ }
+ catch (NumberFormatException nfe) {}
+ }
+ else if (args[counter].equals("-numLevels")) {
+ try {
+ numLevels = Integer.parseInt(args[counter + 1]);
+ }
+ catch (NumberFormatException nfe) {}
+ }
+ else if (args[counter].equals("-laf")) {
+ try {
+ UIManager.setLookAndFeel(args[counter + 1]);
+ }
+ catch (Exception lafEX) {
+ System.out.println("Couldn't laf: " + lafEX);
+ }
+ }
+ }
+ if (whatTest == 0) {
+ whatTest = 3;
+ }
+ final InternalFrameTest test =
+ new InternalFrameTest(numLevels, numInternalFrames, numButtons, whatTest);
+
+ runStandAloneTest(test);
+ System.exit(1);
+ }
+
+ static class MoveRunnable implements Runnable {
+ int newX;
+ int newY;
+ JInternalFrame jif;
+ boolean moveToFront;
+
+ public void run() {
+ if (moveToFront) {
+ moveToFront = false;
+ jif.moveToFront();
+ }
+ jif.setLocation(newX, newY);
+ }
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/JMTest_01.java b/test/jdk/performance/client/SwingMark/src/JMTest_01.java
new file mode 100644
index 00000000000..83127e3bc21
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/JMTest_01.java
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Date;
+import java.awt.BorderLayout;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.Toolkit;
+import java.awt.event.KeyEvent;
+import javax.swing.DefaultListModel;
+import javax.swing.JComponent;
+import javax.swing.JList;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
+
+/**
+ * This tests Swing Menus by posting key events to the EventQueue
+ * Each time a menu is selected ActionEvent/MenuEvent is generated
+ * and that event causes the menu text to be appended to a JList
+ *
+ */
+
+public class JMTest_01 extends AbstractSwingTest {
+
+ JList list;
+ JMenuBar jmenubar = null;
+
+ int nMenuCount = 2;
+ int nMenuItemCount = 4;
+ int ENTER = 10;
+ int LEFT = 37;
+ int RIGHT = 39;
+ int DOWN = 40;
+ int UP = 38;
+
+ /**
+ * This test cannot run as an applet because it
+ * posts events to the event queue
+ */
+ public boolean canRunInApplet() {
+ return false;
+ }
+
+ public JComponent getTestComponent() {
+ JPanel panel = new JPanel();
+
+ JMenu jmenu;
+ JMenuItem jmenuitem;
+
+ panel.setLayout(new BorderLayout());
+
+ jmenubar = new JMenuBar();
+ for (int i = 0; i < nMenuCount; i ++) {
+ jmenu = new JMenu("JMenu" + i);
+ jmenu.setMnemonic('0' + i);
+ jmenu.addMenuListener(new MyMenuListener());
+ jmenubar.add(jmenu);
+
+ for (int j = 0; j < nMenuItemCount; j ++) {
+ jmenuitem = new JMenuItem("JMenuItem" + i + j);
+ jmenuitem.setMnemonic('0' + j);
+ jmenu.add(jmenuitem);
+ }
+ }
+
+ panel.add("North", jmenubar);
+
+ list = new JList(new DefaultListModel());
+ list.setFont(new Font("Serif", Font.BOLD, 14));
+ JScrollPane scrollPane = new JScrollPane(list);
+ panel.add("Center", scrollPane);
+
+ return panel;
+ }
+
+ public String getTestName() {
+ return "JMTest_01";
+ }
+
+ public void runTest() {
+ for (int i = 0; i < 10; i++) {
+ testMenu();
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ public void testMenu() {
+ JMenu menu;
+ KeyEvent key;
+ EventQueue queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
+ int direction = RIGHT;
+
+ int nCount = jmenubar.getMenuCount();
+
+ menu = jmenubar.getMenu(0);
+ int firstMnem = menu.getMnemonic();
+
+ key = new KeyEvent(menu, KeyEvent.KEY_PRESSED,
+ new Date().getTime(), KeyEvent.ALT_DOWN_MASK, firstMnem);
+ queue.postEvent(key);
+
+ for (int i = 1; i < nCount; i ++) {
+ key = new KeyEvent(menu, KeyEvent.KEY_PRESSED,
+ new Date().getTime(), 0, direction);
+ queue.postEvent(key);
+ rest();
+
+ menu = jmenubar.getMenu(i);
+
+ try {
+ Thread.sleep(10);
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ }
+
+ direction = LEFT;
+ for (int i = 1; i < nCount; i ++) {
+ key = new KeyEvent(menu, KeyEvent.KEY_PRESSED,
+ new Date().getTime(), 0, direction);
+ queue.postEvent(key);
+ try {
+ Thread.sleep(10);
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+
+ menu = jmenubar.getMenu(i);
+
+ try {
+ Thread.sleep(10);
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ runStandAloneTest(new JMTest_01());
+ }
+
+ public class MyMenuListener implements MenuListener {
+ public void menuCanceled(MenuEvent e) {
+ }
+
+ public void menuDeselected(MenuEvent e) {
+ }
+
+ public void menuSelected(MenuEvent e) {
+ JMenu comp = (JMenu) e.getSource();
+ Display(comp.getText());
+ }
+ }
+
+ public void Display(String str) {
+ DefaultListModel lm = (DefaultListModel) list.getModel();
+ lm.addElement(str);
+ int nSize = lm.getSize();
+ list.setSelectedIndex(nSize - 1);
+ list.requestFocus();
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/JMTest_02.java b/test/jdk/performance/client/SwingMark/src/JMTest_02.java
new file mode 100644
index 00000000000..b77844162ab
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/JMTest_02.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Date;
+import java.awt.BorderLayout;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import javax.swing.DefaultListModel;
+import javax.swing.AbstractButton;
+import javax.swing.JComponent;
+import javax.swing.JList;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
+/**
+ * This tests Swing Menus by posting key events to the EventQueue
+ * Each time a menu is selected ActionEvent/MenuEvent is generated
+ * and that event causes the menu text to be appended to a JList
+ */
+
+public class JMTest_02 extends AbstractSwingTest {
+ JList list;
+ JMenuBar jmenubar = null;
+
+ int nMenuCount = 3;
+ int nMenuItemCount = 4;
+ int ENTER = 10;
+ int LEFT = 37;
+ int RIGHT = 39;
+ int DOWN = 40;
+ int UP = 38;
+
+ int repeat = 15;
+
+ /**
+ * This test cannot run as an applet because it
+ * posts events to the event queue
+ */
+ public boolean canRunInApplet() {
+ return false;
+ }
+
+ public JComponent getTestComponent() {
+ JPanel panel = new JPanel();
+
+ JMenu jmenu;
+ JMenuItem jmenuitem;
+
+ panel.setLayout(new BorderLayout());
+
+ jmenubar = new JMenuBar();
+ for (int i = 0; i < nMenuCount; i ++) {
+ jmenu = new JMenu("JMenu" + i);
+ jmenu.setMnemonic('0' + i);
+ jmenubar.add(jmenu);
+
+ for (int j = 0; j < nMenuItemCount; j ++) {
+ jmenuitem = new JMenuItem("JMenuItem" + i + j);
+ jmenuitem.setMnemonic('0' + j);
+ jmenuitem.addActionListener(new MyActionListener());
+ jmenu.add(jmenuitem);
+ }
+ }
+
+ panel.add("North", jmenubar);
+
+ list = new JList(new DefaultListModel());
+ list.setFont(new Font("Serif", Font.BOLD, 14));
+ JScrollPane scrollPane = new JScrollPane(list);
+ panel.add("Center", scrollPane);
+
+ return panel;
+ }
+
+ public String getTestName() {
+ return "Menus";
+ }
+
+ public void runTest() {
+ for (int i = 0; i < repeat; i++) {
+ testMenu();
+ }
+ }
+
+ public void testMenu() {
+ int direction = DOWN;
+ FireEvents(direction);
+ }
+
+ @SuppressWarnings("deprecation")
+ public void FireEvents(int direction) {
+ int nCount = jmenubar.getMenuCount();
+ JMenuItem menuitem;
+ KeyEvent key;
+ int firstMnem;
+ JMenu menu;
+
+ EventQueue queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
+ for (int i = 0; i < nCount; i++) {
+ menu = jmenubar.getMenu(i);
+ int nItemCount = menu.getItemCount();
+
+ for (int j = 0; j < nItemCount; j ++) {
+ firstMnem = menu.getMnemonic();
+ key = new KeyEvent(menu, KeyEvent.KEY_PRESSED,
+ new Date().getTime(), KeyEvent.ALT_MASK, firstMnem);
+ queue.postEvent(key);
+ rest();
+
+ for (int k = 0; k < j; k++) {
+ key = new KeyEvent(menu, KeyEvent.KEY_PRESSED,
+ new Date().getTime(), 0, direction);
+ queue.postEvent(key);
+ try {
+ Thread.sleep(10);
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ }
+
+ key = new KeyEvent(menu, KeyEvent.KEY_PRESSED, new Date().getTime(), 0, ENTER);
+ queue.postEvent(key);
+ try {
+ Thread.sleep(10);
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ runStandAloneTest(new JMTest_02());
+ }
+
+ public class MyActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ AbstractButton comp = (AbstractButton) e.getSource();
+ Display(comp.getText());
+ }
+ }
+
+ public void Display(String str) {
+ DefaultListModel lm = (DefaultListModel) list.getModel();
+ lm.addElement(str);
+ int nSize = lm.getSize();
+ list.setSelectedIndex(nSize - 1);
+ list.requestFocus();
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/JMTest_03.java b/test/jdk/performance/client/SwingMark/src/JMTest_03.java
new file mode 100644
index 00000000000..eed96da1e93
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/JMTest_03.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Date;
+import java.awt.BorderLayout;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import javax.swing.AbstractButton;
+import javax.swing.DefaultListModel;
+import javax.swing.JComponent;
+import javax.swing.JList;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
+/**
+ * This tests Swing Menus by posting key events to the EventQueue
+ * Each time a menu is selected ActionEvent/MenuEvent is generated
+ * and that event causes the menu text to be appended to a JList
+ */
+
+public class JMTest_03 extends AbstractSwingTest {
+ JList list;
+ JMenuBar jmenubar = null;
+
+ int nMenuCount = 2;
+ int nMenuItemCount = 4;
+ int ENTER = 10;
+ int LEFT = 37;
+ int RIGHT = 39;
+ int DOWN = 40;
+ int UP = 38;
+
+ /**
+ * This test cannot run as an applet because it
+ * posts events to the event queue
+ */
+ public boolean canRunInApplet() {
+ return false;
+ }
+
+ public JComponent getTestComponent() {
+ JPanel panel = new JPanel();
+
+ JMenu jmenu;
+ JMenuItem jmenuitem;
+
+ panel.setLayout(new BorderLayout());
+
+ jmenubar = new JMenuBar();
+ for (int i = 0; i < nMenuCount; i ++) {
+ jmenu = new JMenu("JMenu" + i);
+ jmenu.setMnemonic('0' + i);
+ jmenubar.add(jmenu);
+
+ for (int j = 0; j < nMenuItemCount; j ++) {
+ jmenuitem = new JMenuItem("JMenuItem" + i + j);
+ jmenuitem.setMnemonic('0' + j);
+ jmenuitem.addActionListener(new MyActionListener());
+ jmenu.add(jmenuitem);
+ }
+ }
+
+ panel.add("North", jmenubar);
+
+ list = new JList(new DefaultListModel());
+ list.setFont(new Font("Serif", Font.BOLD, 14));
+ JScrollPane scrollPane = new JScrollPane(list);
+ panel.add("Center", scrollPane);
+ return panel;
+ }
+
+ public String getTestName() {
+ return "JMTest_03";
+ }
+
+ public void runTest() {
+ for (int i = 0; i < 10; i++) {
+ testMenu();
+ }
+ }
+
+ public void testMenu() {
+ FireEvents();
+ }
+
+ @SuppressWarnings("deprecation")
+ public void FireEvents() {
+ int nCount = jmenubar.getMenuCount();
+ JMenuItem menuitem;
+ KeyEvent key;
+ int firstMnem;
+ JMenu menu;
+
+ EventQueue queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
+ for (int i = 0; i < nCount; i++) {
+ menu = jmenubar.getMenu(i);
+ int nItemCount = menu.getItemCount();
+
+ for (int j = 0; j < nItemCount; j ++) {
+ firstMnem = menu.getMnemonic();
+ key = new KeyEvent(menu, KeyEvent.KEY_PRESSED,
+ new Date().getTime(), KeyEvent.ALT_DOWN_MASK, firstMnem);
+ queue.postEvent(key);
+ rest();
+
+ int mnem = menu.getItem(j).getMnemonic();
+
+ key = new KeyEvent(menu, KeyEvent.KEY_PRESSED, new Date().getTime(), 0, mnem);
+ queue.postEvent(key);
+ try {
+ Thread.sleep(10);
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ runStandAloneTest(new JMTest_03());
+ }
+
+ public class MyActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ AbstractButton comp = (AbstractButton) e.getSource();
+ Display(comp.getText());
+ }
+ }
+
+ public void Display(String str) {
+ DefaultListModel lm = (DefaultListModel) list.getModel();
+ lm.addElement(str);
+ int nSize = lm.getSize();
+ list.setSelectedIndex(nSize - 1);
+ list.requestFocus();
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/JMTest_04.java b/test/jdk/performance/client/SwingMark/src/JMTest_04.java
new file mode 100644
index 00000000000..4c4c7f65d32
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/JMTest_04.java
@@ -0,0 +1,226 @@
+import java.util.Date;
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.ResourceBundle;
+import java.awt.BorderLayout;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import javax.swing.AbstractButton;
+import javax.swing.DefaultListModel;
+import javax.swing.JComponent;
+import javax.swing.JList;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
+/**
+ * This tests Swing Menus by posting key events to the EventQueue
+ * Each time a menu is selected ActionEvent/MenuEvent is generated
+ * and that event causes the menu text to be appended to a JList
+ */
+
+public class JMTest_04 extends AbstractSwingTest {
+ JList list;
+ JMenuBar jmenubar = null;
+
+ int nMenuCount = 2;
+ int nMenuItemCount = 4;
+ int ENTER = 10;
+ int LEFT = 37;
+ int RIGHT = 39;
+ int DOWN = 40;
+ int UP = 38;
+
+ String MENU_STRING = "JMenu";
+ String MENU_ITEM_STRING = "JMenuItem";
+ String SUB_MENU_STRING = "SubMenu";
+
+ /**
+ * This test cannot run as an applet because it
+ * posts events to the event queue
+ */
+ public boolean canRunInApplet() {
+ return false;
+ }
+
+ public JComponent getTestComponent() {
+ loadBundle();
+ JPanel panel = new JPanel();
+
+ JMenu jmenu;
+ JMenuItem jmenuitem;
+ JMenu jsubmenu;
+
+ panel.setLayout(new BorderLayout());
+
+ jmenubar = new JMenuBar();
+ for (int i = 0; i < nMenuCount; i ++) {
+ jmenu = new JMenu(MENU_STRING + i);
+ jmenu.setMnemonic('0' + i);
+ jmenubar.add(jmenu);
+
+ for (int j = 0; j < nMenuItemCount; j ++) {
+ int mn = 'A';
+ mn = mn + j;
+ jsubmenu = new JMenu(SUB_MENU_STRING + String.valueOf((char) mn));
+ jsubmenu.setMnemonic('A' + j);
+ jmenu.add(jsubmenu);
+ for (int k = 0; k <= j; k ++) {
+ jmenuitem = new JMenuItem(SUB_MENU_STRING+" - "+MENU_ITEM_STRING + i + (char) mn + k);
+ jmenuitem.setMnemonic('0' + k);
+ jmenuitem.addActionListener(new MyActionListener());
+ jsubmenu.add(jmenuitem);
+ }
+ }
+ }
+
+
+ panel.add("North", jmenubar);
+
+ list = new JList(new DefaultListModel());
+ list.setFont(new Font("Serif", Font.BOLD, 14));
+ JScrollPane scrollPane = new JScrollPane(list);
+ panel.add("Center", scrollPane);
+
+ return panel;
+ }
+
+ private void loadBundle() {
+ ResourceBundle bundle = ResourceBundle.getBundle("resources.JMTest_04");
+ MENU_STRING = bundle.getString("MenuString");
+ MENU_ITEM_STRING = bundle.getString("MenuItemString");
+ SUB_MENU_STRING = bundle.getString("SubMenuString");
+ }
+
+ public String getTestName() {
+ return "Sub-Menus";
+ }
+
+ public void runTest() {
+ for (int i = 0; i < 4; i++) {
+ testMenu();
+ }
+ }
+
+ public void testMenu() {
+ FireEvents();
+ }
+
+
+ @SuppressWarnings("deprecation")
+ public void FireEvents() {
+ int nMenuCount = jmenubar.getMenuCount();
+
+ KeyEvent key;
+ int firstMnem;
+ int direction;
+
+ EventQueue queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
+ jmenubar.requestFocus();
+ for (int i = 0; i < nMenuCount; i ++) {
+ JMenu currentmenu = jmenubar.getMenu(i);
+ int currentmenuMnem = currentmenu.getMnemonic();
+
+ int nMenuItemCount = currentmenu.getItemCount();
+
+ for (int j = 0; j < nMenuItemCount; j ++) {
+ JMenuItem tempmenuitem = currentmenu.getItem(j);
+ if (tempmenuitem instanceof JMenu) {
+ JMenu targetmenu = (JMenu) tempmenuitem;
+ int iTargetMenuCount = targetmenu.getItemCount();
+
+ for (int k = 0; k < iTargetMenuCount; k ++) {
+ key = new KeyEvent(currentmenu, KeyEvent.KEY_PRESSED,
+ new Date().getTime(), KeyEvent.ALT_MASK, currentmenuMnem);
+ queue.postEvent(key);
+
+ rest();
+
+ direction = DOWN;
+ for (int iTemp = 0; iTemp < j; iTemp ++) {
+ key = new KeyEvent(currentmenu, KeyEvent.KEY_PRESSED,
+ new Date().getTime(), 0, direction);
+ queue.postEvent(key);
+ rest();
+ }
+
+
+ direction = RIGHT;
+ key = new KeyEvent(currentmenu, KeyEvent.KEY_PRESSED,
+ new Date().getTime(), 0, direction);
+ queue.postEvent(key);
+ rest();
+
+ direction = DOWN;
+ for (int iTemp = 0; iTemp < k; iTemp ++) {
+ key = new KeyEvent(targetmenu, KeyEvent.KEY_PRESSED,
+ new Date().getTime(), 0, direction);
+ queue.postEvent(key);
+ rest();
+ }
+
+ key = new KeyEvent(targetmenu, KeyEvent.KEY_PRESSED,
+ new Date().getTime(), 0, ENTER);
+ queue.postEvent(key);
+ rest();
+ }
+ }
+ }
+ }
+ }
+
+
+ public static void main(String[] args) {
+ runStandAloneTest(new JMTest_04());
+ }
+
+ public class MyActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ AbstractButton comp = (AbstractButton) e.getSource();
+ Display(comp.getText());
+ }
+ }
+
+ public void Display(String str) {
+ DefaultListModel lm = (DefaultListModel) list.getModel();
+ lm.addElement(str);
+ int nSize = lm.getSize();
+ list.setSelectedIndex(nSize - 1);
+ list.requestFocus();
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/JMTest_05.java b/test/jdk/performance/client/SwingMark/src/JMTest_05.java
new file mode 100644
index 00000000000..bd4eea45f9b
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/JMTest_05.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Date;
+import java.awt.BorderLayout;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import javax.swing.AbstractButton;
+import javax.swing.DefaultListModel;
+import javax.swing.JComponent;
+import javax.swing.JList;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
+/**
+ * This tests Swing Menus by posting key events to the EventQueue
+ * Each time a menu is selected ActionEvent/MenuEvent is generated
+ * and that event causes the menu text to be appended to a JList
+ */
+
+public class JMTest_05 extends AbstractSwingTest {
+ JList list;
+ JMenuBar jmenubar = null;
+
+ int nMenuCount = 2;
+ int nMenuItemCount = 4;
+ int ENTER = 10;
+ int LEFT = 37;
+ int RIGHT = 39;
+ int DOWN = 40;
+ int UP = 38;
+
+ /**
+ * This test cannot run as an applet because it
+ * posts events to the event queue
+ */
+ public boolean canRunInApplet() {
+ return false;
+ }
+
+ public JComponent getTestComponent() {
+ JPanel panel = new JPanel();
+
+ JMenu jmenu;
+ JMenuItem jmenuitem;
+ JMenu jsubmenu;
+
+ panel.setLayout(new BorderLayout());
+
+ jmenubar = new JMenuBar();
+
+ for (int i = 0; i < nMenuCount; i ++) {
+ jmenu = new JMenu("JMenu" + i);
+ jmenu.setMnemonic('0' + i);
+ jmenubar.add(jmenu);
+
+ for (int j = 0; j < nMenuItemCount; j ++) {
+ int mn = 'A';
+ mn = mn + j;
+ jsubmenu = new JMenu("SubMenu" + String.valueOf((char) mn));
+ jsubmenu.setMnemonic('A' + j);
+ jmenu.add(jsubmenu);
+ for (int k = 0; k <= j; k ++) {
+ jmenuitem = new JMenuItem("SubMenu - JMenuItem" + i + (char) mn + k);
+ jmenuitem.setMnemonic('0' + k);
+ jmenuitem.addActionListener(new MyActionListener());
+ jsubmenu.add(jmenuitem);
+ }
+ }
+ }
+ panel.add("North", jmenubar);
+ list = new JList(new DefaultListModel());
+ list.setFont(new Font("Serif", Font.BOLD, 14));
+ JScrollPane scrollPane = new JScrollPane(list);
+ panel.add("Center", scrollPane);
+
+ return panel;
+ }
+
+ public String getTestName() {
+ return "JMTest_05";
+ }
+
+ public void runTest() {
+ for (int i = 0; i < 10; i++) {
+ testMenu();
+ }
+ }
+
+ public void testMenu() {
+ FireEvents();
+ }
+
+ @SuppressWarnings("deprecation")
+ public void FireEvents() {
+ int nCount = jmenubar.getMenuCount();
+ int mnem;
+ JMenuItem menuitem;
+ KeyEvent key;
+ int firstMnem;
+ JMenu menu;
+
+ EventQueue queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
+ for (int i = 0; i < nCount; i++) {
+ menu = jmenubar.getMenu(i);
+ int nItemCount = menu.getItemCount();
+
+ for (int j = 0; j < nItemCount; j ++) {
+ JMenuItem mi = menu.getItem(j);
+
+ if (mi instanceof JMenu) {
+ JMenu targetmenu = (JMenu) mi;
+
+ int nC = targetmenu.getItemCount();
+ for (int k = 0; k < nC; k ++) {
+ firstMnem = menu.getMnemonic();
+ key = new KeyEvent(menu, KeyEvent.KEY_PRESSED,
+ new Date().getTime(), KeyEvent.ALT_DOWN_MASK, firstMnem);
+ queue.postEvent(key);
+ rest();
+
+ mnem = mi.getMnemonic();
+ key = new KeyEvent(menu, KeyEvent.KEY_PRESSED,
+ new Date().getTime(), 0, mnem);
+ queue.postEvent(key);
+ try {
+ Thread.sleep(10);
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+
+ JMenuItem menui = targetmenu.getItem(k);
+ mnem = menui.getMnemonic();
+ key = new KeyEvent(targetmenu, KeyEvent.KEY_PRESSED,
+ new Date().getTime(), 0, mnem);
+
+ queue.postEvent(key);
+ try {
+ Thread.sleep(10);
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ public static void main(String[] args) {
+ runStandAloneTest(new JMTest_05());
+ }
+
+ public class MyActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ AbstractButton comp = (AbstractButton) e.getSource();
+ Display(comp.getText());
+ }
+ }
+
+ public void Display(String str) {
+ DefaultListModel lm = (DefaultListModel) list.getModel();
+ lm.addElement(str);
+ int nSize = lm.getSize();
+ list.setSelectedIndex(nSize - 1);
+ list.requestFocus();
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/LabelTest.java b/test/jdk/performance/client/SwingMark/src/LabelTest.java
new file mode 100644
index 00000000000..870c45df6f7
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/LabelTest.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.GridLayout;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+
+/**
+ * This test is mean to isolate the speed of JLabel painting
+ * It creates a grid of JLabels (some with icons) and
+ * proceeds to change their color and repaint them.
+ */
+
+public class LabelTest extends AbstractSwingTest {
+
+ JLabel[] labels;
+ final int repeat = 255;
+ final int gridDimension = 6;
+ JPanel panel;
+
+ public JComponent getTestComponent() {
+ panel = new JPanel();
+ panel.setLayout(new GridLayout( gridDimension, gridDimension) );
+ labels = new JLabel[gridDimension*gridDimension];
+ for (int i = 0; i < labels.length; i++) {
+ labels[i] = new CounterLabel( "Label #" + i);
+ if (i % 2 == 0) {
+ labels[i].setOpaque(true);
+ } else {
+ labels[i].setOpaque(false);
+ }
+ panel.add(labels[i]);
+ }
+ labels[0].setIcon(UIManager.getIcon("Tree.openIcon"));
+ labels[5].setIcon(UIManager.getIcon("Tree.closedIcon"));
+ labels[10].setIcon(UIManager.getIcon("Tree.leafIcon"));
+ labels[15].setIcon(UIManager.getIcon("Tree.expandedIcon"));
+ labels[20].setIcon(UIManager.getIcon("Tree.collapsedIcon"));
+
+ return panel;
+ }
+
+ public String getTestName() {
+ return "Labels";
+ }
+
+ public void runTest() {
+ LabelChanger changer = new LabelChanger(labels);
+ for (int i = 0; i < repeat; i++) {
+ try {
+ changer.setColor( new Color( i,i,i) );
+ SwingUtilities.invokeLater(changer);
+ //panel.repaint();
+ rest();
+ } catch (Exception e) {System.out.println(e);}
+ }
+ }
+
+ public static void main(String[] args) {
+ runStandAloneTest(new LabelTest());
+ }
+
+
+ class CounterLabel extends JLabel {
+ CounterLabel(String s) {
+ super(s);
+ }
+ public void paint(Graphics g) {
+ paintCount++;
+ super.paint(g);
+ }
+ }
+}
+
+class LabelChanger implements Runnable {
+ JLabel[] labels;
+ Color color;
+
+
+ public LabelChanger(JLabel[] labelsToChange) {
+ labels = labelsToChange;
+ }
+
+ public void setColor(Color newColor) {
+ color = newColor;
+ }
+
+ public void run() {
+ for (int i = 0; i < labels.length; i++) {
+ labels[i].setForeground(color);
+ }
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/ListTest.java b/test/jdk/performance/client/SwingMark/src/ListTest.java
new file mode 100644
index 00000000000..bd9a262a1d9
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/ListTest.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.ResourceBundle;
+import java.awt.Graphics;
+import javax.swing.JComponent;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.SwingUtilities;
+
+/**
+ * This test is mean to isolate the speed of the JList.
+ * It creates a JList and adds many items to it. It then
+ * scrolls through the list.
+ */
+
+public class ListTest extends AbstractSwingTest {
+ JList list1;
+ final int list1ItemCount = 250;
+ String DISPLAY_STRING = "List Item ";
+
+ public JComponent getTestComponent() {
+ loadBundle();
+ JPanel panel = new JPanel();
+ String[] list1Data = new String[list1ItemCount];
+ for ( int i = 0; i < list1ItemCount; i++) {
+ list1Data[i] = DISPLAY_STRING+" " + i;
+ }
+ list1 = new CountList(list1Data);
+ JScrollPane scrollPane = new JScrollPane(list1);
+ if (SwingMark.useBlitScrolling) {
+ scrollPane.getViewport().putClientProperty("EnableWindowBlit", Boolean.TRUE);
+ }
+ panel.add(scrollPane);
+ return panel;
+ }
+
+ private void loadBundle() {
+ ResourceBundle bundle = ResourceBundle.getBundle("resources.ListTest");
+ DISPLAY_STRING = bundle.getString("DisplayString");
+ }
+
+ public String getTestName() {
+ return "Lists";
+ }
+
+ public void runTest() {
+ testList(list1, 1);
+ }
+
+ public void testList(JList currentList, int scrollBy) {
+ ListScroller scroll = new ListScroller(currentList, scrollBy);
+ for (int i = currentList.getSelectedIndex() ;
+ i < currentList.getModel().getSize();
+ i++) {
+ try {
+ SwingUtilities.invokeLater(scroll);
+ rest();
+ } catch (Exception e) {System.out.println(e);}
+ }
+ }
+
+ public static void main(String[] args) {
+ runStandAloneTest(new ListTest());
+ }
+
+ class CountList extends JList {
+ public CountList(String[] s) {
+ super(s);
+ }
+
+ public void paint(Graphics g) {
+ super.paint(g);
+ paintCount++;
+ }
+ }
+
+}
+
+
+class ListScroller implements Runnable {
+ JList list;
+ int scrollAmount = 1;
+
+
+ public ListScroller(JList listToScroll, int scrollBy) {
+ list = listToScroll;
+ scrollAmount = scrollBy;
+ }
+
+ public void run() {
+ int currentVal = list.getSelectedIndex();
+ list.setSelectedIndex(currentVal+scrollAmount);
+ list.ensureIndexIsVisible(currentVal+scrollAmount);
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/MenuTest.java b/test/jdk/performance/client/SwingMark/src/MenuTest.java
new file mode 100644
index 00000000000..9d9d8751d3e
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/MenuTest.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Date;
+import java.awt.BorderLayout;
+import java.awt.EventQueue;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import javax.swing.JComponent;
+import javax.swing.JList;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+
+/**
+ * This tests Swing Menus by posting key events to the EventQueue
+ * Each time a menu is selected and ActionEvent is generated
+ * and that event causes some text to be appended to a JTextArea
+ *
+ * note: this test has been replaced by JMTest_02
+ */
+
+public class MenuTest extends AbstractSwingTest {
+
+ JMenuBar menuBar;
+ JMenu menu1;
+ JMenu menu2;
+ JMenu menu3;
+ JMenu menu4;
+
+ JMenu subMenu;
+
+ JTextArea textArea;
+
+ ActionListener listener;
+
+ int repeat = 50;
+
+ /**
+ * This test cannot run as an applet because it
+ * posts events to the event queue
+ */
+ public boolean canRunInApplet() {
+ return false;
+ }
+
+ public JComponent getTestComponent() {
+ listener = new MyListener();
+
+ JPanel panel = new JPanel();
+ panel.setLayout( new BorderLayout() );
+ menuBar = new JMenuBar();
+ panel.add(menuBar, BorderLayout.NORTH);
+
+ menu1 = new JMenu("Menu1");
+ menu1.setMnemonic('M');
+ menuBar.add(menu1);
+ loadMenu(menu1, 5);
+
+ menu2 = new JMenu("Menu2");
+ menu2.setMnemonic('e');
+ menuBar.add(menu2);
+ loadMenu(menu2, 4);
+
+ menu3 = new JMenu("Menu3");
+ menu3.setMnemonic('n');
+ menuBar.add(menu3);
+ loadMenu(menu3, 6);
+
+ menu4 = new JMenu("Menu4");
+ menu4.setMnemonic('u');
+ menuBar.add(menu4);
+
+ textArea = new JTextArea(10,10);
+ textArea.setLineWrap(true);
+ JScrollPane scroll = new JScrollPane(textArea);
+ panel.add(scroll, BorderLayout.CENTER);
+ return panel;
+ }
+
+ private void loadMenu(JMenu menu, int numItems) {
+ for (int i = 0; i < numItems; i++) {
+ JMenuItem item = new JMenuItem("Item " + i, String.valueOf(i).toCharArray()[0]);
+ menu.add(item);
+ item.addActionListener(listener);
+ }
+ }
+
+ public String getTestName() {
+ return "Menus";
+ }
+
+ public void runTest() {
+ for (int i = 0; i < repeat; i++) {
+ testMenu(menu1);
+ testMenu(menu2);
+ testMenu(menu3);
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ public void testMenu(JMenu currentMenu) {
+ int c = currentMenu.getMnemonic();
+ EventQueue queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
+
+ for (int i = 0; i < currentMenu.getItemCount(); i++) {
+
+ KeyEvent key = new KeyEvent(currentMenu,
+ KeyEvent.KEY_PRESSED,
+ new Date().getTime(),
+ KeyEvent.ALT_DOWN_MASK,
+ c);
+ queue.postEvent(key);
+
+ rest();
+ key = new KeyEvent(currentMenu,
+ KeyEvent.KEY_PRESSED,
+ new Date().getTime(),
+ 0,
+ currentMenu.getItem(i).getMnemonic() );
+ queue.postEvent(key);
+
+ }
+ }
+
+ public static void main(String[] args) {
+ runStandAloneTest(new MenuTest());
+ }
+
+ class MyListener implements ActionListener {
+ public void actionPerformed(ActionEvent e) {
+ JMenuItem item = (JMenuItem)e.getSource();
+ textArea.append(item.getText() + " ");
+ }
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/NullRunnable.java b/test/jdk/performance/client/SwingMark/src/NullRunnable.java
new file mode 100644
index 00000000000..6d0f5605d39
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/NullRunnable.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** This is a simple class to be used as a "do nothing"
+ * it is part of the timing system.
+ *
+ * @see SwingMarkPanel#runTests
+ */
+
+class NullRunnable implements Runnable {
+ static NullRunnable singleton = new NullRunnable();
+ public void run() {
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/SliderTest.java b/test/jdk/performance/client/SwingMark/src/SliderTest.java
new file mode 100644
index 00000000000..260e164944a
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/SliderTest.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.awt.Graphics;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JSlider;
+import javax.swing.SwingUtilities;
+
+/**
+ * This test is mean to isolate the speed of JSlider painting
+ * It creates a JList and then changes its value while repainting.
+ *
+ */
+
+public class SliderTest extends AbstractSwingTest {
+
+ JSlider slider1;
+ int values = 500;
+
+ public SliderTest() {
+ }
+
+ public JComponent getTestComponent() {
+ JPanel panel = new JPanel();
+ slider1 = new CountSlider(JSlider.HORIZONTAL, 0, values, 0);
+ slider1.setMajorTickSpacing(values / 5);
+ slider1.setMinorTickSpacing(values / 10);
+ slider1.setPaintTicks(true);
+ slider1.setPaintLabels(true);
+ panel.add(slider1);
+ return panel;
+ }
+
+ public String getTestName() {
+ return "Sliders";
+ }
+
+ public void runTest() {
+ testSlider(slider1, 1); // increment this slider by ones
+ }
+
+ public void testSlider(JSlider currentSlider, int incrementBy) {
+ SliderInc inc = new SliderInc(currentSlider, incrementBy);
+ for (int i = currentSlider.getValue() ; i < currentSlider.getMaximum(); i++) {
+ try {
+ SwingUtilities.invokeLater(inc);
+ rest();
+ } catch (Exception e) {System.out.println(e);}
+ }
+ }
+
+ public static void main(String[] args) {
+ runStandAloneTest(new SliderTest());
+ }
+
+ class CountSlider extends JSlider {
+
+ public CountSlider(int ori, int min, int max, int curr) {
+ super(ori, min, max, curr);
+ }
+
+ public void paint(Graphics g) {
+ super.paint(g);
+ paintCount++;
+ }
+ }
+ }
+
+class SliderInc implements Runnable {
+ JSlider slider;
+ int incAmount = 1;
+
+ public SliderInc(JSlider sliderToIncrement, int incrementBy) {
+ slider = sliderToIncrement;
+ incAmount = incrementBy;
+ }
+
+ public void run() {
+ int currentVal = slider.getValue();
+ slider.setValue(currentVal+incAmount);
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/SwingMark.java b/test/jdk/performance/client/SwingMark/src/SwingMark.java
new file mode 100644
index 00000000000..845e4764756
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/SwingMark.java
@@ -0,0 +1,311 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.util.Date;
+import java.awt.Toolkit;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import javax.swing.JFrame;
+import javax.swing.RepaintManager;
+import javax.swing.UIManager;
+
+/**
+ * This class runs the SwingMark benchmarks as an application
+ * Simply invoke this class' main() to run the test suite.
+ * Optionally you can use the name of a subclass of LookAndFeel
+ * as an arguement to main(). This will use that L&F for the test.
+ */
+
+public class SwingMark {
+
+ static SwingMarkPanel mainPanel;
+ static Date startTime;
+ static Date startupCompleteTime;
+ static Date endTime;
+ static int numRepeats = 1;
+ static boolean autoQuit = false;
+ static boolean sleepBetweenRuns = false;
+ static boolean useBlitScrolling = false;
+
+ static long[][] timeReport;
+ static long[][] memoryReport;
+
+ static String reportFileName = null;
+ static String memoryReportFileName = null;
+
+
+ @SuppressWarnings("deprecation")
+ public static void initFrame(JFrame frame) {
+ mainPanel = new SwingMarkPanel();
+ prepReports();
+ frame.getContentPane().add(mainPanel);
+ frame.pack();
+ frame.show();
+ }
+
+ protected static void prepReports() {
+ if (timeReport == null) {
+ timeReport = new long[numRepeats][mainPanel.tests.length];
+ }
+ if (memoryReport == null) {
+ memoryReport = new long[numRepeats][2];
+ }
+ }
+
+ public static void main(String[] args) {
+
+ System.out.println("Starting SwingMark");
+ startTime = new Date();
+ System.out.println("SwingMark Test started at " + startTime);
+
+ parseArgs(args);
+
+ JFrame f = new JFrame("SwingMarks");
+ Thread.currentThread().setPriority(Thread.NORM_PRIORITY-1);
+ f.addWindowListener( new Closer() );
+
+ initFrame(f);
+ Date startupCompleteTime = new Date();
+ long elapsedTime = startupCompleteTime.getTime() - startTime.getTime();
+ System.out.println("Startup Time: "+elapsedTime);
+
+
+ //int repeat = 15;
+ for (int i = 0; i < numRepeats; i++) {
+ mainPanel.runTests(i);
+ if (i < numRepeats - 1) {
+ f.setVisible(false);
+ f.dispose();
+ AbstractSwingTest.rest();
+ f = new JFrame("SwingMarks " + (i+2));
+ initFrame(f);
+ f.addWindowListener( new Closer() );
+ System.out.println(" **** Starting run " + (i+2) + "****");
+ maybeSleep();
+ }
+ }
+
+ Date endTime = new Date();
+ elapsedTime = endTime.getTime() - startTime.getTime();
+ System.out.println("Score: "+elapsedTime);
+
+ writeReport();
+ writeMemoryReport();
+
+ if (autoQuit) {
+ System.exit(0);
+ }
+ }
+
+ static void maybeSleep() {
+ if (sleepBetweenRuns) {
+ for (int i = 0; i < 10; i++) {
+ Toolkit.getDefaultToolkit().beep();
+ try {
+ AbstractSwingTest.syncRam();
+ Thread.sleep(900);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ static class Closer extends WindowAdapter {
+ public void windowClosing(WindowEvent e) {
+ System.exit(0);
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ private static void parseArgs(String[] args) {
+ String lafName = UIManager.getCrossPlatformLookAndFeelClassName();
+ int lfOpts = 0;
+ int nOpts = 0;
+
+ for (int i = 0; i < args.length; i++) {
+
+ if (args[i].indexOf("-lf") == 0) {
+ lafName = args[i+1];//.substring(3);
+ lfOpts = 1;
+ i++;
+ } else if (args[i].indexOf("-n") == 0) {
+ // use native look and feel
+ lafName = UIManager.getSystemLookAndFeelClassName();
+ nOpts++;
+ } else if (args[i].indexOf("-r") == 0) {
+ String repeatString = args[i+1];//.substring(2);
+ numRepeats = Integer.parseInt(repeatString);
+ System.out.println("Will run test " + numRepeats + " times in the same VM");
+ i++;
+ } else if (args[i].equals("-q")) {
+ autoQuit = true;
+ System.out.println("Program will automatically terminate after last run");
+ } else if (args[i].equals("-f")) {
+ reportFileName = args[i+1];
+ if (reportFileName.indexOf("-mmdd") != -1) {
+ Date date = new Date();
+ int startpos = reportFileName.indexOf("-mmdd");
+ reportFileName =
+ reportFileName.substring(0,startpos)+(date.getMonth()+1)+"-"+
+ date.getDate()+reportFileName.substring(startpos+5);
+ }
+ i++;
+ System.out.println("Will write test report to file: "+ reportFileName);
+ } else if (args[i].equals("-m")) {
+ memoryReportFileName = args[i+1];
+ i++;
+ System.out.println("Will write memory report to file: "+ memoryReportFileName);
+ } else if (args[i].equals("-db=off")) {
+ RepaintManager.currentManager(null).setDoubleBufferingEnabled(false);
+ System.out.println("Will run without double buffering");
+ } else if (args[i].equals("-sleep")) {
+ sleepBetweenRuns = true;
+ System.out.println("Will sleep for 5 seconds between runs");
+ } else if (args[i].equals("-blit")) {
+ useBlitScrolling = true;
+ System.out.println("Will use fast window blitting");
+ } else if (args[i].equals("-version")) {
+ System.out.println("SwingMark build Oct 28, 2005");
+ } else {
+ System.out.println("Unexpected Argument: " + args[i]);
+ System.exit(1);
+ }
+ }
+ if (lfOpts + nOpts > 1) {
+ System.out.println("-lf and -n are mutually exclusive\n");
+ System.exit(1);
+ }
+ switchLookAndFeel(lafName);
+ }
+
+ private static void switchLookAndFeel(String lafName) {
+ try {
+ System.out.println("Setting L&F to: "+ lafName);
+ UIManager.setLookAndFeel(lafName);
+
+ } catch (Exception e) {
+ System.out.println(e);
+ System.exit(1);
+ }
+ }
+
+ protected static void writeReportHeader(PrintWriter writer) {
+ writer.println("");
+
+ writer.println("SwingMark");
+ writer.println();
+ writer.println("" + startTime + "");
+ writer.println("" + System.getProperty("java.version") + "");
+ writer.println("" + System.getProperty("java.vendor") + "");
+ writer.println("" + System.getProperty("java.home") + "");
+
+ String vmName = System.getProperty("java.vm.name");
+ String vmVersion = System.getProperty("java.vm.info");
+
+ String vmString = "Undefined";
+ if (vmName != null && vmVersion != null) {
+ vmString = vmName + " " + vmVersion;
+ }
+ writer.println("" + vmString + "");
+
+ writer.print("" + System.getProperty("os.name") );
+ writer.println(" version " + System.getProperty("os.version")+ "");
+
+ int bits = java.awt.Toolkit.getDefaultToolkit().getColorModel().getPixelSize();
+ writer.println("" + bits + "");
+
+ writer.println();
+ }
+
+ protected static void writeReportFooter(PrintWriter writer) {
+ writer.println("");
+ }
+
+ protected static void writeReport() {
+ if (reportFileName != null) {
+ try {
+ System.out.println("Writing report to file: "+ reportFileName);
+ FileWriter fileWriter = new FileWriter(reportFileName);
+ PrintWriter writer = new PrintWriter(fileWriter);
+
+ writeReportHeader(writer);
+
+ writer.println("");
+ for (int testNumber =0; testNumber < mainPanel.tests.length; testNumber++) {
+ writer.print(mainPanel.tests[testNumber].getTestName() + "\t");
+ for (int runNumber = 0; runNumber < numRepeats; runNumber++) {
+ writer.print(timeReport[runNumber][testNumber]);
+ if (runNumber < numRepeats -1) {
+ writer.print("\t");
+ }
+ }
+ writer.println();
+ }
+
+ writer.println("");
+
+ writer.println();
+ writeReportFooter(writer);
+
+ writer.close();
+ fileWriter.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ protected static void writeMemoryReport() {
+ if (memoryReportFileName != null) {
+ try {
+ System.out.println("Writing memory report to file: "+ memoryReportFileName);
+ FileWriter fileWriter = new FileWriter(memoryReportFileName);
+ PrintWriter writer = new PrintWriter(fileWriter);
+ writeReportHeader(writer);
+ writer.println("Used Memory\tHeapSize");
+ for (int runNumber = 0; runNumber < numRepeats; runNumber++) {
+ writer.print(memoryReport[runNumber][0]);
+ writer.print("\t");
+ writer.println(memoryReport[runNumber][1]);
+ }
+ writer.println();
+ writeReportFooter(writer);
+ writer.close();
+ fileWriter.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/SwingMarkPanel.java b/test/jdk/performance/client/SwingMark/src/SwingMarkPanel.java
new file mode 100644
index 00000000000..02b07e61aa8
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/SwingMarkPanel.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.util.Date;
+import java.util.Vector;
+import javax.swing.JTabbedPane;
+import javax.swing.SwingUtilities;
+
+/**
+ * This class is the center point for running the automated
+ * test suite.
+ * It creates a number of instances of AbstractSwingTest. It
+ * gets a component from each test and inserts it into a JTabbedPane.
+ * It then sequentially selects each tab and runs the coresponding test
+ */
+
+public class SwingMarkPanel extends JTabbedPane {
+
+ AbstractSwingTest[] tests;
+
+ public SwingMarkPanel() {
+ tests = getTests();
+ for (int i = 0; i < tests.length; i++) {
+ addTab(tests[i].getTestName(), tests[i].getTestComponent() );
+ }
+ setSelectedIndex(0);
+ }
+
+ /**
+ * add new tests to the suite by adding objects
+ * to the array returned by this function
+ */
+ @SuppressWarnings("deprecation")
+ public AbstractSwingTest[] getTests() {
+
+ Vector testVector = new Vector();
+ try {
+
+ String testList = "TestList.txt";
+
+ FileReader file = null;
+ LineNumberReader reader = null;
+
+ try {
+ file = new FileReader(testList);
+ reader = new LineNumberReader(file);
+ } catch (FileNotFoundException e) {
+ InputStream is = getClass().getResourceAsStream("/resources/" + testList);
+ reader = new LineNumberReader(new InputStreamReader(is));
+ }
+
+ String testName = reader.readLine();;
+
+ while (testName != null ) {
+
+ if (testName.indexOf("//") != 0) {
+
+ try {
+ Class testClass = Class.forName(testName);
+ AbstractSwingTest test = (AbstractSwingTest)testClass.newInstance();
+ testVector.addElement(test);
+ } catch (Exception e) {
+ System.out.println("Error instantiating test: " + testName);
+ System.out.println("Test must be subclass of AbstractSwingTest.");
+ e.printStackTrace();
+ }
+ testName = reader.readLine();
+ }
+ }
+ reader.close();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ AbstractSwingTest[] tests = new AbstractSwingTest[testVector.size()];
+ testVector.copyInto(tests);
+ return tests;
+ }
+
+ /**
+ * run each test and print the elapsed time
+ */
+ public void runTests(int runNumber) {
+ TabSelecter selecter = new TabSelecter();
+ for (int testNumber = 0; testNumber < tests.length; testNumber++) {
+ selecter.setSelection(testNumber);
+ try {
+ // select the next tab
+ SwingUtilities.invokeAndWait(selecter);
+ AbstractSwingTest.rest();
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ Date start = new Date(); // mark the start time
+ tests[testNumber].runTest();
+ try {
+ // wait for event queue to clear
+ SwingUtilities.invokeAndWait(NullRunnable.singleton);
+ AbstractSwingTest.syncRam();
+ AbstractSwingTest.rest();
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ Date end = new Date(); // mark the completion time
+ long elapsedTime = end.getTime() - start.getTime();
+
+ Runtime runtime = Runtime.getRuntime();
+ long heapSize = runtime.totalMemory();
+ long freeMemory = runtime.freeMemory();
+ long usedMemory = heapSize - freeMemory;
+ SwingMark.memoryReport[runNumber][0] = usedMemory;
+ SwingMark.memoryReport[runNumber][1] = heapSize;
+
+ SwingMark.timeReport[runNumber][testNumber] = elapsedTime;
+
+ System.out.println(tests[testNumber].getTestName() +
+ " = " + elapsedTime +
+ " (Paint = " + tests[testNumber].getPaintCount() + ")");
+ }
+ }
+
+ class TabSelecter implements Runnable {
+ int selection;
+
+ void setSelection(int tabToSelect) {
+ selection = tabToSelect;
+ }
+
+ public void run() {
+ SwingMarkPanel.this.setSelectedIndex(selection);
+ SwingMarkPanel.this.repaint();
+ }
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/TableColMoveTest.java b/test/jdk/performance/client/SwingMark/src/TableColMoveTest.java
new file mode 100644
index 00000000000..0e168f706a0
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/TableColMoveTest.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.awt.Rectangle;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableModel;
+import javax.swing.SwingUtilities;
+
+/**
+ * This test is mean to isolate the speed of the JTable.
+ * It creates a JTable and moves columns.
+ */
+
+public class TableColMoveTest extends AbstractSwingTest {
+ JTable table;
+
+ public JComponent getTestComponent() {
+ JPanel panel = new JPanel();
+ TableModel dataModel = new DefaultTableModel() {
+ public int getColumnCount(){ return 25; }
+ public int getRowCount() { return 20;}
+ public Object getValueAt(int row, int col) { return Integer.valueOf(col) ;}
+ };
+
+ table = new JTable(dataModel);
+ JScrollPane scrollPane = new JScrollPane(table);
+ panel.add(scrollPane);
+ return panel;
+ }
+
+ public String getTestName() {
+ return "Table Column Move Test";
+ }
+
+ public void runTest() {
+ testTable(table, 1);
+ }
+
+ public void testTable(JTable currentTable, int scrollBy) {
+
+ TableColMover colmover = new TableColMover(currentTable);
+ // Column Selection Test
+ currentTable.clearSelection();
+
+ for (int i = 0 ; i < currentTable.getColumnCount(); i++) {
+ try {
+ SwingUtilities.invokeAndWait(colmover);
+ } catch (Exception e) {System.out.println(e);}
+ }
+ }
+
+ public static void main(String[] args) {
+ runStandAloneTest(new TableColMoveTest());
+ }
+}
+
+
+class TableColMover implements Runnable {
+ JTable table;
+
+ public TableColMover(JTable table) {
+ this.table = table;
+ }
+
+ public void run() {
+ table.moveColumn(0, table.getColumnCount()-1 );
+ Rectangle cellBound = table.getCellRect(0, table.getColumnCount()-1, true);
+ table.scrollRectToVisible(cellBound);
+ table.repaint();
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/TableColTest.java b/test/jdk/performance/client/SwingMark/src/TableColTest.java
new file mode 100644
index 00000000000..0d2efae3a36
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/TableColTest.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.awt.Rectangle;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableModel;
+import javax.swing.SwingUtilities;
+
+/**
+ * This test is mean to isolate the speed of the JTable.
+ * It creates a JTable and performs the following scenarios :
+ * 1) Remove columns
+ * 2) Add columns
+ * 3) Select columns
+ * -Single Selection mode
+ * -Single Selection Interval
+ * -Multiple Selection Intervas
+ */
+
+public class TableColTest extends AbstractSwingTest {
+ JTable table;
+ TableModel dataModel;
+
+ public JComponent getTestComponent() {
+ JPanel panel = new JPanel();
+ dataModel = new DefaultTableModel() {
+ public int getColumnCount(){ return 30; }
+ public int getRowCount() { return 40;}
+ public Object getValueAt(int row, int col) { return Integer.valueOf(col) ;}
+ };
+
+ table = new JTable(dataModel);
+ table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+ JScrollPane scrollPane = new JScrollPane(table);
+ panel.add(scrollPane);
+ return panel;
+ }
+
+ public String getTestName() {
+ return "Table Column Test";
+ }
+
+ public void runTest() {
+ testTable(table, 1);
+ }
+
+ public void testTable(JTable currentTable, int scrollBy) {
+ currentTable.setColumnSelectionAllowed(true);
+
+ // remove column
+ System.out.println("1)Removing Columns");
+ TableColAdder colRemover = new TableColAdder(currentTable,false);
+ while(currentTable.getColumnCount() > 0 ) {
+ try {
+ SwingUtilities.invokeAndWait(colRemover);
+ } catch (Exception e) {System.out.println(e);}
+ }
+
+ // add row
+ System.out.println("2)Adding Columns");
+ TableColAdder colAdder = new TableColAdder(currentTable,true);
+ for ( int i = 0 ; i < dataModel.getColumnCount(); i++ ) {
+
+ try {
+ colAdder.setModelIndex(i);
+ SwingUtilities.invokeAndWait(colAdder);
+ } catch (Exception e) {System.out.println(e);}
+ }
+
+
+
+ // Selection Mode test
+ System.out.println("3)Selection Mode Test");
+ for ( int m = 0 ; m < 3 ; m ++ ) { // m represents selection mode
+ System.out.println(" --------- Selection Mode :" + m );
+
+ TableColScroller colScroll = new TableColScroller(currentTable, scrollBy, m);
+
+ // Column Selection Test
+ currentTable.clearSelection();
+
+ for (int i = 0 ;
+ i <= currentTable.getColumnCount();
+ i= currentTable.getSelectedColumn()) {
+ try {
+ SwingUtilities.invokeAndWait(colScroll);
+ } catch (Exception e) {System.out.println(e);}
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ runStandAloneTest(new TableColTest());
+ }
+
+}
+
+
+class TableColScroller implements Runnable {
+ JTable table;
+ int scrollAmount = 1;
+ int currentColSelection = 0;
+
+ public TableColScroller(JTable tableToScroll, int scrollBy, int selectionMode) {
+ table = tableToScroll;
+ scrollAmount = scrollBy;
+ table.setSelectionMode( selectionMode);
+ }
+
+ public void run() {
+
+ int endInterval = 0;
+
+ switch ( table.getSelectionModel().getSelectionMode() ) {
+
+ case ListSelectionModel.SINGLE_SELECTION:
+ endInterval = currentColSelection;
+ table.addColumnSelectionInterval(currentColSelection, endInterval);
+ currentColSelection ++;
+ break;
+
+ case ListSelectionModel.SINGLE_INTERVAL_SELECTION:
+ endInterval = ((currentColSelection + 2) >= table.getColumnCount()-1 ) ?
+ table.getColumnCount()-1 : currentColSelection+2 ;
+ table.addColumnSelectionInterval(currentColSelection, endInterval);
+ currentColSelection++;
+ break;
+
+ case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION:
+ endInterval = (currentColSelection >= table.getColumnCount()-1 ) ?
+ table.getColumnCount()-1 :currentColSelection+1;
+
+ table.addColumnSelectionInterval(currentColSelection, endInterval);
+ currentColSelection += 3;
+ break;
+
+ default:
+ break;
+ }
+
+ Rectangle cellBound = table.getCellRect(0, endInterval, true);
+ table.scrollRectToVisible(cellBound);
+ table.repaint();
+ }
+}
+
+class TableColAdder implements Runnable {
+ JTable table;
+ int currentRowSelection = 0;
+ int index = 0;
+ boolean add = true; // false for "remove"
+ int rowCount=40;
+
+
+ public TableColAdder(JTable table, boolean add) {
+ this.table = table;
+ this.add = add;
+ }
+
+ public void setModelIndex(int i) {
+ this.index = i ;
+ }
+
+ public void run() {
+ Rectangle cellBound;
+
+ if (add) {
+ table.addColumn( new TableColumn(index));
+ cellBound = table.getCellRect(0,table.getColumnCount()-1,true);
+ } else {
+ table.removeColumn( table.getColumn( table.getColumnName(0)));
+ cellBound = table.getCellRect(0,0,true);
+ }
+ table.scrollRectToVisible(cellBound);
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/TableRowTest.java b/test/jdk/performance/client/SwingMark/src/TableRowTest.java
new file mode 100644
index 00000000000..92a52c18d0b
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/TableRowTest.java
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.ResourceBundle;
+import java.util.Vector;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableModel;
+import javax.swing.SwingUtilities;
+
+/**
+ * This test is mean to isolate the speed of the JTable.
+ * It creates a JTable and performs the following scenarios :
+ * 1) Remove rows
+ * 2) Add rows
+ * 3) Select rows
+ * -Single Selection mode
+ * -Single Selection Interval
+ * -Multiple Selection Intervas
+ */
+
+public class TableRowTest extends AbstractSwingTest {
+
+ JTable table;
+ DefaultTableModel dataModel;
+ static boolean backingStoreEnabled = true;
+
+ final String[] names = {"First Name", "Last Name", "Favorite Color",
+ "Favorite Number", "Vegetarian"};
+
+ Object[][] data = {{}};
+
+ public JComponent getTestComponent() {
+ loadBundle();
+ JPanel panel = new JPanel();
+ dataModel = new DefaultTableModel(data, names);
+
+ table = new CountTable(dataModel);
+ JScrollPane scrollPane = new JScrollPane(table);
+
+ if (SwingMark.useBlitScrolling) {
+ scrollPane.getViewport().putClientProperty("EnableWindowBlit", Boolean.TRUE);
+ }
+
+ panel.add(scrollPane);
+ return panel;
+ }
+
+ private void loadBundle() {
+ ResourceBundle bundle = ResourceBundle.getBundle("resources.TableRowTest");
+ data = (Object[][])bundle.getObject("TableData");
+ }
+
+ public String getTestName() {
+ return "Table Rows";
+ }
+
+ public void runTest() {
+ testTable(table, 1);
+ }
+
+ public void testTable(JTable currentTable, int scrollBy) {
+ // remove row
+ TableRowAdder rowRemover = new TableRowAdder(currentTable, data, false);
+ while (dataModel.getRowCount() > 0 ) {
+ try {
+ SwingUtilities.invokeLater(rowRemover);
+ rest();
+ }
+ catch (Exception e) {e.printStackTrace();}
+ }
+
+ // add row
+ TableRowAdder rowAdder = new TableRowAdder(currentTable, data, true);
+ while (dataModel.getRowCount() < data.length ) {
+ try {
+ SwingUtilities.invokeAndWait(rowAdder);
+ }
+ catch (Exception e) {e.printStackTrace();}
+ }
+
+
+
+ // Selection Test
+ for ( int m = 0 ; m < 3 ; m ++ ) { // m represents selection mode
+ // System.out.println(" --------- Selection Mode :" + m );
+
+ TableScroller scroll = new TableScroller(currentTable, scrollBy, m);
+
+ currentTable.clearSelection();
+ for (int i = 0 ; i < currentTable.getRowCount()-1; i++ ) {
+ try {
+ SwingUtilities.invokeAndWait(scroll);
+ }
+ catch (Exception e) {e.printStackTrace();}
+ }
+ }
+
+ }
+
+ public static void main(String[] args) {
+ if (args.length > 0) {
+ if (args[0].equals("-bs=off")) {
+ backingStoreEnabled = false;
+ System.out.println("BackingStore is off");
+ }
+ }
+ runStandAloneTest(new TableRowTest());
+ }
+
+ class CountTable extends JTable {
+ public CountTable(TableModel tm) {
+ super(tm);
+ }
+ public void paint(Graphics g) {
+ super.paint(g);
+ paintCount++;
+ }
+ }
+
+}
+
+
+class TableScroller implements Runnable {
+ JTable table;
+ int scrollAmount = 1;
+ int currentRowSelection = 0;
+
+
+ public TableScroller(JTable tableToScroll, int scrollBy, int selectionMode) {
+ table = tableToScroll;
+ scrollAmount = scrollBy;
+ table.setSelectionMode( selectionMode);
+ }
+
+ public void run() {
+ int ensureToSeeRow = 0;
+
+ switch ( table.getSelectionModel().getSelectionMode() ) {
+ case ListSelectionModel.SINGLE_SELECTION:
+ table.addRowSelectionInterval(currentRowSelection, currentRowSelection);
+ currentRowSelection++;
+ ensureToSeeRow = currentRowSelection;
+ break;
+ case ListSelectionModel.SINGLE_INTERVAL_SELECTION:
+ currentRowSelection = Math.min(currentRowSelection, table.getRowCount()-1);
+ int maxRow = table.getRowCount()-1;
+ table.addRowSelectionInterval(currentRowSelection,
+ Math.min(currentRowSelection+5, maxRow));
+ currentRowSelection++;
+ ensureToSeeRow = table.getSelectionModel().getAnchorSelectionIndex() + 4;
+ break;
+ case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION:
+ table.addRowSelectionInterval(Math.min(currentRowSelection, table.getRowCount()-1),
+ Math.min(currentRowSelection+3, table.getRowCount()-1));
+ currentRowSelection = currentRowSelection + 5;
+ ensureToSeeRow = table.getSelectionModel().getAnchorSelectionIndex() + 3;
+ break;
+ default:
+ break;
+ }
+
+ Rectangle cellBound = table.getCellRect(ensureToSeeRow, 0, true);
+ table.scrollRectToVisible(cellBound);
+ }
+}
+
+class TableRowAdder implements Runnable {
+ JTable table;
+ int currentRowSelection = 0;
+ Vector dataVector;
+ int index = 0;
+ Object [][] data;
+ boolean add = true; // false for "remove"
+
+
+ public TableRowAdder(JTable table, Object[][] data, boolean add) {
+ this.table = table;
+ this.data = data;
+ this.add = add;
+ }
+
+ public void run() {
+ DefaultTableModel model = (DefaultTableModel)table.getModel();
+ Rectangle cellBound;
+
+ if ( add ) {
+ model.addRow(data[index]);
+ index++;
+ cellBound = table.getCellRect(table.getRowCount()-1, 0, true);
+ }
+ else {
+ model.removeRow(0 );
+ cellBound = table.getCellRect(0,0,true);
+ }
+
+ table.scrollRectToVisible(cellBound);
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/TableScrollTest.java b/test/jdk/performance/client/SwingMark/src/TableScrollTest.java
new file mode 100644
index 00000000000..453fb7ecfb2
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/TableScrollTest.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import javax.swing.JComponent;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JViewport;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableModel;
+import javax.swing.SwingUtilities;
+
+public class TableScrollTest extends AbstractSwingTest {
+
+ static JTable table;
+ TableScroller tableScroller;
+ JScrollPane scroller;
+ static boolean backingStoreEnabled = true;
+ static int rendererCount = 0;
+
+ public JComponent getTestComponent() {
+
+ TableModel model = new AbstractTableModel() {
+ String[] data = { "1", "2", "3", "4", "5", "6",
+ "8", "9", "10", "11" };
+
+ public int getColumnCount() { return 10;}
+ public int getRowCount() { return 1000;}
+ public Object getValueAt(int row, int col) {
+ return data[(row*col)%data.length];
+ }
+ };
+
+ table = new CountTable(model);
+ scroller = new JScrollPane(table);
+ tableScroller = new TableScroller(table, 1);
+
+ return scroller;
+ }
+
+ public String getTestName() {
+ return "Table Scroll";
+ }
+
+ public void runTest() {
+ for (int i = 0; i < 200; i++) {
+ try {
+ SwingUtilities.invokeLater( tableScroller );
+ rest();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ public static void main(String[] args) {
+ if (args.length > 0) {
+ if (args[0].equals("-bs=off")) {
+ backingStoreEnabled = false;
+ System.out.println("BackingStore is off");
+ }
+ }
+
+ runStandAloneTest(new TableScrollTest());
+ System.out.println("Renderer painted :" + rendererCount);
+ System.out.println( "Backing store is:" + ((JViewport)table.getParent()).isBackingStoreEnabled() );
+ }
+
+ class TableScroller implements Runnable {
+
+ JTable table;
+ int scrollAmount = 1;
+ int currentVis = 10;
+
+ public TableScroller(JTable tableToScroll, int scrollBy) {
+ table = tableToScroll;
+ scrollAmount = scrollBy;
+ }
+
+ public void run() {
+ int ensureToSeeRow = currentVis += scrollAmount;
+ Rectangle cellBound = table.getCellRect(ensureToSeeRow, 0, true);
+ table.scrollRectToVisible(cellBound);
+ }
+ }
+
+ static class CountRenderer extends DefaultTableCellRenderer {
+
+ public void paint(Graphics g) {
+ super.paint(g);
+ TableScrollTest.rendererCount++;
+ }
+ }
+
+ class CountTable extends JTable {
+ TableCellRenderer rend = new CountRenderer();
+
+ public CountTable(TableModel tm) {
+ super(tm);
+ }
+
+ public void paint(Graphics g) {
+ super.paint(g);
+ paintCount++;
+ }
+
+ public TableCellRenderer getCellRenderer(int row, int column) {
+ return rend;
+ }
+
+ @SuppressWarnings("deprecation")
+ public void addNotify() {
+ super.addNotify();
+ ((JViewport)getParent()).setBackingStoreEnabled(backingStoreEnabled);
+ }
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/TextAreaTest.java b/test/jdk/performance/client/SwingMark/src/TextAreaTest.java
new file mode 100644
index 00000000000..63c0d94abe9
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/TextAreaTest.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Date;
+import java.util.ResourceBundle;
+import java.awt.EventQueue;
+import java.awt.Graphics;
+import java.awt.event.KeyEvent;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+/**
+ * This test is mean to isolate the speed of the JTextArea
+ * It creates a JTextArea and then continuously appends text
+ * to that string.
+ */
+
+public class TextAreaTest extends AbstractSwingTest {
+
+ JTextArea textArea1;
+ final int repeat = 300;
+ final int breakIncrement = 12;
+
+ String DISPLAY_STRING = "Swing is Fast! ";
+
+ public JComponent getTestComponent() {
+ loadBundle();
+ JPanel panel = new JPanel();
+ textArea1 = new CountTextArea(10, 30);
+ textArea1.setLineWrap(true);
+ JScrollPane scroller = new JScrollPane(textArea1);
+
+ if (SwingMark.useBlitScrolling) {
+ scroller.getViewport().putClientProperty("EnableWindowBlit", Boolean.TRUE);
+ }
+
+ panel.add(scroller);
+ return panel;
+ }
+
+ public String getTestName() {
+ return "TextArea";
+ }
+
+ public void runTest() {
+ testTextArea(textArea1, DISPLAY_STRING);
+ }
+
+ private void loadBundle() {
+ ResourceBundle bundle = ResourceBundle.getBundle("resources.TextAreaTest");
+ DISPLAY_STRING = bundle.getString("DisplayString");
+ }
+
+
+ public void testTextArea(JTextArea currentTextArea, String appendThis) {
+
+ TextAppender appender = new TextAppender(currentTextArea, appendThis);
+ for (int i = 0; i < repeat; i++) {
+ appender.appendString = appendThis;
+ if ( i % breakIncrement == breakIncrement -1) {
+ appender.appendString = appendThis + "\n";
+ }
+ try {
+ SwingUtilities.invokeLater(appender);
+ rest();
+ } catch (Exception e) {System.out.println(e);}
+ }
+ }
+
+ public static void main(String[] args) {
+ runStandAloneTest(new TextAreaTest());
+ }
+
+ class CountTextArea extends JTextArea {
+
+ public CountTextArea(int h, int w) {
+ super(h, w);
+ }
+
+ public void paint(Graphics g) {
+ super.paint(g);
+ paintCount++;
+ }
+ }
+}
+
+class TextAppender implements Runnable {
+
+ JTextArea area;
+ String appendString;
+
+ public TextAppender(JTextArea textArea, String appendThis) {
+ area = textArea;
+ appendString = appendThis;
+ }
+
+ public void run() {
+ area.append(appendString);
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/TextPaneTest.java b/test/jdk/performance/client/SwingMark/src/TextPaneTest.java
new file mode 100644
index 00000000000..dbd6eeb5abb
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/TextPaneTest.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextPane;
+import javax.swing.SwingUtilities;
+import javax.swing.text.Document;
+
+/**
+ * This test is mean to isolate the speed of the JTextArea
+ * It creates a JTextArea and then continuously appends text
+ * to that string.
+ *
+ */
+
+public class TextPaneTest extends AbstractSwingTest {
+
+ JTextPane textArea1;
+ final int repeat = 250;
+
+ public JComponent getTestComponent() {
+ JPanel panel = new JPanel();
+ panel.setPreferredSize(new Dimension(200,200));
+ panel.setLayout(new BorderLayout());
+ textArea1 = new CountTextArea(10, 30);
+ JScrollPane scroller = new JScrollPane(textArea1);
+ panel.add(scroller, BorderLayout.CENTER);
+ return panel;
+ }
+
+ public String getTestName() {
+ return "TextPane";
+ }
+
+ public void runTest() {
+ testTextArea(textArea1, "Swing is Fast! ");
+ }
+
+ public void testTextArea(JTextPane currentTextArea, String appendThis) {
+ TextAppender appender = new TextAppender(currentTextArea, appendThis);
+ for (int i = 0; i < repeat; i++) {
+ try {
+ SwingUtilities.invokeLater(appender);
+ rest();
+ } catch (Exception e) {System.out.println(e);}
+ }
+ }
+
+ public static void main(String[] args) {
+ runStandAloneTest(new TextPaneTest());
+ }
+
+ class CountTextArea extends JTextPane {
+ public CountTextArea(int h, int w) {
+ super();
+ }
+
+ public void paint(Graphics g) {
+ super.paint(g);
+ paintCount++;
+ }
+ }
+
+ static class TextAppender implements Runnable {
+ JTextPane area;
+ String appendString;
+
+ public TextAppender(JTextPane textArea, String appendThis) {
+ area = textArea;
+ appendString = appendThis;
+ }
+
+ public void run() {
+ try {
+ Document doc = area.getDocument();
+ doc.insertString(doc.getLength(), appendString, null);
+ } catch (Exception e) {
+ }
+ }
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/TreeTest.java b/test/jdk/performance/client/SwingMark/src/TreeTest.java
new file mode 100644
index 00000000000..175a01ce733
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/TreeTest.java
@@ -0,0 +1,388 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Enumeration;
+import java.util.Vector;
+import java.awt.BorderLayout;
+import java.awt.Graphics;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTree;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.DefaultTreeSelectionModel;
+import javax.swing.tree.TreeSelectionModel;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
+import javax.swing.SwingUtilities;
+
+/**
+ * This test is mean to isolate the speed of the JTree.
+ * It creates a JTree and performs the following scenarios :
+ * 1) Recursively adding node to the tree
+ * 2) Recursively expand all nodes
+ * 3) Selection Test
+ * -SINGLE_TREE_SELECTION mode
+ * -CONTIGUOUS_TREE_SELECTION mode
+ * -DISCONTIGUOUS_TREE_SELECTION mode
+ * 4) Collapse all nodes
+ * 5) Recursively Remove all the nodes
+ */
+
+public class TreeTest extends AbstractSwingTest {
+ JTree tree;
+ int totalChildCount = 0;
+ int targetChildCount = 200;
+ int interval = 5;
+ boolean useLargeModel = false;
+ boolean debug = false;
+
+ public JComponent getTestComponent() {
+ JPanel panel = new JPanel();
+ panel.setLayout(new BorderLayout());
+
+ DefaultMutableTreeNode top =
+ new DefaultMutableTreeNode(Integer.valueOf(0));
+ totalChildCount ++;
+
+ DefaultTreeModel model = new DefaultTreeModel(top);
+
+ tree = new CountTree(model);
+ tree.setLargeModel(useLargeModel);
+ if (useLargeModel) {
+ tree.setRowHeight(18);
+ }
+ JScrollPane scroller = new JScrollPane(tree);
+
+ if (SwingMark.useBlitScrolling) {
+ scroller.getViewport().putClientProperty("EnableWindowBlit", Boolean.TRUE);
+ }
+
+ panel.add(scroller, BorderLayout.CENTER);
+
+ return panel;
+ }
+
+ public String getTestName() {
+ return "Tree";
+ }
+
+ public void runTest() {
+ testTree();
+ }
+
+ public void testTree() {
+ // Recursively add Nodes to the tree
+ if (debug) {
+ System.out.println("(1)Adding nodes...");
+ }
+
+ TreeNodeAdder adder =
+ new TreeNodeAdder( (DefaultTreeModel)tree.getModel(), true );
+ Vector nodeList = new Vector();
+ nodeList.addElement(tree.getModel().getRoot());
+
+ addChild(nodeList, adder);
+
+ // Recursively Expend all nodes
+ if (debug) {
+ System.out.println("(2)Recursively Expending all nodes...");
+ }
+
+ TreeExpender expender = new TreeExpender(tree, true);
+ TreePath path = tree.getPathForRow(0);
+ DefaultMutableTreeNode root =
+ (DefaultMutableTreeNode)path.getLastPathComponent();
+ expandNodes(root, expender);
+
+ // Selection Test
+
+ // 1) SINGLE_TREE_SELECTION
+ if (debug) {
+ System.out.println("(3)Selection Test .....");
+ System.out.println(" -SINGLE_TREE_SELECTION .....");
+
+ }
+ TreeSelector selector =
+ new TreeSelector(tree,TreeSelectionModel.SINGLE_TREE_SELECTION);
+ int [] rows = new int[1];
+
+ for (int i=0; i < tree.getRowCount() ; i ++ ) {
+ rows[0] = i;
+ selector.addSelectionRows(rows);
+ try {
+ SwingUtilities.invokeLater(selector);
+ rest();
+ } catch (Exception e) {System.out.println(e);}
+ }
+
+
+ // 2) CONTIGUOUS_TREE_SELECTION
+ if (debug) {
+ System.out.println(" -CONTIGUOUS_TREE_SELECTION .....");
+ }
+
+ selector =
+ new TreeSelector(tree,TreeSelectionModel.CONTIGUOUS_TREE_SELECTION);
+ rows = new int[3];
+ int count = tree.getRowCount()/4 ;
+
+ for (int i=0; i < count ;i ++) {
+ rows[0]=i*4; rows[1] = rows[0]+1; rows[2] = rows[0]+2;
+ selector.addSelectionRows(rows);
+ try {
+ SwingUtilities.invokeAndWait(selector);
+ } catch (Exception e) {System.out.println(e);}
+ }
+
+ // 3) CONTIGUOUS_TREE_SELECTION
+ if (debug) {
+ System.out.println(" -DISCONTIGUOUS_TREE_SELECTION .....");
+ }
+ new TreeSelector(tree,TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
+ count = tree.getRowCount()/5 ;
+
+ for (int i=0; i < count ; i ++) {
+ rows[0]=i*5; rows[1] = rows[0]+1; rows[2] = rows[0]+2;
+ selector.addSelectionRows(rows);
+ try {
+ SwingUtilities.invokeAndWait(selector);
+ } catch (Exception e) {System.out.println(e);}
+ }
+
+ //
+ // Collapse all the nodes
+ //
+ if (debug) {
+ System.out.println("(4)Collapsing all nodes .....");
+
+ }
+ TreeExpender collapser = new TreeExpender(tree, false);
+ TreePath[] paths = new TreePath[ tree.getRowCount()];
+
+ for ( int rowcount = 0 ; rowcount < tree.getRowCount() ; rowcount ++ ) {
+ paths[rowcount] = tree.getPathForRow(rowcount );
+ }
+
+ for ( int i = paths.length - 1 ; i >=0 ; i-- ) {
+ try {
+ collapser.setPath(paths[i]);
+ SwingUtilities.invokeAndWait(collapser);
+ } catch (Exception e) {System.out.println(e);}
+ }
+
+ // Recursively remove Nodes from the tree
+ //
+ if (debug) {
+ System.out.println("(5)Removing nodes...");
+ }
+
+ TreeNodeAdder remover =
+ new TreeNodeAdder( (DefaultTreeModel)tree.getModel(), false);
+
+ removeNodes((DefaultMutableTreeNode)tree.getModel().getRoot(),remover);
+ tree.repaint();
+ }
+
+
+ public void addChild(Vector nodeList, TreeNodeAdder adder){
+ DefaultMutableTreeNode node;
+ Vector newVec = new Vector();
+
+ for ( int i=0; i < nodeList.size() ; i++ ) {
+
+ node = (DefaultMutableTreeNode)nodeList.elementAt(i);
+
+ while ( node.getChildCount() < interval ) {
+ if ( totalChildCount >= targetChildCount ) return;
+
+ adder.setNode(node, totalChildCount);
+ try {
+ SwingUtilities.invokeAndWait(adder);
+ totalChildCount ++;
+ } catch (Exception e) {System.out.println(e);}
+
+ newVec.addElement(node.getChildAt(node.getChildCount()-1));
+ }
+ }
+ addChild(newVec, adder);
+ }
+
+ public void expandNodes(DefaultMutableTreeNode node, TreeExpender expender){
+ try {
+ expender.setPath(new TreePath ( node.getPath()));
+ SwingUtilities.invokeAndWait(expender);
+ } catch (Exception e) {System.out.println(e);}
+
+ for (Enumeration e = node.children() ; e.hasMoreElements() ;) {
+ DefaultMutableTreeNode childNode =
+ (DefaultMutableTreeNode)e.nextElement();
+ expandNodes(childNode, expender);
+ }
+ }
+
+ public void removeNodes(DefaultMutableTreeNode node, TreeNodeAdder remover){
+ Vector nodeList = new Vector();
+ for (Enumeration e = node.depthFirstEnumeration() ; e.hasMoreElements() ;) {
+ nodeList.addElement(e.nextElement());
+ }
+
+ for ( int i=0; i < nodeList.size(); i ++ ) {
+ DefaultMutableTreeNode nodeToRemove =
+ (DefaultMutableTreeNode)nodeList.elementAt(i);
+
+ try {
+ remover.setNode(nodeToRemove, -1);
+ SwingUtilities.invokeAndWait(remover);
+ } catch (Exception exp) {System.out.println(exp);
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ TreeTest test = new TreeTest();
+ test.debug = true;
+ if (args.length > 0) {
+ test.targetChildCount = Integer.parseInt(args[0]);
+ System.out.println("Setting nodes to: " + test.targetChildCount);
+ }
+ if (args.length > 1) {
+ if (args[1].equals("-l")) {
+ System.out.println("Large Model On");
+ test.useLargeModel = true;
+ }
+ }
+ runStandAloneTest(test);
+ }
+
+ class CountTree extends JTree {
+ public CountTree(TreeModel tm) {
+ super(tm);
+ }
+ public void paint(Graphics g) {
+ super.paint(g);
+ paintCount++;
+ }
+ }
+}
+
+class TreeNodeAdder implements Runnable {
+ DefaultTreeModel treeModel;
+ DefaultMutableTreeNode currentNode;
+ int totalChildCount = 0;
+ boolean add = true;
+
+ public TreeNodeAdder(DefaultTreeModel treeModel, boolean add ) {
+ this.treeModel = treeModel;
+ this.add = add;
+ }
+
+ public void setNode(DefaultMutableTreeNode node, int totalCount){
+ currentNode = node;
+ totalChildCount = totalCount;
+ }
+
+ public void run() {
+ if ( add ) {
+ // add a new node to the currentNode's child list
+ DefaultMutableTreeNode newNode =
+ new DefaultMutableTreeNode(Integer.valueOf(totalChildCount));
+ treeModel.insertNodeInto(newNode, currentNode, currentNode.getChildCount());
+ } else {
+ // remove the current Node from its parent
+ if ( currentNode.getParent() != null ) {
+ treeModel.removeNodeFromParent(currentNode);
+ }
+ }
+ }
+}
+
+class TreeExpender implements Runnable {
+ JTree tree;
+ boolean expand = true;
+ TreePath currentPath;
+
+ public TreeExpender(JTree tree, boolean expand ) {
+ this.tree = tree;
+ this.expand = expand;
+ }
+
+ public void setPath(TreePath path){
+ currentPath = path;
+ }
+
+ public void run() {
+ if ( expand ) {
+ // Expand the current Path
+ if ( tree.isExpanded(currentPath)) tree.expandPath(currentPath);
+ tree.scrollPathToVisible(currentPath);
+ } else {
+ // Collapse the node
+ if ( !tree.isCollapsed(currentPath) ) {
+ tree.scrollPathToVisible(currentPath);
+ tree.collapsePath(currentPath);
+ }
+ }
+ }
+}
+
+class TreeSelector implements Runnable {
+ JTree tree;
+ DefaultMutableTreeNode currentNode ;
+ TreePath currentPath;
+ int selectionMode = 0;
+ int [] rows;
+
+ public TreeSelector(JTree tree, int mode ) {
+ this.tree = tree;
+
+ selectionMode = mode;
+ DefaultTreeSelectionModel selectionModel = new DefaultTreeSelectionModel();
+ selectionModel.setSelectionMode(mode);
+ tree.setSelectionModel( selectionModel );
+ int [] rows;
+ }
+
+ public void addSelectionRows( int[] rows ){
+ this.rows = rows;
+ }
+
+ public void setNode(TreePath path ) {
+ currentPath = path;
+ currentNode = (DefaultMutableTreeNode)path.getLastPathComponent();
+ }
+
+ public void run() {
+ tree.addSelectionRows(rows);
+ tree.scrollRowToVisible( rows[ rows.length -1 ]);
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/TypingTest.java b/test/jdk/performance/client/SwingMark/src/TypingTest.java
new file mode 100644
index 00000000000..0019f7bd2c4
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/TypingTest.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Date;
+import java.awt.EventQueue;
+import java.awt.Toolkit;
+import java.awt.event.KeyEvent;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+
+public class TypingTest extends AbstractSwingTest {
+
+ JTextArea textArea1;
+ final int repeat = 100;
+
+ public JComponent getTestComponent() {
+ JPanel panel = new JPanel();
+ textArea1 = new JTextArea(10, 30);
+ textArea1.setLineWrap(true);
+ JScrollPane scroller = new JScrollPane(textArea1);
+ panel.add(scroller);
+ return panel;
+ }
+
+ public boolean canRunInApplet() {
+ return false;
+ }
+
+ public String getTestName() {
+ return "Typing";
+ }
+
+ public void runTest() {
+ testTyping(textArea1, "Write once, run anywhere! ");
+ }
+
+ public void testTyping(JTextArea currentTextArea, String stuff) {
+ EventQueue queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
+
+ int n = stuff.length();
+ for (int i = 0; i < repeat; i++)
+ for (int j = 0; j < n; j++) {
+ char c = stuff.charAt(j);
+ KeyEvent key = new KeyEvent(currentTextArea,
+ KeyEvent.KEY_TYPED, new Date().getTime(),
+ 0, KeyEvent.VK_UNDEFINED, c);
+ queue.postEvent(key);
+ rest();
+ }
+ }
+
+ public static void main(String[] args) {
+ runStandAloneTest(new TypingTest());
+ }
+}
diff --git a/test/jdk/performance/client/SwingMark/src/resources/JMTest_04.properties b/test/jdk/performance/client/SwingMark/src/resources/JMTest_04.properties
new file mode 100644
index 00000000000..a5674cde149
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/resources/JMTest_04.properties
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# - Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# - Neither the name of Oracle nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Resource bundle for Menu Test
+MenuString=JMenu
+SubMenuString=SubMenu
+MenuItemString=JMenuItem
diff --git a/test/jdk/performance/client/SwingMark/src/resources/JMTest_04_ja.properties b/test/jdk/performance/client/SwingMark/src/resources/JMTest_04_ja.properties
new file mode 100644
index 00000000000..b3d79c809c3
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/resources/JMTest_04_ja.properties
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# - Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# - Neither the name of Oracle nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Resource bundle for Menu Test
+MenuString=\uff2a\uff2d\uff45\uff4e\uff55
+SubMenuString=\uff33\uff55\uff42\uff2d\uff45\uff4e\uff55
+MenuItemString=\uff2a\uff2d\uff45\uff4e\uff55\uff29\uff54\uff45\uff4d
diff --git a/test/jdk/performance/client/SwingMark/src/resources/ListTest.properties b/test/jdk/performance/client/SwingMark/src/resources/ListTest.properties
new file mode 100644
index 00000000000..b731243643d
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/resources/ListTest.properties
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# - Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# - Neither the name of Oracle nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Resource bundle for List Test
+DisplayString=ListItem
diff --git a/test/jdk/performance/client/SwingMark/src/resources/ListTest_ja.properties b/test/jdk/performance/client/SwingMark/src/resources/ListTest_ja.properties
new file mode 100644
index 00000000000..9e70ac633a1
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/resources/ListTest_ja.properties
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# - Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# - Neither the name of Oracle nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Resource bundle for List Test
+DisplayString=\uff2c\uff49\uff53\uff54\uff29\uff54\uff45\uff4d
diff --git a/test/jdk/performance/client/SwingMark/src/resources/TableRowTest.java b/test/jdk/performance/client/SwingMark/src/resources/TableRowTest.java
new file mode 100644
index 00000000000..0fbbf676030
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/resources/TableRowTest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package resources;
+
+import java.util.ListResourceBundle;
+
+
+ public class TableRowTest extends ListResourceBundle {
+ public Object[][] getContents() {
+ return contents;
+ }
+
+ // LOCALIZE THIS
+ // note: probably don't need to localize integers and booleans
+ static Object[][] data = {
+ {"Mark", "Andrews", "Red", Integer.valueOf(2), Boolean.valueOf(true)},
+ {"Tom", "Ball", "Blue", Integer.valueOf(99), Boolean.valueOf(false)},
+ {"Alan", "Chung", "Green", Integer.valueOf(838), Boolean.valueOf(false)},
+ {"Jeff", "Dinkins", "Turquois", Integer.valueOf(8), Boolean.valueOf(true)},
+ {"Amy", "Fowler", "Yellow", Integer.valueOf(3), Boolean.valueOf(false)},
+ {"Brian", "Gerhold", "Green", Integer.valueOf(0), Boolean.valueOf(false)},
+ {"James", "Gosling", "Pink", Integer.valueOf(21), Boolean.valueOf(false)},
+ {"David", "Karlton", "Red", Integer.valueOf(1), Boolean.valueOf(false)},
+ {"Dave", "Kloba", "Yellow", Integer.valueOf(14), Boolean.valueOf(false)},
+ {"Peter", "Korn", "Purple", Integer.valueOf(12), Boolean.valueOf(false)},
+ {"Phil", "Milne", "Purple", Integer.valueOf(3), Boolean.valueOf(false)},
+ {"Dave", "Moore", "Green", Integer.valueOf(88), Boolean.valueOf(false)},
+ {"Hans", "Muller", "Maroon", Integer.valueOf(5), Boolean.valueOf(false)},
+ {"Rick", "Levenson", "Blue", Integer.valueOf(2), Boolean.valueOf(false)},
+ {"Tim", "Prinzing", "Blue", Integer.valueOf(22), Boolean.valueOf(false)},
+ {"Chester", "Rose", "Black", Integer.valueOf(0), Boolean.valueOf(false)},
+ {"Ray", "Ryan", "Gray", Integer.valueOf(77), Boolean.valueOf(false)},
+ {"Georges", "Saab", "Red", Integer.valueOf(4), Boolean.valueOf(false)},
+ {"Willie", "Walker", "Phthalo Blue", Integer.valueOf(4), Boolean.valueOf(false)},
+ {"Kathy", "Walrath", "Blue", Integer.valueOf(8), Boolean.valueOf(false)},
+ {"Arnaud", "Weber", "Green", Integer.valueOf(44), Boolean.valueOf(false)},
+ {"Mark", "Andrews", "Red", Integer.valueOf(2), Boolean.valueOf(true)},
+ {"Tom", "Ball", "Blue", Integer.valueOf(99), Boolean.valueOf(false)},
+ {"Alan", "Chung", "Green", Integer.valueOf(838), Boolean.valueOf(false)},
+ {"Jeff", "Dinkins", "Turquois", Integer.valueOf(8), Boolean.valueOf(true)},
+ {"Amy", "Fowler", "Yellow", Integer.valueOf(3), Boolean.valueOf(false)},
+ {"Brian", "Gerhold", "Green", Integer.valueOf(0), Boolean.valueOf(false)},
+ {"James", "Gosling", "Pink", Integer.valueOf(21), Boolean.valueOf(false)},
+ {"David", "Karlton", "Red", Integer.valueOf(1), Boolean.valueOf(false)},
+ {"Dave", "Kloba", "Yellow", Integer.valueOf(14), Boolean.valueOf(false)},
+ {"Peter", "Korn", "Purple", Integer.valueOf(12), Boolean.valueOf(false)},
+ {"Phil", "Milne", "Purple", Integer.valueOf(3), Boolean.valueOf(false)},
+ {"Dave", "Moore", "Green", Integer.valueOf(88), Boolean.valueOf(false)},
+ {"Hans", "Muller", "Maroon", Integer.valueOf(5), Boolean.valueOf(false)},
+ {"Rick", "Levenson", "Blue", Integer.valueOf(2), Boolean.valueOf(false)},
+ {"Tim", "Prinzing", "Blue", Integer.valueOf(22), Boolean.valueOf(false)},
+ {"Chester", "Rose", "Black", Integer.valueOf(0), Boolean.valueOf(false)},
+ {"Ray", "Ryan", "Gray", Integer.valueOf(77), Boolean.valueOf(false)},
+ {"Georges", "Saab", "Red", Integer.valueOf(4), Boolean.valueOf(false)},
+ {"Willie", "Walker", "Phthalo Blue", Integer.valueOf(4), Boolean.valueOf(false)},
+ {"Kathy", "Walrath", "Blue", Integer.valueOf(8), Boolean.valueOf(false)},
+ {"Arnaud", "Weber", "Green", Integer.valueOf(44), Boolean.valueOf(false)}
+ };
+ // END OF MATERIAL TO LOCALIZE
+
+ static final Object[][] contents = {
+ {"TableData", data } // array for table data
+ };
+ }
+
diff --git a/test/jdk/performance/client/SwingMark/src/resources/TableRowTest_ja.java b/test/jdk/performance/client/SwingMark/src/resources/TableRowTest_ja.java
new file mode 100644
index 00000000000..42b165c459f
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/resources/TableRowTest_ja.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package resources;
+
+import java.util.ListResourceBundle;
+
+public class TableRowTest_ja extends ListResourceBundle {
+
+ public Object[][] getContents() {
+ return contents;
+ }
+
+ static Object[][] data = {
+ {"\uff2d\uff41\uff52\uff4b", "\uff21\uff4e\uff44\uff52\uff45\uff57\uff53", "\uff32\uff45\uff44", Integer.valueOf(2), Boolean.valueOf(true)},
+ {"\uff34\uff4f\uff4d", "\uff22\uff41\uff4c\uff4c", "\uff22\uff4c\uff55\uff45", Integer.valueOf(99), Boolean.valueOf(false)},
+ {"\uff21\uff4c\uff41\uff4e", "\uff23\uff48\uff55\uff4e\uff47", "\uff27\uff52\uff45\uff45\uff4e", Integer.valueOf(838), Boolean.valueOf(false)},
+ {"\uff2a\uff45\uff46\uff46", "\uff24\uff49\uff4e\uff4b\uff49\uff4e\uff53", "\uff34\uff55\uff52\uff51\uff55\uff4f\uff49\uff53", Integer.valueOf(8), Boolean.valueOf(true)},
+ {"\uff21\uff4d\uff59", "\uff26\uff4f\uff57\uff4c\uff45\uff52", "\uff39\uff45\uff4c\uff4c\uff4f\uff57", Integer.valueOf(3), Boolean.valueOf(false)},
+ {"\uff22\uff52\uff49\uff41\uff4e", "\uff27\uff45\uff52\uff48\uff4f\uff4c\uff44", "\uff27\uff52\uff45\uff45\uff4e", Integer.valueOf(0), Boolean.valueOf(false)},
+ {"\uff2a\uff41\uff4d\uff45\uff53", "\uff27\uff4f\uff53\uff4c\uff49\uff4e\uff47", "\uff30\uff49\uff4e\uff4b", Integer.valueOf(21), Boolean.valueOf(false)},
+ {"\uff24\uff41\uff56\uff49\uff44", "\uff2b\uff41\uff52\uff4c\uff54\uff4f\uff4e", "\uff32\uff45\uff44", Integer.valueOf(1), Boolean.valueOf(false)},
+ {"\uff24\uff41\uff56\uff45", "\uff2b\uff4c\uff4f\uff42\uff41", "\uff39\uff45\uff4c\uff4c\uff4f\uff57", Integer.valueOf(14), Boolean.valueOf(false)},
+ {"\uff30\uff45\uff54\uff45\uff52", "\uff2b\uff4f\uff52\uff4e", "\uff30\uff55\uff52\uff50\uff4c\uff45", Integer.valueOf(12), Boolean.valueOf(false)},
+ {"\uff30\uff48\uff49\uff4c", "\uff2d\uff49\uff4c\uff4e\uff45", "\uff30\uff55\uff52\uff50\uff4c\uff45", Integer.valueOf(3), Boolean.valueOf(false)},
+ {"\uff24\uff41\uff56\uff45", "\uff2d\uff4f\uff4f\uff52\uff45", "\uff27\uff52\uff45\uff45\uff4e", Integer.valueOf(88), Boolean.valueOf(false)},
+ {"\uff28\uff41\uff4e\uff53", "\uff2d\uff55\uff4c\uff4c\uff45\uff52", "\uff2d\uff41\uff52\uff4f\uff4f\uff4e", Integer.valueOf(5), Boolean.valueOf(false)},
+ {"\uff32\uff49\uff43\uff4b", "\uff2c\uff45\uff56\uff45\uff4e\uff53\uff4f\uff4e", "\uff22\uff4c\uff55\uff45", Integer.valueOf(2), Boolean.valueOf(false)},
+ {"\uff34\uff49\uff4d", "\uff30\uff52\uff49\uff4e\uff5a\uff49\uff4e\uff47", "\uff22\uff4c\uff55\uff45", Integer.valueOf(22), Boolean.valueOf(false)},
+ {"\uff23\uff48\uff45\uff53\uff54\uff45\uff52", "\uff32\uff4f\uff53\uff45", "\uff22\uff4c\uff41\uff43\uff4b", Integer.valueOf(0), Boolean.valueOf(false)},
+ {"\uff32\uff41\uff59", "\uff32\uff59\uff41\uff4e", "\uff27\uff52\uff41\uff59", Integer.valueOf(77), Boolean.valueOf(false)},
+ {"\uff27\uff45\uff4f\uff52\uff47\uff45\uff53", "\uff33\uff41\uff41\uff42", "\uff32\uff45\uff44", Integer.valueOf(4), Boolean.valueOf(false)},
+ {"\uff37\uff49\uff4c\uff4c\uff49\uff45", "\uff37\uff41\uff4c\uff4b\uff45\uff52", "\uff30\uff48\uff54\uff48\uff41\uff4c\uff4f\u3000\uff42\uff4c\uff55\uff45", Integer.valueOf(4), Boolean.valueOf(false)},
+ {"\uff2b\uff41\uff54\uff48\uff59", "\uff37\uff41\uff4c\uff52\uff41\uff54\uff48", "\uff22\uff4c\uff55\uff45", Integer.valueOf(8), Boolean.valueOf(false)},
+ {"\uff21\uff52\uff4e\uff41\uff55\uff44", "\uff37\uff45\uff42\uff45\uff52", "\uff27\uff52\uff45\uff45\uff4e", Integer.valueOf(44), Boolean.valueOf(false)},
+ {"\uff2d\uff41\uff52\uff4b", "\uff21\uff4e\uff44\uff52\uff45\uff57\uff53", "\uff32\uff45\uff44", Integer.valueOf(2), Boolean.valueOf(true)},
+ {"\uff34\uff4f\uff4d", "\uff22\uff41\uff4c\uff4c", "\uff22\uff4c\uff55\uff45", Integer.valueOf(99), Boolean.valueOf(false)},
+ {"\uff21\uff4c\uff41\uff4e", "\uff23\uff48\uff55\uff4e\uff47", "\uff27\uff52\uff45\uff45\uff4e", Integer.valueOf(838), Boolean.valueOf(false)},
+ {"\uff2a\uff45\uff46\uff46", "\uff24\uff49\uff4e\uff4b\uff49\uff4e\uff53", "\uff34\uff55\uff52\uff51\uff55\uff4f\uff49\uff53", Integer.valueOf(8), Boolean.valueOf(true)},
+ {"\uff21\uff4d\uff59", "\uff26\uff4f\uff57\uff4c\uff45\uff52", "\uff39\uff45\uff4c\uff4c\uff4f\uff57", Integer.valueOf(3), Boolean.valueOf(false)},
+ {"\uff22\uff52\uff49\uff41\uff4e", "\uff27\uff45\uff52\uff48\uff4f\uff4c\uff44", "\uff27\uff52\uff45\uff45\uff4e", Integer.valueOf(0), Boolean.valueOf(false)},
+ {"\uff2a\uff41\uff4d\uff45\uff53", "\uff27\uff4f\uff53\uff4c\uff49\uff4e\uff47", "\uff30\uff49\uff4e\uff4b", Integer.valueOf(21), Boolean.valueOf(false)},
+ {"\uff24\uff41\uff56\uff49\uff44", "\uff2b\uff41\uff52\uff4c\uff54\uff4f\uff4e", "\uff32\uff45\uff44", Integer.valueOf(1), Boolean.valueOf(false)},
+ {"\uff24\uff41\uff56\uff45", "\uff2b\uff4c\uff4f\uff42\uff41", "\uff39\uff45\uff4c\uff4c\uff4f\uff57", Integer.valueOf(14), Boolean.valueOf(false)},
+ {"\uff30\uff45\uff54\uff45\uff52", "\uff2b\uff4f\uff52\uff4e", "\uff30\uff55\uff52\uff50\uff4c\uff45", Integer.valueOf(12), Boolean.valueOf(false)},
+ {"\uff30\uff48\uff49\uff4c", "\uff2d\uff49\uff4c\uff4e\uff45", "\uff30\uff55\uff52\uff50\uff4c\uff45", Integer.valueOf(3), Boolean.valueOf(false)},
+ {"\uff24\uff41\uff56\uff45", "\uff2d\uff4f\uff4f\uff52\uff45", "\uff27\uff52\uff45\uff45\uff4e", Integer.valueOf(88), Boolean.valueOf(false)},
+ {"\uff28\uff41\uff4e\uff53", "\uff2d\uff55\uff4c\uff4c\uff45\uff52", "\uff2d\uff41\uff52\uff4f\uff4f\uff4e", Integer.valueOf(5), Boolean.valueOf(false)},
+ {"\uff32\uff49\uff43\uff4b", "\uff2c\uff45\uff56\uff45\uff4e\uff53\uff4f\uff4e", "\uff22\uff4c\uff55\uff45", Integer.valueOf(2), Boolean.valueOf(false)},
+ {"\uff34\uff49\uff4d", "\uff30\uff52\uff49\uff4e\uff5a\uff49\uff4e\uff47", "\uff22\uff4c\uff55\uff45", Integer.valueOf(22), Boolean.valueOf(false)},
+ {"\uff23\uff48\uff45\uff53\uff54\uff45\uff52", "\uff32\uff4f\uff53\uff45", "\uff22\uff4c\uff41\uff43\uff4b", Integer.valueOf(0), Boolean.valueOf(false)},
+ {"\uff32\uff41\uff59", "\uff32\uff59\uff41\uff4e", "\uff27\uff52\uff41\uff59", Integer.valueOf(77), Boolean.valueOf(false)},
+ {"\uff27\uff45\uff4f\uff52\uff47\uff45\uff53", "\uff33\uff41\uff41\uff42", "\uff32\uff45\uff44", Integer.valueOf(4), Boolean.valueOf(false)},
+ {"\uff37\uff49\uff4c\uff4c\uff49\uff45", "\uff37\uff41\uff4c\uff4b\uff45\uff52", "\uff30\uff48\uff54\uff48\uff41\uff4c\uff4f\u3000\uff42\uff4c\uff55\uff45", Integer.valueOf(4), Boolean.valueOf(false)},
+ {"\uff2b\uff41\uff54\uff48\uff59", "\uff37\uff41\uff4c\uff52\uff41\uff54\uff48", "\uff22\uff4c\uff55\uff45", Integer.valueOf(8), Boolean.valueOf(false)},
+ {"\uff21\uff52\uff4e\uff41\uff55\uff44", "\uff37\uff45\uff42\uff45\uff52", "\uff27\uff52\uff45\uff45\uff4e", Integer.valueOf(44), Boolean.valueOf(false)}
+ };
+
+ static final Object[][] contents = {
+ {"TableData", data } // array for table data
+ };
+}
diff --git a/test/jdk/performance/client/SwingMark/src/resources/TestList.txt b/test/jdk/performance/client/SwingMark/src/resources/TestList.txt
new file mode 100644
index 00000000000..45b03ba4e80
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/resources/TestList.txt
@@ -0,0 +1,6 @@
+JMTest_04
+TextAreaTest
+SliderTest
+ListTest
+TableRowTest
+TreeTest
diff --git a/test/jdk/performance/client/SwingMark/src/resources/TextAreaTest.properties b/test/jdk/performance/client/SwingMark/src/resources/TextAreaTest.properties
new file mode 100644
index 00000000000..07df149851b
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/resources/TextAreaTest.properties
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# - Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# - Neither the name of Oracle nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Resource bundle for Menu Test
+DisplayString=Swing is Fast!!!
diff --git a/test/jdk/performance/client/SwingMark/src/resources/TextAreaTest_ja.properties b/test/jdk/performance/client/SwingMark/src/resources/TextAreaTest_ja.properties
new file mode 100644
index 00000000000..2b757c03447
--- /dev/null
+++ b/test/jdk/performance/client/SwingMark/src/resources/TextAreaTest_ja.properties
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# - Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# - Neither the name of Oracle nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Resource bundle for Menu Test
+DisplayString=\uff33\uff57\uff49\uff4e\uff47\u3000\uff49\uff53\u3000\uff26\uff41\uff53\uff54\uff01\uff01\uff01\u3000\u3000\u3000