Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Strange exception when mouse passes over JEditorPane's scrollbar

 
Stephane Weber
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am finalizing my assignment, writing the docs. I just got one error that I still have to solve before considering my project as finished.
My online help is designed with frames. The help frame is separated in two : the menu on the left, the contents on the right. As the contents can be large, sometimes a Scrollbar appears on this right frame. So far, nothing strange
The strange thing is when I go to the right of the scrollbar with my mouse (without even clicking, just passing over that scrollbar), I get an exception from the EventDispatchThread class (a null pointer exception to be exact). I don't know from where it comes and it simply crashed my client.
Does anybody know what this is ?
Thanks for your help,
Stephane
[ October 23, 2002: Message edited by: St�phane Weber ]
 
Andrea Gazzarini
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is contained in your scrollpane??
If you minimize the frame (the one that contains the scrollpane)and then maximize again is it completely displayed ?
Probably the JVM tries to repaint a null component or sub component.
Greetings
 
Stephane Weber
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andrea,
Yes when I minimize and then maximize, everything displays fine. But I still got this disturbing behavior.
The content of my scrollpane is an editorpane, built with an HTML file, index.html. here is the contents :

Do you see the problem ?
 
Andrea Gazzarini
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, excuse me for my english...
The HTML files were found correctly and were displayed ??
Do you have an IDE with a debugger when you can specify an exception-breakpoint (like IBM VisualAge for Java)?? It is very very useful in this situation...
I don't think I haven't been so helpful...
Greetings
 
Stephane Weber
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't see any problems with your English, don't worry
I am using an IDE (JBuilder) and can thus use a debugger. The problem is I don't even know where this exception is thrown. And besides it is happening only when my HTML files contain frames. I tested the same code with only a simple HTML file, and it worked fine.
Stephane
 
Stephane Weber
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some new information : apparently the error is generated by the HTMLEditorKit used to parse the HTML ...
[CODE]
java.lang.NullPointerException
at javax.swing.text.html.HTMLEditorKit$LinkController.doesElementContainLocation(HTMLEditorKit.java:733)
at javax.swing.text.html.HTMLEditorKit$LinkController.mouseMoved(HTMLEditorKit.java:631)
at java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:268)
at java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:267)
at java.awt.Component.processMouseMotionEvent(Component.java:5066)
at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:2763)
at java.awt.Component.processEvent(Component.java:4822)
at java.awt.Container.processEvent(Container.java:1525)
at java.awt.Component.dispatchEventImpl(Component.java:3526)
at java.awt.Container.dispatchEventImpl(Container.java:1582)
at java.awt.Component.dispatchEvent(Component.java:3367)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3359)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3087)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3004)
at java.awt.Container.dispatchEventImpl(Container.java:1568)
at java.awt.Window.dispatchEventImpl(Window.java:1581)
at java.awt.Component.dispatchEvent(Component.java:3367)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:191)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
[CODE]
Does anyone have an idea ?
 
Stephane Weber
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have now found a workaround for this problem. I created my own MyHtmlEditorKit, basically just overriding the MouseMoved method of the nested LinkController class with an empty body.
And there it works.
The exception I received is thus well thrown by this method. But why I don't know.
1. Does anybody have an idea ?
2. Is it acceptable to have such a workaround in my code for just bypassing one method ?
P.S. I wrongfully stated before that this error crashed my client. In fact, it doesn't crash it, it just adds stacktraces to the standard output. And the workaround I describe hereabove is the only way I found so far for avoiding this display.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic