You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "com.github.weisj.darklaf.ui.popupmenu.PopupMenuContainer.adjustSize(java.awt.Dimension, int, int)" because the return value of "com.github.weisj.darklaf.ui.popupmenu.DarkPopupMenuUI.getPopupMenuContainer()" is null
at com.github.weisj.darklaf.ui.popupmenu.DarkPopupMenuUI.getPreferredSize(DarkPopupMenuUI.java:135)
at java.desktop/javax.swing.JComponent.getPreferredSize(JComponent.java:1725)
at com.github.weisj.darklaf.ui.tabbedpane.DarkScrollableTabSupport.actionPerformed(DarkScrollableTabSupport.java:92)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
at com.github.weisj.darklaf.ui.button.DarkButtonListener.mouseReleased(DarkButtonListener.java:72)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6626)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
at java.desktop/java.awt.Component.processEvent(Component.java:6391)
From the code we can see that getPopupMenuContainer() can return null when popupMenu is ScrollPopupMenu
So, when popupMenu is ScrollPopupMenu getPopupMenuContainer always returns null.
This happens when creating many JTabbedPane and they require a popup menu to show.
When click on the popup menu to show the hidden tabs the exception is thrown.
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.WindowConstants;
public class BugPopupMenu {
public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException
{
UIManager.setLookAndFeel("com.github.weisj.darklaf.DarkLaf");
JFrame frame = new JFrame();
SwingUtilities.updateComponentTreeUI(frame);
JTabbedPane panel = new JTabbedPane();
panel.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
for (int idx = 0; idx < 100; idx++)
panel.addTab("Tab " + idx, new JPanel());
frame.getContentPane().add(panel);
frame.setSize(600, 500);
frame.setVisible(true);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
}
Additional Information:
OS: [e.g. macOS]
Darklaf Version: [e.g. 2.7.3]
The text was updated successfully, but these errors were encountered:
Describe the bug
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "com.github.weisj.darklaf.ui.popupmenu.PopupMenuContainer.adjustSize(java.awt.Dimension, int, int)" because the return value of "com.github.weisj.darklaf.ui.popupmenu.DarkPopupMenuUI.getPopupMenuContainer()" is null
at com.github.weisj.darklaf.ui.popupmenu.DarkPopupMenuUI.getPreferredSize(DarkPopupMenuUI.java:135)
at java.desktop/javax.swing.JComponent.getPreferredSize(JComponent.java:1725)
at com.github.weisj.darklaf.ui.tabbedpane.DarkScrollableTabSupport.actionPerformed(DarkScrollableTabSupport.java:92)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
at com.github.weisj.darklaf.ui.button.DarkButtonListener.mouseReleased(DarkButtonListener.java:72)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6626)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
at java.desktop/java.awt.Component.processEvent(Component.java:6391)
From the code we can see that getPopupMenuContainer() can return null when popupMenu is ScrollPopupMenu
So, when popupMenu is ScrollPopupMenu getPopupMenuContainer always returns null.
To Reproduce
This happens when creating many JTabbedPane and they require a popup menu to show.
When click on the popup menu to show the hidden tabs the exception is thrown.
Additional Information:
The text was updated successfully, but these errors were encountered: