0

Our applet source code is kind of spaghetti (written in 2000, Java 1.3 then) and we want to recompile it to Java 1.6 or 1.7.

When I'm testing it, most of the Swing is OK but after sometime, an Exception occurred, which is EDT exception. Specifically, when a drag event is done, a series of EDT exceptions appear.

Is this something to with coding the I/O part in ActionListeners because I've read that it is bad to code I/O operations in action listeners, which EDT executes when a action is performed.

EDIT:

This is the recurring exception

Exception in thread "AWT-EventQueue-3" java.lang.NullPointerException
    at javax.swing.BufferStrategyPaintManager.flushAccumulatedRegion(Unknown Source)
    at javax.swing.BufferStrategyPaintManager.copyArea(Unknown Source)
    at javax.swing.RepaintManager.copyArea(Unknown Source)
    at javax.swing.JViewport.blitDoubleBuffered(Unknown Source)
    at javax.swing.JViewport.windowBlitPaint(Unknown Source)
    at javax.swing.JViewport.setViewPosition(Unknown Source)
    at javax.swing.plaf.basic.BasicScrollPaneUI$Handler.vsbStateChanged(Unknown Source)
    at javax.swing.plaf.basic.BasicScrollPaneUI$Handler.stateChanged(Unknown Source)
    at javax.swing.DefaultBoundedRangeModel.fireStateChanged(Unknown Source)
    at javax.swing.DefaultBoundedRangeModel.setRangeProperties(Unknown Source)
    at javax.swing.DefaultBoundedRangeModel.setValue(Unknown Source)
    at javax.swing.JScrollBar.setValue(Unknown Source)
    at javax.swing.plaf.basic.BasicScrollBarUI$TrackListener.setValueFrom(Unknown Source)
    at javax.swing.plaf.basic.BasicScrollBarUI$TrackListener.mouseDragged(Unknown Source)
    at java.awt.Component.processMouseMotionEvent(Unknown Source)
    at javax.swing.JComponent.processMouseMotionEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$000(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$2.run(Unknown Source)
    at java.awt.EventQueue$2.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
ton
  • 355
  • 3
  • 13
  • It's most likely due to a non-EDT thread accessing UI code. UI code should only ever be accessed by the EDT. Regarding IO, no the EDT should rarely do this - have a look at `SwingWorker` for IO code. – Muel Nov 20 '12 at 09:09
  • How does a drag action cause I/O? If it is for something like 'the Icon to show when dragged', then the icon should be loaded at start-up. – Andrew Thompson Nov 22 '12 at 06:23
  • 1
    the exception is caused by draging a scrollbar or resizing a table column using drag motion... i added the exception stack.. thanks for – ton Nov 26 '12 at 06:25
  • is this something to do with the applet not packaged in jar.. because what we did was embed the class file directly on the html file – ton Nov 26 '12 at 06:35

1 Answers1

1

I guess it has something to do with the version of java plugin. In java 1.6_10, a new version of this plugin is release, i just disabled the option in java found in control panel Advance->Java Plug In ->Enable the next generation Java Plug in

When i disable this, this recurring error with no distinct behavior no longer appears.

I guess also it has something to do with our code written in the days of Java 1.3.

ton
  • 355
  • 3
  • 13