mirror of
https://github.com/openjdk/jdk8u.git
synced 2025-12-10 21:05:56 -06:00
8154043: Fields not reachable anymore by tab-key, because of new tabbing behaviour of radio button groups.
8182577: Exception when Tab key moves focus to a JCheckbox with a custom ButtonModel Reviewed-by: phh, andrew Backport-of: 8d81ec63b2bafc431cbb8572a3e45e76580ab46f
This commit is contained in:
parent
942d6d0614
commit
86ecd5bb24
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,9 +26,9 @@ package javax.swing;
|
|||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Container;
|
import java.awt.Container;
|
||||||
import java.awt.ComponentOrientation;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.util.Enumeration;
|
||||||
import sun.awt.SunToolkit;
|
import sun.awt.SunToolkit;
|
||||||
|
|
||||||
|
|
||||||
@ -235,6 +235,30 @@ public class LayoutFocusTraversalPolicy extends SortingFocusTraversalPolicy
|
|||||||
JComboBox box = (JComboBox)aComponent;
|
JComboBox box = (JComboBox)aComponent;
|
||||||
return box.getUI().isFocusTraversable(box);
|
return box.getUI().isFocusTraversable(box);
|
||||||
} else if (aComponent instanceof JComponent) {
|
} else if (aComponent instanceof JComponent) {
|
||||||
|
if (SunToolkit.isInstanceOf(aComponent,
|
||||||
|
"javax.swing.JToggleButton")) {
|
||||||
|
ButtonModel buttonModel = ((JToggleButton) aComponent).getModel();
|
||||||
|
if (buttonModel != null && buttonModel instanceof DefaultButtonModel) {
|
||||||
|
DefaultButtonModel model = (DefaultButtonModel) buttonModel;
|
||||||
|
ButtonGroup group = model.getGroup();
|
||||||
|
if (group != null) {
|
||||||
|
Enumeration<AbstractButton> elements =
|
||||||
|
group.getElements();
|
||||||
|
int idx = 0;
|
||||||
|
while (elements.hasMoreElements()) {
|
||||||
|
AbstractButton member = elements.nextElement();
|
||||||
|
if (member.isVisible() && member.isDisplayable() &&
|
||||||
|
member.isEnabled() && member.isFocusable()) {
|
||||||
|
if (member == aComponent) {
|
||||||
|
return idx == 0;
|
||||||
|
}
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
JComponent jComponent = (JComponent)aComponent;
|
JComponent jComponent = (JComponent)aComponent;
|
||||||
InputMap inputMap = jComponent.getInputMap(JComponent.WHEN_FOCUSED,
|
InputMap inputMap = jComponent.getInputMap(JComponent.WHEN_FOCUSED,
|
||||||
false);
|
false);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -437,21 +437,7 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI
|
|||||||
// Check if the next object to gain focus belongs
|
// Check if the next object to gain focus belongs
|
||||||
// to the button group or not
|
// to the button group or not
|
||||||
Component getFocusTransferBaseComponent(boolean next){
|
Component getFocusTransferBaseComponent(boolean next){
|
||||||
Component focusBaseComp = activeBtn;
|
return firstBtn;
|
||||||
Container container = focusBaseComp.getFocusCycleRootAncestor();
|
|
||||||
if (container != null) {
|
|
||||||
FocusTraversalPolicy policy = container.getFocusTraversalPolicy();
|
|
||||||
Component comp = next ? policy.getComponentAfter(container, activeBtn)
|
|
||||||
: policy.getComponentBefore(container, activeBtn);
|
|
||||||
|
|
||||||
// If next component in the button group, use last/first button as base focus
|
|
||||||
// otherwise, use the activeBtn as the base focus
|
|
||||||
if (containsInGroup(comp)) {
|
|
||||||
focusBaseComp = next ? lastBtn : firstBtn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return focusBaseComp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean getButtonGroupInfo() {
|
boolean getButtonGroupInfo() {
|
||||||
|
|||||||
@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
@test
|
||||||
|
@bug 8154043
|
||||||
|
@summary Fields not reachable anymore by tab-key, because of new tabbing
|
||||||
|
behaviour of radio button groups.
|
||||||
|
@run main ButtonGroupLayoutTraversalTest
|
||||||
|
*/
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.FocusAdapter;
|
||||||
|
import java.awt.event.FocusEvent;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
|
||||||
|
public class ButtonGroupLayoutTraversalTest {
|
||||||
|
static int nx = 3;
|
||||||
|
static int ny = 3;
|
||||||
|
|
||||||
|
static int focusCnt[] = new int[nx * ny];
|
||||||
|
private static JFrame window;
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
|
||||||
|
SwingUtilities.invokeAndWait(()->initLayout(nx, ny));
|
||||||
|
Robot robot = new Robot();
|
||||||
|
robot.setAutoDelay(100);
|
||||||
|
robot.waitForIdle();
|
||||||
|
robot.delay(200);
|
||||||
|
|
||||||
|
|
||||||
|
for(int i = 0; i < nx * ny - nx * ny / 2 - 1; i++) {
|
||||||
|
robot.keyPress(KeyEvent.VK_RIGHT);
|
||||||
|
robot.keyRelease(KeyEvent.VK_RIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < nx * ny / 2; i++) {
|
||||||
|
robot.keyPress(KeyEvent.VK_TAB);
|
||||||
|
robot.keyRelease(KeyEvent.VK_TAB);
|
||||||
|
}
|
||||||
|
|
||||||
|
robot.waitForIdle();
|
||||||
|
robot.delay(200);
|
||||||
|
|
||||||
|
for(int i = 0; i < nx * ny; i++) {
|
||||||
|
if(focusCnt[i] < 1) {
|
||||||
|
SwingUtilities.invokeLater(window::dispose);
|
||||||
|
throw new RuntimeException("Component " + i +
|
||||||
|
" is not reachable in the forward focus cycle");
|
||||||
|
} else if (focusCnt[i] > 1) {
|
||||||
|
SwingUtilities.invokeLater(window::dispose);
|
||||||
|
throw new RuntimeException("Component " + i +
|
||||||
|
" got focus more than once in the forward focus cycle");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < nx * ny / 2; i++) {
|
||||||
|
robot.keyPress(KeyEvent.VK_SHIFT);
|
||||||
|
robot.keyPress(KeyEvent.VK_TAB);
|
||||||
|
robot.keyRelease(KeyEvent.VK_TAB);
|
||||||
|
robot.keyRelease(KeyEvent.VK_SHIFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < nx * ny - nx * ny / 2 - 1; i++) {
|
||||||
|
robot.keyPress(KeyEvent.VK_LEFT);
|
||||||
|
robot.keyRelease(KeyEvent.VK_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
robot.keyPress(KeyEvent.VK_SHIFT);
|
||||||
|
robot.keyPress(KeyEvent.VK_TAB);
|
||||||
|
robot.keyRelease(KeyEvent.VK_TAB);
|
||||||
|
robot.keyRelease(KeyEvent.VK_SHIFT);
|
||||||
|
|
||||||
|
robot.waitForIdle();
|
||||||
|
robot.delay(200);
|
||||||
|
|
||||||
|
for(int i = 0; i < nx * ny; i++) {
|
||||||
|
if(focusCnt[i] < 2) {
|
||||||
|
SwingUtilities.invokeLater(window::dispose);
|
||||||
|
throw new RuntimeException("Component " + i +
|
||||||
|
" is not reachable in the backward focus cycle");
|
||||||
|
} else if (focusCnt[i] > 2) {
|
||||||
|
SwingUtilities.invokeLater(window::dispose);
|
||||||
|
throw new RuntimeException("Component " + i +
|
||||||
|
" got focus more than once in the backward focus cycle");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SwingUtilities.invokeLater(window::dispose);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void initLayout(int nx, int ny)
|
||||||
|
{
|
||||||
|
window = new JFrame("Test");
|
||||||
|
window.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
|
JPanel rootPanel = new JPanel();
|
||||||
|
rootPanel.setLayout(new BorderLayout());
|
||||||
|
JPanel formPanel = new JPanel(new GridLayout(nx, ny));
|
||||||
|
formPanel.setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
|
||||||
|
formPanel.setFocusCycleRoot(true);
|
||||||
|
ButtonGroup radioButtonGroup = new ButtonGroup();
|
||||||
|
for(int i = 0; i < nx * ny; i++) {
|
||||||
|
JToggleButton comp;
|
||||||
|
if(i % 2 == 0) {
|
||||||
|
comp = new JRadioButton("Grouped component");
|
||||||
|
radioButtonGroup.add(comp);
|
||||||
|
} else {
|
||||||
|
comp = new JRadioButton("Single component");
|
||||||
|
}
|
||||||
|
formPanel.add(comp);
|
||||||
|
int fi = i;
|
||||||
|
comp.setBackground(Color.red);
|
||||||
|
comp.addFocusListener(new FocusAdapter() {
|
||||||
|
@Override
|
||||||
|
public void focusGained(FocusEvent e) {
|
||||||
|
focusCnt[fi]++;
|
||||||
|
if( focusCnt[fi] == 1) {
|
||||||
|
((JComponent) e.getSource())
|
||||||
|
.setBackground(Color.yellow);
|
||||||
|
} else if(focusCnt[fi] == 2) {
|
||||||
|
((JComponent) e.getSource())
|
||||||
|
.setBackground(Color.green);
|
||||||
|
} else {
|
||||||
|
((JComponent) e.getSource())
|
||||||
|
.setBackground(Color.red);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
rootPanel.add(formPanel, BorderLayout.CENTER);
|
||||||
|
window.add(rootPanel);
|
||||||
|
window.pack();
|
||||||
|
window.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8182577
|
||||||
|
* @summary Verifies if moving focus via custom ButtonModel causes crash
|
||||||
|
* @run main DefaultButtonModelCrashTest
|
||||||
|
*/
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Container;
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.Robot;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
import javax.swing.ButtonModel;
|
||||||
|
import javax.swing.DefaultButtonModel;
|
||||||
|
import javax.swing.JCheckBox;
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
public class DefaultButtonModelCrashTest {
|
||||||
|
private JFrame frame = null;
|
||||||
|
private JPanel panel;
|
||||||
|
private volatile Point p = null;
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
new DefaultButtonModelCrashTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultButtonModelCrashTest() throws Exception {
|
||||||
|
try {
|
||||||
|
Robot robot = new Robot();
|
||||||
|
robot.setAutoDelay(200);
|
||||||
|
SwingUtilities.invokeAndWait(() -> go());
|
||||||
|
robot.waitForIdle();
|
||||||
|
robot.keyPress(KeyEvent.VK_TAB);
|
||||||
|
robot.keyRelease(KeyEvent.VK_TAB);
|
||||||
|
robot.delay(100);
|
||||||
|
robot.keyPress(KeyEvent.VK_TAB);
|
||||||
|
robot.keyRelease(KeyEvent.VK_TAB);
|
||||||
|
} finally {
|
||||||
|
SwingUtilities.invokeAndWait(()->frame .dispose());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void go() {
|
||||||
|
|
||||||
|
frame = new JFrame();
|
||||||
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
Container contentPane = frame.getContentPane();
|
||||||
|
ButtonModel model = new DefaultButtonModel();
|
||||||
|
|
||||||
|
JCheckBox check = new JCheckBox("a bit broken");
|
||||||
|
check.setModel(model);
|
||||||
|
panel = new JPanel(new BorderLayout());
|
||||||
|
panel.add(new JTextField("Press Tab (twice?)"), BorderLayout.NORTH);
|
||||||
|
panel.add(check);
|
||||||
|
contentPane.add(panel);
|
||||||
|
frame.setLocationRelativeTo(null);
|
||||||
|
frame.pack();
|
||||||
|
frame.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -25,7 +25,7 @@
|
|||||||
* @test
|
* @test
|
||||||
* @library ../../regtesthelpers
|
* @library ../../regtesthelpers
|
||||||
* @build Util
|
* @build Util
|
||||||
* @bug 8033699 8226892
|
* @bug 8033699 8154043 8226892
|
||||||
* @summary Incorrect radio button behavior when pressing tab key
|
* @summary Incorrect radio button behavior when pressing tab key
|
||||||
* @author Vivi An
|
* @author Vivi An
|
||||||
* @run main bug8033699
|
* @run main bug8033699
|
||||||
@ -137,6 +137,7 @@ public class bug8033699 {
|
|||||||
private static void runTest1() throws Exception{
|
private static void runTest1() throws Exception{
|
||||||
hitKey(robot, KeyEvent.VK_TAB);
|
hitKey(robot, KeyEvent.VK_TAB);
|
||||||
hitKey(robot, KeyEvent.VK_TAB);
|
hitKey(robot, KeyEvent.VK_TAB);
|
||||||
|
hitKey(robot, KeyEvent.VK_TAB);
|
||||||
|
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -163,13 +164,14 @@ public class bug8033699 {
|
|||||||
|
|
||||||
// Non-Grouped Radio button and Group Radio button as a single component when traversing through shift-tab key
|
// Non-Grouped Radio button and Group Radio button as a single component when traversing through shift-tab key
|
||||||
private static void runTest3() throws Exception{
|
private static void runTest3() throws Exception{
|
||||||
|
hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
|
||||||
hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
|
hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
|
||||||
hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
|
hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
|
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn1) {
|
||||||
System.out.println("Radio button Group/Non Grouped Radio Button SHIFT-Tab Key Test failed");
|
System.out.println("Radio button Group/Non Grouped Radio Button SHIFT-Tab Key Test failed");
|
||||||
throw new RuntimeException("Focus is not on Radio Button C as Expected");
|
throw new RuntimeException("Focus is not on Radio Button A as Expected");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -177,39 +179,39 @@ public class bug8033699 {
|
|||||||
|
|
||||||
// Using arrow key to move focus in radio button group
|
// Using arrow key to move focus in radio button group
|
||||||
private static void runTest4() throws Exception{
|
private static void runTest4() throws Exception{
|
||||||
hitKey(robot, KeyEvent.VK_UP);
|
|
||||||
hitKey(robot, KeyEvent.VK_LEFT);
|
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn1) {
|
|
||||||
System.out.println("Radio button Group UP/LEFT Arrow Key Move Focus Failed");
|
|
||||||
throw new RuntimeException("Focus is not on Radio Button A as Expected");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void runTest5() throws Exception{
|
|
||||||
hitKey(robot, KeyEvent.VK_DOWN);
|
hitKey(robot, KeyEvent.VK_DOWN);
|
||||||
hitKey(robot, KeyEvent.VK_RIGHT);
|
hitKey(robot, KeyEvent.VK_RIGHT);
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
|
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
|
||||||
System.out.println("Radio button Group Left/Up Arrow Key Move Focus Failed");
|
System.out.println("Radio button Group UP/LEFT Arrow Key Move Focus Failed");
|
||||||
throw new RuntimeException("Focus is not on Radio Button C as Expected");
|
throw new RuntimeException("Focus is not on Radio Button C as Expected");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void runTest5() throws Exception{
|
||||||
|
hitKey(robot, KeyEvent.VK_UP);
|
||||||
|
hitKey(robot, KeyEvent.VK_LEFT);
|
||||||
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn1) {
|
||||||
|
System.out.println("Radio button Group Left/Up Arrow Key Move Focus Failed");
|
||||||
|
throw new RuntimeException("Focus is not on Radio Button A as Expected");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private static void runTest6() throws Exception{
|
private static void runTest6() throws Exception{
|
||||||
hitKey(robot, KeyEvent.VK_DOWN);
|
hitKey(robot, KeyEvent.VK_UP);
|
||||||
hitKey(robot, KeyEvent.VK_DOWN);
|
hitKey(robot, KeyEvent.VK_UP);
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn2) {
|
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn2) {
|
||||||
System.out.println("Radio button Group Circle Back To First Button Test");
|
System.out.println("Radio button Group Circle Back To First Button Test");
|
||||||
throw new RuntimeException("Focus is not on Radio Button A as Expected");
|
throw new RuntimeException("Focus is not on Radio Button B as Expected");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -231,9 +233,9 @@ public class bug8033699 {
|
|||||||
hitKey(robot, KeyEvent.VK_TAB);
|
hitKey(robot, KeyEvent.VK_TAB);
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
|
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtnSingle) {
|
||||||
System.out.println("Separate Component added in button group layout");
|
System.out.println("Separate Component added in button group layout");
|
||||||
throw new RuntimeException("Focus is not on Radio Button C as Expected");
|
throw new RuntimeException("Focus is not on Radio Button Single as Expected");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user