Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

IChart#addMouseListene does not work in JForex SDK
 Post subject: IChart#addMouseListene does not work in JForex SDK Post rating: 0   Post Posted: Wed 16 Oct, 2013, 22:20 
User avatar

User rating: 7
Joined: Fri 13 Jan, 2012, 20:49
Posts: 94
Location: Poland, Warsaw
Hello Support,

Custom mouse listener added to a chart in JForex Platform works correctly however adding a listener a chart in SDK causes exceptions on every mouse action over the chart.

Issue can by reproduced by starting attached code. The code comes from JForex Wiki, the only changes are added usr/pwd and mouse listener in line 188.

Exception:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
   at com.dukascopy.charts.wrapper.StrategyThreadDelegatableMouseListener.mouseEntered(StrategyThreadDelegatableMouseListener.java:69)
   at com.dukascopy.charts.view.swing.AbstractChartPanelView$1.mouseEntered(AbstractChartPanelView.java:91)
   at java.awt.AWTEventMulticaster.mouseEntered(AWTEventMulticaster.java:283)
   at java.awt.Component.processMouseEvent(Component.java:6306)
   at javax.swing.JComponent.processMouseEvent(JComponent.java:3275)
   at java.awt.Component.processEvent(Component.java:6062)
   at java.awt.Container.processEvent(Container.java:2039)
   at java.awt.Component.dispatchEventImpl(Component.java:4660)
   at java.awt.Container.dispatchEventImpl(Container.java:2097)
   at java.awt.Component.dispatchEvent(Component.java:4488)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4575)
   at java.awt.LightweightDispatcher.trackMouseEnterExit(Container.java:4364)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4218)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4166)
   at java.awt.Container.dispatchEventImpl(Container.java:2083)
   at java.awt.Window.dispatchEventImpl(Window.java:2489)
   at java.awt.Component.dispatchEvent(Component.java:4488)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:668)
   at java.awt.EventQueue.access$400(EventQueue.java:81)
   at java.awt.EventQueue$2.run(EventQueue.java:627)
   at java.awt.EventQueue$2.run(EventQueue.java:625)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
   at java.awt.EventQueue$3.run(EventQueue.java:641)
   at java.awt.EventQueue$3.run(EventQueue.java:639)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:638)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Best regards,
Kurak


 
 Post subject: Re: IChart#addMouseListene does not work in JForex SDK Post rating: 0   Post Posted: Fri 18 Oct, 2013, 14:54 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
You are electing the listener to work synchronously with the strategy thread, while adding the listener from outside the strategy - a strategy which does not exist at the moment of the method call. Hence, in such case you should use asynchronous=true.
See the description of the asynchronous parameter:
https://www.dukascopy.com/client/javadoc/com/dukascopy/api/IChartPanel.html#addMouseListener(boolean,%20com.dukascopy.api.chart.mouse.IChartPanelMouseListener)


 

Jump to:  

  © 1998-2026 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com