我在使用Substance LookAndFeel编程的应用程序中有一个奇怪的情况。在我的应用程序中,如下面的屏幕截图所示,我在MenuBar中有三个JMenus。
右边的那个(截图)是可点击的,并获取整个应用程序窗口的屏幕截图。它下面没有MenuItems,可以作为一个独立的虚假“按钮”。
点击后,它完全正常。但是在控制台中,我得到了一个巨大的错误块,与我正在假设的是我正在使用的当前L& F相关(因为系统默认L& F没有发生这种情况)。
我想回答的另一个问题是如何修复菜单阴影的不透明部分,同样如提供的屏幕截图所示。这些都不会以任何方式影响应用程序的执行,我只希望他们都解决以确保执行是最佳的。
如果我的任何代码需要发布以帮助解决问题,请建议您认为thr问题源自何处(即机器人,L& F,或MenuBar,或其他)。我会发布所需的一切。
编辑:我已经做了一些更多的探索,它似乎只在选择任何菜单时发生,然后我将鼠标悬停在屏幕截图菜单上。我的猜测只是因为它没有显示的MenuItems,但我可能是错的。不过,我仍然不知道如何解决这个问题。
这是错误日志:
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)
答案 0 :(得分:0)
这是Substance中的一个错误,它基于JGoodies中的旧代码。 Kirill拍摄了一张较旧的ShadowPopup快照,它没有代码来检查零宽度或高度等内容。 Current versions of ShadowPopup查找该错误并正确处理。