OpenBLCMM icon indicating copy to clipboard operation
OpenBLCMM copied to clipboard

Allow theme switching while OE / Edit Dialog is open

Open apocalyptech opened this issue 1 year ago • 0 comments

Right now, BLCMM disallows switching theme when OE or edit dialogs are open. If you try it, you can get a variety of Exceptions depending on what you do next. For instance, mousing over the OE tabs will generate an exception out of JTabbedPane:

java.lang.NullPointerException: Cannot invoke "javax.swing.JTabbedPane.getLayout()" because "this.tabPane" is null
	at java.desktop/javax.swing.plaf.basic.BasicTabbedPaneUI.scrollableTabLayoutEnabled(BasicTabbedPaneUI.java:332)
	at java.desktop/javax.swing.plaf.basic.BasicTabbedPaneUI.tabForCoordinate(BasicTabbedPaneUI.java:1740)
	at java.desktop/javax.swing.plaf.basic.BasicTabbedPaneUI.setRolloverTab(BasicTabbedPaneUI.java:682)
	at java.desktop/javax.swing.plaf.basic.BasicTabbedPaneUI$Handler.mouseEntered(BasicTabbedPaneUI.java:4122)
	at java.desktop/javax.swing.plaf.synth.SynthTabbedPaneUI$1.mouseEntered(SynthTabbedPaneUI.java:301)
	at blcmm.gui.components.VariableTabsTabbedPane$MouseListenerWrapper.mouseEntered(VariableTabsTabbedPane.java:285)

Or clicking on the main text area of OE or an edit dialog, you'd end up with this exception in JTextComponent:

2023-08-04 13:59:08 blcmm.Startup$MyExceptionHandler.logError(Startup.java:405) -> class java.lang.NullPointerException: Cannot invoke "javax.swing.text.JTextComponent.putClientProperty(Object, Object)" because "comp" is null
    java.desktop/sun.swing.SwingUtilities2.getAdjustedClickCount(SwingUtilities2.java:1973)
    java.desktop/javax.swing.text.DefaultCaret.mousePressed(DefaultCaret.java:542)
    blcmm.gui.text.HighlightedTextArea$4.mousePressed(HighlightedTextArea.java:470)

I've tried poking at it a bit, thinking maybe there were some calls to JComponent.updateUI() which needed to be made, or something, but in the end I wasn't able to find much and it seemed like a lot of voodoo to me. So, whatever, I'm leaving it for now. Would be nice to figure out someday, though!

apocalyptech avatar Aug 04 '23 19:08 apocalyptech