Insubstantial / insubstantial

Swing look-and-feel library and assorted widgets
193 stars 57 forks source link

Exception in thread “AWT-EventQueue-0” java.lang.IllegalArgumentException: Rectangle width and height must be > 0 #46

Closed xWaffle closed 12 years ago

xWaffle commented 12 years ago

I have a peculiar situation here in an application I've programmed using a Substance LookAndFeel. In my application, as seen in the screenshot below, I have three JMenus in the MenuBar.

http://i.stack.imgur.com/6VxOr.png

The one all the way on the right (Take Screenshot) is click-able and takes a screenshot of the entire application window. It has no MenuItems beneath it and works as a standalone faux "button".

Upon being clicked, it works perfectly fine. But in the console I get a HUGE block of errors related to what I'm assuming is the current L&F I'm using (seeing as this didn't happen with the System Default L&F).

Another question I would like to have answered is how to fix the opaque part of the menu's shadow, also as seen in the screenshot provided. None of this affects execution of the application in any way, I would just like them both resolved to ensure execution is optimal.

If any of my code needs to be posted to help resolve the issue, please recommend where you think thr issue is originating from (i.e. the Robot, or the L&F, or the MenuBar, or whatever). I will post whatever is needed.

edit: I have done some more exploration and it seems to occur only when any of the Menus are selected, then I hover over to the Screenshot menu. My guess is simply because it has no MenuItems to be displayed, but I could be wrong. I still haven't a clue on how to resolve the issue, though.

Here's the error log: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Recta ngle width and height must be > 0 at java.awt.Robot.checkValidRect(Unknown Source) at java.awt.Robot.createScreenCapture(Unknown Source) at org.pushingpixels.substance.internal.contrib.jgoodies.looks.common.Sh adowPopup.snapshot(ShadowPopup.java:286) at org.pushingpixels.substance.internal.contrib.jgoodies.looks.common.Sh adowPopup.show(ShadowPopup.java:198) at javax.swing.JPopupMenu.getPopup(Unknown Source) at javax.swing.JPopupMenu.setVisible(Unknown Source) at javax.swing.JPopupMenu.show(Unknown Source) at javax.swing.JMenu.setPopupMenuVisible(Unknown Source) at javax.swing.JPopupMenu.menuSelectionChanged(Unknown Source) at javax.swing.MenuSelectionManager.setSelectedPath(Unknown Source) at javax.swing.plaf.basic.BasicMenuUI.appendPath(Unknown Source) at javax.swing.plaf.basic.BasicMenuUI.access$200(Unknown Source) at javax.swing.plaf.basic.BasicMenuUI$Handler.mousePressed(Unknown Sourc e) at java.awt.AWTEventMulticaster.mousePressed(Unknown Source) at java.awt.AWTEventMulticaster.mousePressed(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$000(Unknown Source) at java.awt.EventQueue$1.run(Unknown Source) at java.awt.EventQueue$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$2.run(Unknown Source) at java.awt.EventQueue$2.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)

disrvptor commented 12 years ago

Is your take a screenshot menu inserted as a JMenu or JMenuItem? You should be able to insert a JMenuItem into your JMenuBar to solve this if the aforementioned is the case.

-Guy

shemnon commented 12 years ago

The NPE mentioned in the title is addressed by the above commit, resolving.

I have no good answer for the bad popup shadowing, it has to do with the reliance on robot screenshots.