Opened 10 years ago

Closed 10 years ago

#455 closed defect (fixed)

GraphWindow calls (such as peel off) doesn't work in GUI apps

Reported by: anonymous Owned by:
Priority: minor Milestone:
Component: sha Version:
Keywords: HazardSpectrumLocal Cc:

Description

Steps to reproduce: (PLEASE FILL IN)

Clicked Peel off after generating curves

Other info: (PLEASE FILL IN)

Application: HazardSpectrumLocal?
Version: 1.3.0
Bulid Type: Production
Java Version: 1.7.0_51 (Oracle Corporation)
Operating System: Windows 7 (arch: x86, version: 6.1)

Exception:

java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread
	at java.awt.EventQueue.invokeAndWait(Unknown Source)
	at java.awt.EventQueue.invokeAndWait(Unknown Source)
	at javax.swing.SwingUtilities.invokeAndWait(Unknown Source)
	at org.opensha.commons.gui.plot.GraphWindow.<init>(GraphWindow.java:167)
	at org.opensha.commons.gui.plot.GraphWindow.<init>(GraphWindow.java:94)
	at org.opensha.sha.gui.HazardCurveApplication.peelOffCurves(HazardCurveApplication.java:2197)
	at org.opensha.sha.gui.HazardCurveApplication.actionPerformed(HazardCurveApplication.java:686)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(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.pro

Change History (2)

comment:1 Changed 10 years ago by Kevin Milner

Summary: Bug in HazardSpectrumLocalGraphWindow calls (such as peel off) doesn't work in GUI apps

Thanks for the bug report! This has been fixed in revision [10601], and I just re-released our applications with this fix as version 1.3.1.

Technical description of the change for our records:

The recent changes to GraphWindow? for thread safety in a main class (which fixed the random crashes Ned was getting) made GraphWindow? not work when called from a GUI thread. We had wrapped calls in SwingUtilities?.invokeAndWait(...), but that doesn't work when on the Event Dispatch Thread. I wrapped those calls with a SwingUtilities?.isEventDispatchThread() call which, if true, will execute the code directly.

comment:2 Changed 10 years ago by Kevin Milner

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.