<Swing Dev> RFR: 8261689: javax/swing/JComponent/7154030/bug7154030.java still fails with "Exception: Failed to hide opaque button"
Alexey Ivanov
aivanov at openjdk.java.net
Tue Mar 2 13:57:40 UTC 2021
On Tue, 2 Mar 2021 09:15:22 GMT, Alexander Zuev <kizune at openjdk.org> wrote:
> 8261689: javax/swing/JComponent/7154030/bug7154030.java still fails with "Exception: Failed to hide opaque button"
Should `frame` be declared as `volatile`? It's accessed on main thread in finally block.
In addition to it, `frame.getBounds()` and `frame.getInsets()` are called on main thread instead of EDT.
test/jdk/javax/swing/JComponent/7154030/bug7154030.java line 116:
> 114: Graphics g = fullScreen.getGraphics();
> 115: g.setColor(Color.RED);
> 116: g.drawRect(locx-1, locy-1, frw+1, frh+1);
Suggestion:
g.drawRect(locx - 1, locy - 1, frw + 1, frh + 1);
test/jdk/javax/swing/JComponent/7154030/bug7154030.java line 93:
> 91: frame.setMinimumSize(new Dimension(350, 350));
> 92: frame.setMaximumSize(new Dimension(350, 350));
> 93: frame.pack();
Wouldn't it make {{desktop}} larger than 300,300?
test/jdk/javax/swing/JComponent/7154030/bug7154030.java line 133:
> 131: ImageIO.write(imageShow, "png", new File("imageShow.png"));
> 132: ImageIO.write(fullScreen, "png", new File("fullScreenInit.png"));
> 133: throw new Exception("Failed to show opaque button");
<del>I suggest moving saving the images into a new method.</del>
I see the set of images is different each time. Probably it makes sense to save all the images which are non-null, what do you think?
test/jdk/javax/swing/JComponent/7154030/bug7154030.java line 192:
> 190: ImageIO.write(fullScreen, "png", new File("fullScreenInit.png"));
> 191: throw new Exception("Failed to show non-opaque button");
> 192: }
Does it make sense to move this block above before `invokeAndWait` to make the sequence of actions consistent?
-------------
PR: https://git.openjdk.java.net/jdk/pull/2790
More information about the swing-dev
mailing list