< prev index next >

test/javax/swing/JComboBox/8057893/bug8057893.java

Print this page
rev 14031 : 8160974: [TESTBUG] Mark more headful tests with @key headful.

This is a backport of fe58d505fffd from jdk9. 228/596 hunks apply without
modifications. 16 hunks required manual rework. The remainder were for files
not present in jdk8u.


  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.awt.EventQueue;
  25 import java.awt.Robot;
  26 import java.awt.Toolkit;
  27 import java.awt.event.ActionEvent;
  28 import java.awt.event.ActionListener;
  29 import java.awt.event.KeyEvent;
  30 import javax.swing.JComboBox;
  31 import javax.swing.JFrame;
  32 import javax.swing.WindowConstants;
  33 import sun.awt.SunToolkit;
  34 
  35 /**
  36  * @test

  37  * @bug 8057893
  38  * @author Alexander Scherbatiy
  39  * @summary JComboBox actionListener never receives "comboBoxEdited"
  40  *   from getActionCommand
  41  * @run main bug8057893
  42  */
  43 public class bug8057893 {
  44 
  45     private static volatile boolean isComboBoxEdited = false;
  46 
  47     public static void main(String[] args) throws Exception {
  48         Robot robot = new Robot();
  49         robot.setAutoDelay(50);
  50         SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
  51 
  52         EventQueue.invokeAndWait(() -> {
  53             JFrame frame = new JFrame();
  54             frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  55             JComboBox<String> comboBox = new JComboBox<>(new String[]{"one", "two"});
  56             comboBox.setEditable(true);




  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.awt.EventQueue;
  25 import java.awt.Robot;
  26 import java.awt.Toolkit;
  27 import java.awt.event.ActionEvent;
  28 import java.awt.event.ActionListener;
  29 import java.awt.event.KeyEvent;
  30 import javax.swing.JComboBox;
  31 import javax.swing.JFrame;
  32 import javax.swing.WindowConstants;
  33 import sun.awt.SunToolkit;
  34 
  35 /**
  36  * @test
  37  * @key headful
  38  * @bug 8057893
  39  * @author Alexander Scherbatiy
  40  * @summary JComboBox actionListener never receives "comboBoxEdited"
  41  *   from getActionCommand
  42  * @run main bug8057893
  43  */
  44 public class bug8057893 {
  45 
  46     private static volatile boolean isComboBoxEdited = false;
  47 
  48     public static void main(String[] args) throws Exception {
  49         Robot robot = new Robot();
  50         robot.setAutoDelay(50);
  51         SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
  52 
  53         EventQueue.invokeAndWait(() -> {
  54             JFrame frame = new JFrame();
  55             frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  56             JComboBox<String> comboBox = new JComboBox<>(new String[]{"one", "two"});
  57             comboBox.setEditable(true);


< prev index next >