Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sim Control Panel Find Next and Find Previous buttons are greyed out in Trick 19 #1826

Open
miltondean opened this issue Jan 7, 2025 · 4 comments · May be fixed by #1827
Open

Sim Control Panel Find Next and Find Previous buttons are greyed out in Trick 19 #1826

miltondean opened this issue Jan 7, 2025 · 4 comments · May be fixed by #1827
Assignees

Comments

@miltondean
Copy link

The Sim Control Panel in Trick 19.5.1 does not allow the user to select the Find Next or Find Previous buttons. These buttons were enabled and working in the Trick 17.4.0 version.

@miltondean miltondean changed the title Sim Control Panel Find Next and Find Previous buttons are greyed out on Trick 19 Sim Control Panel Find Next and Find Previous buttons are greyed out in Trick 19 Jan 7, 2025
@miltondean
Copy link
Author

When you insert any characters into the Find: box, it produces these messages:
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: class java.util.regex.Matcher$ImmutableMatchResult cannot be cast to class java.util.regex.Matcher (java.util.regex.Matcher$ImmutableMatchResult and java.util.regex.Matcher are in module java.base of loader 'bootstrap')
at org.jdesktop.swingx.JXEditorPane$DocumentSearchable.updateStateAfterFound(JXEditorPane.java:740)
at org.jdesktop.swingx.JXEditorPane$DocumentSearchable.search(JXEditorPane.java:668)
at org.jdesktop.swingx.JXFindPanel.doSearch(JXFindPanel.java:211)
at org.jdesktop.swingx.JXFindPanel.doFind(JXFindPanel.java:191)
at org.jdesktop.swingx.JXFindPanel.match(JXFindPanel.java:157)
at org.jdesktop.swingx.AbstractPatternPanel.refreshPatternFromModel(AbstractPatternPanel.java:255)
at org.jdesktop.swingx.AbstractPatternPanel$1.propertyChange(AbstractPatternPanel.java:300)
at java.desktop/java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:343)
at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:335)
at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:268)
at org.jdesktop.swingx.search.PatternModel.firePropertyChange(PatternModel.java:316)
at org.jdesktop.swingx.search.PatternModel.updatePattern(PatternModel.java:274)
at org.jdesktop.swingx.search.PatternModel.setRawText(PatternModel.java:234)
at org.jdesktop.swingx.AbstractPatternPanel.refreshModelFromDocument(AbstractPatternPanel.java:343)
at org.jdesktop.swingx.AbstractPatternPanel$3.insertUpdate(AbstractPatternPanel.java:373)
at java.desktop/javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:226)
at java.desktop/javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:780)
at java.desktop/javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:739)
at java.desktop/javax.swing.text.PlainDocument.insertString(PlainDocument.java:131)
at java.desktop/javax.swing.text.AbstractDocument.replace(AbstractDocument.java:698)
at java.desktop/javax.swing.text.JTextComponent.replaceSelection(JTextComponent.java:1339)
at java.desktop/javax.swing.text.DefaultEditorKit$DefaultKeyTypedAction.actionPerformed(DefaultEditorKit.java:884)
at java.desktop/javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1810)
at java.desktop/javax.swing.JComponent.processKeyBinding(JComponent.java:2947)
at java.desktop/javax.swing.JComponent.processKeyBindings(JComponent.java:2995)
at java.desktop/javax.swing.JComponent.processKeyEvent(JComponent.java:2909)
at java.desktop/java.awt.Component.processEvent(Component.java:6403)
at java.desktop/java.awt.Container.processEvent(Container.java:2266)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
at java.desktop/java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1952)
at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:883)
at java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1150)
at java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:1020)
at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:848)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4882)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:746)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:743)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

We are running:
java -version
openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment 21.9 (build 17.0.2+8)
OpenJDK 64-Bit Server VM 21.9 (build 17.0.2+8, mixed mode, sharing)

@hchen99
Copy link
Contributor

hchen99 commented Jan 7, 2025

It seems like the issue is coming from the Java library code itself. You don't encounter the error with the same OpenJDK version when using Trick 17.4.0? Will investigate this further.

@miltondean
Copy link
Author

FYI,
The version of java we are using for the Trick 17 version is :
java -version
openjdk version "1.8.0_362"
OpenJDK Runtime Environment (build 1.8.0_362-b08)
OpenJDK 64-Bit Server VM (build 25.362-b08, mixed mode)

@hchen99
Copy link
Contributor

hchen99 commented Jan 8, 2025

Thanks for the info.

It turns out that the built-in matcher in the Java Swing GUI component for the status area calls a method to find a match and return the result. This matching process involves creating a new matcher instance with the state copied over. However, since JDK 9, the matcher result is an instance of a non-public class (new since JDK 9) within the matcher that cannot be cloned, thus the exception.

I used to have JDK 8 but not anymore. However, I observed the issue while testing JDK 11 and JDK 21 on my machine.

We'll need to have a customized approach to return the match results for Java Swing's JXEditorPane.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants