简体   繁体   English

线程“ AWT-EventQueue-0”中的异常java.lang.IllegalArgumentException:矩形的宽度和高度必须大于0

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

I have a peculiar situation here in an application I've programmed using a Substance LookAndFeel. 在我使用Substance LookAndFeel编程的应用程序中,这里有一个特殊的情况。 In my application, as seen in the screenshot below, I have three JMenus in the MenuBar. 在我的应用程序中,如下面的屏幕快照所示,我在MenuBar中有三个JMenu。

在此处输入图片说明

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". 它下面没有MenuItems,并且可以用作独立的人造“按钮”。

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). 但是在控制台中,我得到了一个巨大的错误块,该错误块与我假设的是我正在使用的当前L&F有关(请参阅“系统默认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 (ie the Robot, or the L&F, or the MenuBar, or whatever). 如果需要发布我的任何代码来帮助解决问题,请推荐您认为问题出处的位置(例如,Robot,L&F,MenuBar或其他)。 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. 我的猜测仅仅是因为它没有要显示的MenuItems,但是我可能错了。 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)

This is a bug in Substance that is based on older code in JGoodies. 这是Substance中的错误,该错误基于JGoodies中的旧代码。 Kirill took an older snapshot of ShadowPopup that didn't have code to check for things like zero width or height. Kirill拍摄了ShadowPopup的旧快照,该快照没有代码来检查宽度或高度为零。 Current versions of ShadowPopup look for that error and handle it properly. 当前版本的ShadowPopup寻找该错误并正确处理。

Substance itself is no longer maintained by Kirill, but I do have a maintenence fork. 物质本身不再由Kirill维护,但我确实有一个维护叉。 Could you post this as an issue there? 能把它作为问题发布吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 线程“AWT-EventQueue-0”中的异常 java.lang.IllegalArgumentException: 宽度 (-1) 和高度 (-1) 不能 &lt;= 0 - Exception in thread “AWT-EventQueue-0” java.lang.IllegalArgumentException: Width (-1) and height (-1) cannot be <= 0 线程“ AWT-EventQueue-0”中的java异常java.lang.IllegalArgumentException - java exception in thread “AWT-EventQueue-0” java.lang.IllegalArgumentException 线程“ AWT-EventQueue-0”中的异常java.lang.IllegalArgumentException: - Exception in thread “AWT-EventQueue-0” java.lang.IllegalArgumentException: 线程“ AWT-EventQueue-0”中的异常java.lang.IllegalArgumentException:输入== null - Exception in thread “AWT-EventQueue-0” java.lang.IllegalArgumentException: input == null 线程“AWT-EventQueue-0”中的异常java.lang.IllegalArgumentException:比较方法违反了其总契约 - Exception in thread “AWT-EventQueue-0” java.lang.IllegalArgumentException: Comparison method violates its general contract 线程“ AWT-EventQueue-0”中的异常java.lang.IllegalArgumentException:该文件不存在 - Exception in thread “AWT-EventQueue-0” java.lang.IllegalArgumentException: The file doesn't exist 获取错误-线程“ AWT-EventQueue-0”中的异常java.lang.IllegalArgumentException:文本不能为null或为空 - Getting error - Exception in thread “AWT-EventQueue-0” java.lang.IllegalArgumentException: text cannot be null or empty 线程“AWT-EventQueue-0”中的异常java.lang.IllegalArgumentException:im == null - Exception in thread “AWT-EventQueue-0” java.lang.IllegalArgumentException: im == null 线程“ AWT-EventQueue-0”中的异常java.lang.IllegalArgumentException:大小无效 - Exception in thread “AWT-EventQueue-0” java.lang.IllegalArgumentException: Invalid size Java:线程“ AWT-EventQueue-0”中的异常java.lang.NullPointerException - Java: Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM