23
24 import java.awt.Color;
25 import java.awt.Graphics2D;
26 import java.awt.image.BufferedImage;
27 import java.io.File;
28 import java.io.IOException;
29
30 import javax.imageio.ImageIO;
31 import javax.swing.JFrame;
32 import javax.swing.JMenu;
33 import javax.swing.JMenuBar;
34 import javax.swing.SwingUtilities;
35 import javax.swing.UIManager;
36 import javax.swing.UnsupportedLookAndFeelException;
37
38 import static java.awt.image.BufferedImage.TYPE_INT_ARGB_PRE;
39 import static javax.swing.UIManager.getInstalledLookAndFeels;
40
41 /**
42 * @test
43 * @bug 8073795
44 * @summary JMenuBar has incorrect border when the window is on retina display.
45 * @author Sergey Bylokhov
46 * @run main/othervm MisplacedBorder
47 * @run main/othervm -Dswing.metalTheme=steel MisplacedBorder
48 */
49 public final class MisplacedBorder implements Runnable {
50
51 public static final int W = 400;
52 public static final int H = 400;
53
54 public static void main(final String[] args) throws Exception {
55 for (final UIManager.LookAndFeelInfo laf : getInstalledLookAndFeels()) {
56 SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
57 SwingUtilities.invokeAndWait(new MisplacedBorder());
58 }
59 System.out.println("Test passed");
60 }
61
62 @Override
|
23
24 import java.awt.Color;
25 import java.awt.Graphics2D;
26 import java.awt.image.BufferedImage;
27 import java.io.File;
28 import java.io.IOException;
29
30 import javax.imageio.ImageIO;
31 import javax.swing.JFrame;
32 import javax.swing.JMenu;
33 import javax.swing.JMenuBar;
34 import javax.swing.SwingUtilities;
35 import javax.swing.UIManager;
36 import javax.swing.UnsupportedLookAndFeelException;
37
38 import static java.awt.image.BufferedImage.TYPE_INT_ARGB_PRE;
39 import static javax.swing.UIManager.getInstalledLookAndFeels;
40
41 /**
42 * @test
43 * @key headful
44 * @bug 8073795
45 * @summary JMenuBar has incorrect border when the window is on retina display.
46 * @author Sergey Bylokhov
47 * @run main/othervm MisplacedBorder
48 * @run main/othervm -Dswing.metalTheme=steel MisplacedBorder
49 */
50 public final class MisplacedBorder implements Runnable {
51
52 public static final int W = 400;
53 public static final int H = 400;
54
55 public static void main(final String[] args) throws Exception {
56 for (final UIManager.LookAndFeelInfo laf : getInstalledLookAndFeels()) {
57 SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
58 SwingUtilities.invokeAndWait(new MisplacedBorder());
59 }
60 System.out.println("Test passed");
61 }
62
63 @Override
|