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
25 import java.awt.Graphics;
26 import java.awt.Toolkit;
27 import java.awt.image.BufferedImage;
28 import java.lang.reflect.InvocationTargetException;
29
30 import javax.swing.JButton;
31 import javax.swing.JFrame;
32 import javax.swing.SwingUtilities;
33
34 /**
35 * @test
36 * @key headful
37 * @bug 8009919
38 * @author Sergey Bylokhov
39 * @library ../../../../lib/testlibrary/
40 * @build ExtendedRobot
41 * @run main JButtonPaintNPE
42 */
43 public final class JButtonPaintNPE {
44
45 private static JFrame frame;
46
47 public static void main(final String[] args)
48 throws InvocationTargetException, InterruptedException {
49 SwingUtilities.invokeAndWait(() -> {
50 frame = new JFrame();
51 frame.add(new JButton() {
52 @Override
53 protected void paintComponent(final Graphics g) {
54 Graphics gg = new BufferedImage(getWidth(), getHeight(),
55 BufferedImage.TYPE_INT_ARGB).createGraphics();
56 super.paintComponent(gg);
57 gg.dispose();
58 }
59 });
|
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
25 import java.awt.Graphics;
26 import java.awt.Toolkit;
27 import java.awt.image.BufferedImage;
28 import java.lang.reflect.InvocationTargetException;
29
30 import javax.swing.JButton;
31 import javax.swing.JFrame;
32 import javax.swing.SwingUtilities;
33
34 /**
35 * @test
36 * @key headful
37 * @bug 8009919
38 * @author Sergey Bylokhov
39 * @library ../../../../lib/client/
40 * @build ExtendedRobot
41 * @run main JButtonPaintNPE
42 */
43 public final class JButtonPaintNPE {
44
45 private static JFrame frame;
46
47 public static void main(final String[] args)
48 throws InvocationTargetException, InterruptedException {
49 SwingUtilities.invokeAndWait(() -> {
50 frame = new JFrame();
51 frame.add(new JButton() {
52 @Override
53 protected void paintComponent(final Graphics g) {
54 Graphics gg = new BufferedImage(getWidth(), getHeight(),
55 BufferedImage.TYPE_INT_ARGB).createGraphics();
56 super.paintComponent(gg);
57 gg.dispose();
58 }
59 });
|