test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java
author arapte
Wed, 30 Oct 2019 16:59:40 +0530
changeset 59173 0fa6b6461451
parent 51454 06417e487a28
permissions -rw-r--r--
8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys Reviewed-by: serb, psadhukhan
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
     1
/*
59173
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
     2
 * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
     4
 *
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
     7
 * published by the Free Software Foundation.
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
     8
 *
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    13
 * accompanied this code).
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    14
 *
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    18
 *
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    21
 * questions.
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    22
 */
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    23
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    24
 /*
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    25
 * @test
40128
e635645d2a8a 8160974: [TESTBUG] Mark more headful tests with @key headful.
goetz
parents: 28071
diff changeset
    26
 * @key headful
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    27
 * @library ../../regtesthelpers
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    28
 * @build Util
59173
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
    29
 * @bug 8033699 8154043 8167160 8208640 8226892
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    30
 * @summary  Incorrect radio button behavior when pressing tab key
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    31
 * @run main bug8033699
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    32
 */
42723
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    33
import java.awt.KeyboardFocusManager;
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    34
import java.awt.Robot;
59173
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
    35
import java.awt.event.ActionListener;
42723
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    36
import java.awt.event.KeyEvent;
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    37
import java.util.logging.Level;
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    38
import java.util.logging.Logger;
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    39
import javax.swing.BorderFactory;
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    40
import javax.swing.BoxLayout;
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    41
import javax.swing.ButtonGroup;
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    42
import javax.swing.JButton;
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    43
import javax.swing.JFrame;
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    44
import javax.swing.JPanel;
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    45
import javax.swing.JRadioButton;
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    46
import javax.swing.SwingUtilities;
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    47
import javax.swing.UIManager;
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    48
import javax.swing.UnsupportedLookAndFeelException;
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    49
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    50
public class bug8033699 {
42723
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    51
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    52
    private static JFrame mainFrame;
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    53
    private static Robot robot;
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    54
    private static JButton btnStart;
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    55
    private static JButton btnEnd;
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    56
    private static JButton btnMiddle;
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    57
    private static JRadioButton radioBtn1;
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    58
    private static JRadioButton radioBtn2;
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    59
    private static JRadioButton radioBtn3;
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    60
    private static JRadioButton radioBtnSingle;
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    61
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    62
    public static void main(String args[]) throws Throwable {
51454
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
    63
        SwingUtilities.invokeAndWait(() -> {
42723
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    64
                changeLAF();
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    65
                createAndShowGUI();
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    66
        });
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    67
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    68
        robot = new Robot();
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    69
        Thread.sleep(100);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    70
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    71
        robot.setAutoDelay(100);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    72
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    73
        // tab key test grouped radio button
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    74
        runTest1();
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    75
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    76
        // tab key test non-grouped radio button
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    77
        runTest2();
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    78
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    79
        // shift tab key test grouped and non grouped radio button
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    80
        runTest3();
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    81
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    82
        // left/up key test in grouped radio button
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    83
        runTest4();
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    84
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    85
        // down/right key test in grouped radio button
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    86
        runTest5();
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    87
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    88
        // tab from radio button in group to next component in the middle of button group layout
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    89
        runTest6();
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    90
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    91
        // tab to radio button in group from component in the middle of button group layout
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    92
        runTest7();
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    93
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    94
        // down key circle back to first button in grouped radio button
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
    95
        runTest8();
42723
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
    96
59173
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
    97
        // Verify that ActionListener is called when a RadioButton is selected using arrow key.
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
    98
        runTest9();
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
    99
51454
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   100
        SwingUtilities.invokeAndWait(() -> mainFrame.dispose());
42723
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   101
    }
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   102
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   103
    private static void changeLAF() {
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   104
        String currentLAF = UIManager.getLookAndFeel().toString();
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   105
        System.out.println(currentLAF);
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   106
        currentLAF = currentLAF.toLowerCase();
51454
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   107
        if (currentLAF.contains("nimbus")) {
42723
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   108
            try {
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   109
                UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   110
            } catch (Exception ex) {
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   111
                ex.printStackTrace();
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   112
            }
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   113
        }
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   114
    }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   115
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   116
    private static void createAndShowGUI() {
42723
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   117
        mainFrame = new JFrame("Bug 8033699 - 8 Tests for Grouped/Non Group Radio Buttons");
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   118
        btnStart = new JButton("Start");
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   119
        btnEnd = new JButton("End");
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   120
        btnMiddle = new JButton("Middle");
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   121
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   122
        JPanel box = new JPanel();
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   123
        box.setLayout(new BoxLayout(box, BoxLayout.Y_AXIS));
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   124
        box.setBorder(BorderFactory.createTitledBorder("Grouped Radio Buttons"));
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   125
        radioBtn1 = new JRadioButton("A");
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   126
        radioBtn2 = new JRadioButton("B");
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   127
        radioBtn3 = new JRadioButton("C");
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   128
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   129
        ButtonGroup btnGrp = new ButtonGroup();
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   130
        btnGrp.add(radioBtn1);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   131
        btnGrp.add(radioBtn2);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   132
        btnGrp.add(radioBtn3);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   133
        radioBtn1.setSelected(true);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   134
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   135
        box.add(radioBtn1);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   136
        box.add(radioBtn2);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   137
        box.add(btnMiddle);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   138
        box.add(radioBtn3);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   139
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   140
        radioBtnSingle = new JRadioButton("Not Grouped");
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   141
        radioBtnSingle.setSelected(true);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   142
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   143
        mainFrame.getContentPane().add(btnStart);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   144
        mainFrame.getContentPane().add(box);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   145
        mainFrame.getContentPane().add(radioBtnSingle);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   146
        mainFrame.getContentPane().add(btnEnd);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   147
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   148
        mainFrame.getRootPane().setDefaultButton(btnStart);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   149
        btnStart.requestFocus();
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   150
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   151
        mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   152
        mainFrame.setLayout(new BoxLayout(mainFrame.getContentPane(), BoxLayout.Y_AXIS));
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   153
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   154
        mainFrame.setSize(300, 300);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   155
        mainFrame.setLocation(200, 200);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   156
        mainFrame.setVisible(true);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   157
        mainFrame.toFront();
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   158
    }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   159
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   160
    // Radio button Group as a single component when traversing through tab key
42723
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   161
    private static void runTest1() throws Exception {
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   162
        hitKey(robot, KeyEvent.VK_TAB);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   163
        hitKey(robot, KeyEvent.VK_TAB);
41396
d72f3a09b3ae 8154043: Fields not reachable anymore by tab-key, because of new tabbing behaviour of radio button groups.
ssadetsky
parents: 40128
diff changeset
   164
        hitKey(robot, KeyEvent.VK_TAB);
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   165
51454
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   166
        SwingUtilities.invokeAndWait(() -> {
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   167
            if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtnSingle) {
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   168
                System.out.println("Radio Button Group Go To Next Component through Tab Key failed");
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   169
                throw new RuntimeException("Focus is not on Radio Button Single as Expected");
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   170
            }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   171
        });
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   172
    }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   173
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   174
    // Non-Grouped Radio button as a single component when traversing through tab key
42723
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   175
    private static void runTest2() throws Exception {
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   176
        hitKey(robot, KeyEvent.VK_TAB);
51454
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   177
        SwingUtilities.invokeAndWait(() -> {
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   178
            if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != btnEnd) {
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   179
                System.out.println("Non Grouped Radio Button Go To Next Component through Tab Key failed");
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   180
                throw new RuntimeException("Focus is not on Button End as Expected");
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   181
            }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   182
        });
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   183
    }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   184
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   185
    // Non-Grouped Radio button and Group Radio button as a single component when traversing through shift-tab key
42723
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   186
    private static void runTest3() throws Exception {
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   187
        hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   188
        hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
41396
d72f3a09b3ae 8154043: Fields not reachable anymore by tab-key, because of new tabbing behaviour of radio button groups.
ssadetsky
parents: 40128
diff changeset
   189
        hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
51454
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   190
        SwingUtilities.invokeAndWait(() -> {
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   191
            if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn1) {
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   192
                System.out.println("Radio button Group/Non Grouped Radio Button SHIFT-Tab Key Test failed");
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   193
                throw new RuntimeException("Focus is not on Radio Button A as Expected");
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   194
            }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   195
        });
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   196
    }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   197
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   198
    // Using arrow key to move focus in radio button group
42723
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   199
    private static void runTest4() throws Exception {
41396
d72f3a09b3ae 8154043: Fields not reachable anymore by tab-key, because of new tabbing behaviour of radio button groups.
ssadetsky
parents: 40128
diff changeset
   200
        hitKey(robot, KeyEvent.VK_DOWN);
d72f3a09b3ae 8154043: Fields not reachable anymore by tab-key, because of new tabbing behaviour of radio button groups.
ssadetsky
parents: 40128
diff changeset
   201
        hitKey(robot, KeyEvent.VK_RIGHT);
51454
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   202
        SwingUtilities.invokeAndWait(() -> {
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   203
            if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   204
                System.out.println("Radio button Group UP/LEFT Arrow Key Move Focus Failed");
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   205
                throw new RuntimeException("Focus is not on Radio Button C as Expected");
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   206
            }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   207
        });
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   208
    }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   209
42723
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   210
    private static void runTest5() throws Exception {
41396
d72f3a09b3ae 8154043: Fields not reachable anymore by tab-key, because of new tabbing behaviour of radio button groups.
ssadetsky
parents: 40128
diff changeset
   211
        hitKey(robot, KeyEvent.VK_UP);
d72f3a09b3ae 8154043: Fields not reachable anymore by tab-key, because of new tabbing behaviour of radio button groups.
ssadetsky
parents: 40128
diff changeset
   212
        hitKey(robot, KeyEvent.VK_LEFT);
51454
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   213
        SwingUtilities.invokeAndWait(() -> {
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   214
            if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn1) {
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   215
                System.out.println("Radio button Group Left/Up Arrow Key Move Focus Failed");
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   216
                throw new RuntimeException("Focus is not on Radio Button A as Expected");
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   217
            }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   218
        });
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   219
    }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   220
42723
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   221
    private static void runTest6() throws Exception {
41396
d72f3a09b3ae 8154043: Fields not reachable anymore by tab-key, because of new tabbing behaviour of radio button groups.
ssadetsky
parents: 40128
diff changeset
   222
        hitKey(robot, KeyEvent.VK_UP);
d72f3a09b3ae 8154043: Fields not reachable anymore by tab-key, because of new tabbing behaviour of radio button groups.
ssadetsky
parents: 40128
diff changeset
   223
        hitKey(robot, KeyEvent.VK_UP);
51454
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   224
        SwingUtilities.invokeAndWait(() -> {
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   225
            if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn2) {
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   226
                System.out.println("Radio button Group Circle Back To First Button Test");
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   227
                throw new RuntimeException("Focus is not on Radio Button B as Expected");
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   228
            }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   229
        });
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   230
    }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   231
42723
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   232
    private static void runTest7() throws Exception {
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   233
        hitKey(robot, KeyEvent.VK_TAB);
51454
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   234
        SwingUtilities.invokeAndWait(() -> {
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   235
            if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != btnMiddle) {
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   236
                System.out.println("Separate Component added in button group layout");
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   237
                throw new RuntimeException("Focus is not on Middle Button as Expected");
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   238
            }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   239
        });
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   240
    }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   241
42723
830c2a93d94f 8167160: [TEST_BUG][PIT] failure of javax/swing/JRadioButton/8033699/bug8033699.java
aniyogi
parents: 41396
diff changeset
   242
    private static void runTest8() throws Exception {
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   243
        hitKey(robot, KeyEvent.VK_TAB);
51454
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   244
        SwingUtilities.invokeAndWait(() -> {
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   245
            if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtnSingle) {
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   246
                System.out.println("Separate Component added in button group layout");
06417e487a28 8208640: [a11y] [macos] Unable to navigate between Radiobuttons in Radio group using keyboard.
kaddepalli
parents: 47216
diff changeset
   247
                throw new RuntimeException("Focus is not on Radio Button Single as Expected");
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   248
            }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   249
        });
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   250
    }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   251
59173
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   252
    private static Boolean actRB1 = false;
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   253
    private static Boolean actRB2 = false;
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   254
    private static Boolean actRB3 = false;
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   255
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   256
    // JDK-8226892: Verify that ActionListener is called when a RadioButton is selected using arrow key.
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   257
    private static void runTest9() throws Exception {
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   258
        SwingUtilities.invokeAndWait(() -> {
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   259
            radioBtn1.setSelected(true);
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   260
            radioBtn1.requestFocusInWindow();
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   261
        });
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   262
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   263
        ActionListener actLrRB1 = e -> actRB1 = true;
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   264
        ActionListener actLrRB2 = e -> actRB2 = true;
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   265
        ActionListener actLrRB3 = e -> actRB3 = true;
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   266
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   267
        radioBtn1.addActionListener(actLrRB1);
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   268
        radioBtn2.addActionListener(actLrRB2);
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   269
        radioBtn3.addActionListener(actLrRB3);
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   270
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   271
        hitKey(robot, KeyEvent.VK_DOWN);
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   272
        hitKey(robot, KeyEvent.VK_DOWN);
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   273
        hitKey(robot, KeyEvent.VK_DOWN);
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   274
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   275
        String failMessage = "ActionListener not invoked when selected using arrow key.";
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   276
        if (!actRB2) {
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   277
            throw new RuntimeException("RadioButton 2: " + failMessage);
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   278
        }
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   279
        if (!actRB3) {
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   280
            throw new RuntimeException("RadioButton 3: " + failMessage);
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   281
        }
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   282
        if (!actRB1) {
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   283
            throw new RuntimeException("RadioButton 1: " + failMessage);
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   284
        }
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   285
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   286
        radioBtn1.removeActionListener(actLrRB1);
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   287
        radioBtn2.removeActionListener(actLrRB2);
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   288
        radioBtn3.removeActionListener(actLrRB3);
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   289
    }
0fa6b6461451 8226892: ActionListeners on JRadioButtons don't get notified when selection is changed with arrow keys
arapte
parents: 51454
diff changeset
   290
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   291
    private static void hitKey(Robot robot, int keycode) {
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   292
        robot.keyPress(keycode);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   293
        robot.keyRelease(keycode);
28071
3acb75b8df45 8063107: Change open swing regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 27270
diff changeset
   294
        robot.waitForIdle();
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   295
    }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   296
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   297
    private static void hitKey(Robot robot, int mode, int keycode) {
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   298
        robot.keyPress(mode);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   299
        robot.keyPress(keycode);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   300
        robot.keyRelease(mode);
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   301
        robot.keyRelease(keycode);
28071
3acb75b8df45 8063107: Change open swing regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 27270
diff changeset
   302
        robot.waitForIdle();
27270
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   303
    }
c3983b6dbfbc 8033699: Incorrect radio button behavior
van
parents:
diff changeset
   304
}