I was facing the non transparent shadows issue (#79) for menus.
Trying to remove both shade and rounded corners causes some dimensions to become negative.
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Width (0) and height (0) cannot be <= 0
at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1016)
at java.awt.image.BufferedImage.<init>(BufferedImage.java:340)
at com.alee.utils.NinePatchUtils.createShadeIcon(NinePatchUtils.java:86)
at com.alee.utils.NinePatchUtils.getShadeIcon(NinePatchUtils.java:65)
at com.alee.laf.menu.WebPopupPainter.paintShade(WebPopupPainter.java:478)
at com.alee.laf.menu.PopupMenuPainter.paintTransparentPopup(PopupMenuPainter.java:53)
at com.alee.laf.menu.PopupMenuPainter.paintTransparentPopup(PopupMenuPainter.java:30)
at com.alee.laf.menu.WebPopupPainter.paint(WebPopupPainter.java:421)
at com.alee.laf.menu.WebPopupMenuUI.paint(WebPopupMenuUI.java:740)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
at javax.swing.JComponent.paintComponent(JComponent.java:778)
at javax.swing.JComponent.paint(JComponent.java:1054)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:585)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5219)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1529)
at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1452)
at javax.swing.RepaintManager.paint(RepaintManager.java:1249)
at javax.swing.JComponent._paintImmediately(JComponent.java:5167)
at javax.swing.JComponent.paintImmediately(JComponent.java:4978)
at javax.swing.RepaintManager$3.run(RepaintManager.java:808)
at javax.swing.RepaintManager$3.run(RepaintManager.java:796)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:796)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:769)
at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:718)
at javax.swing.RepaintManager.access$1100(RepaintManager.java:62)
at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1677)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
My code
// initialize menu, works well
WebMenuBar menuBar = new WebMenuBar ();
setupMenuBar ( menuBar );
WebMenu fileMenu = (WebMenu) menuBar.getMenu(0);
WebPopupMenuUI popupMenu = (WebPopupMenuUI) fileMenu.getPopupMenu().getUI();
// set round and shade, causes error when both options are set to zero
popupMenu.setRound(0);
popupMenu.setShadeWidth(0);
And, though I don't think the error has something to do with it, the setup code for the menu.
public void setupMenuBar ( WebMenuBar menuBar )
{
menuBar.add ( new WebMenu ( "File") {
{
add ( new WebMenuItem ( "Load file") {
{
setAccelerator ( Hotkey.CTRL_O );
addActionListener(new FileLoadAction());
}
} );
}
} );
}
I was facing the non transparent shadows issue (#79) for menus.
Trying to remove both shade and rounded corners causes some dimensions to become negative.
My code
And, though I don't think the error has something to do with it, the setup code for the menu.