We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am currently updating my Presenter Tool to Processing 3. It opens several Sketches and triggers open Editors to presentation mode.
Therefore i am collecting all open Editors:
List <Editor> editors = base.getEditors();
In Processing 2 i could cast the Editor to a JavaEditor and call handlePresent(): JavaEditor je = (JavaEditor)editors.get( (int)random( editors.size()-1 ) ); je.handlePresent();
Unfortunately this raises a ClassCastException in Processing 3:
java.lang.ClassCastException: processing.mode.java.JavaEditor cannot be cast to processing.mode.java.JavaEditor
Eclipse does not raise an error. The error shows when opening the tool in Processing 3.
Any ideas? Tomorrow's semester presentation.
Answers
Update: My tool code didn't find
import processing.mode.java.*;
So i compiled processing-java and added the .jar to the libs of the tool.
If i remove the .jar Processing does not find processing.mode.java.* when opening the tool:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: processing/mode/java/JavaEditor
I also couldn't
import processing.mode.java.JavaEditor;
in both P3 & P2.So I couldn't help you. However, there's a little logic error in this expression here:
(int) random( editors.size() - 1 )
.The last Editor item of that List won't ever be randomly picked! @-)
Just remove the minus 1
- 1
there:(int) random( editors.size() )
. ;)JavaEditor worked in my case in P2. The tool worked like a charm.