< prev index next >

test/javax/swing/JDialog/WrongBackgroundColor/WrongBackgroundColor.java

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


  16  * 2 along with this work; if not, write to the Free Software Foundation,
  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.Color;
  25 import java.lang.reflect.InvocationTargetException;
  26 
  27 import javax.swing.JDialog;
  28 import javax.swing.JFrame;
  29 import javax.swing.SwingUtilities;
  30 import javax.swing.UIDefaults;
  31 import javax.swing.UIManager;
  32 import javax.swing.plaf.ColorUIResource;
  33 
  34 /**
  35  * @test

  36  * @bug 8033786
  37  * @summary JDialog should update background color of the native peer.
  38  * @author Sergey Bylokhov
  39  */
  40 public final class WrongBackgroundColor {
  41 
  42     public static void main(final String[] args)
  43             throws InvocationTargetException, InterruptedException {
  44         SwingUtilities.invokeAndWait(() -> {
  45             UIDefaults ui = UIManager.getDefaults();
  46             ui.put("control", new ColorUIResource(54, 54, 54));
  47             final JDialog dialog = new JDialog();
  48             final JFrame frame = new JFrame();
  49             frame.pack();
  50             dialog.pack();
  51             final Color dialogBackground = dialog.getBackground();
  52             final Color frameBackground = frame.getBackground();
  53             frame.dispose();
  54             dialog.dispose();
  55             if (!dialogBackground.equals(frameBackground)) {


  16  * 2 along with this work; if not, write to the Free Software Foundation,
  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.Color;
  25 import java.lang.reflect.InvocationTargetException;
  26 
  27 import javax.swing.JDialog;
  28 import javax.swing.JFrame;
  29 import javax.swing.SwingUtilities;
  30 import javax.swing.UIDefaults;
  31 import javax.swing.UIManager;
  32 import javax.swing.plaf.ColorUIResource;
  33 
  34 /**
  35  * @test
  36  * @key headful
  37  * @bug 8033786
  38  * @summary JDialog should update background color of the native peer.
  39  * @author Sergey Bylokhov
  40  */
  41 public final class WrongBackgroundColor {
  42 
  43     public static void main(final String[] args)
  44             throws InvocationTargetException, InterruptedException {
  45         SwingUtilities.invokeAndWait(() -> {
  46             UIDefaults ui = UIManager.getDefaults();
  47             ui.put("control", new ColorUIResource(54, 54, 54));
  48             final JDialog dialog = new JDialog();
  49             final JFrame frame = new JFrame();
  50             frame.pack();
  51             dialog.pack();
  52             final Color dialogBackground = dialog.getBackground();
  53             final Color frameBackground = frame.getBackground();
  54             frame.dispose();
  55             dialog.dispose();
  56             if (!dialogBackground.equals(frameBackground)) {
< prev index next >