Loading...
Logo
Processing Forum
Hello everyone, first post here :) I have some programming knowledge but I am still quite unexperienced relatively to bigger projects. I am now designing a human-computer interface for disabled people based on eye movement through electrooculogrpahy ( http://en.wikipedia.org/wiki/Electrooculography) as my research thesis. 

Decided to go with Processing to design the GUI. I am doing a whole interface based on looking up, down, left, right, diagonals (up-right, down-right, etc.) and blinking. So far I have done a text input interface and a system to select editable preset sentences. I'd like to go further and at least include a web browser and a mouse controller. I've seen both of these being done.

I'm now trying to implement the web browser. I have come to find a solution based on Native Swing and another based on JDIC. If I could properly implement the Native Swing option it would be awesome since it would allow to implement a media player, etc.

Anyone had any experience with using  Native Swing in Processing? I haven't been able to implement even the simplest functions:
Copy code
  1. import java.awt.*;
  2. import java.awt.event.*;
  3. import javax.swing.*;
  4. import chrriis.dj.nativeswing.swtimpl.*;
  5.   
  6. void setup() {
  7.     size(800,600);
  8.   NativeInterface.open();
  9.   NativeSwing.initialize();

  10.   JWebBrowser webbrowser = new JWebBrowser();
  11.   webbrowser.navigate("http://www.test.com");
When I try to call the "webbrowser.navigate()" I get "IllegalStateException: This call must happen in the AWT Event Dispatch Thread". I realize that processing has problems with swing. Do I have to go full-blown java to do this? Like  http://processing.org/hacks/hacks:swingsliders ?


As for the JDIC I found watz's code ( http://workshop.evolutionzone.com/2008/09/06/multiple-jdic-browsers-in-processing-sketch/) for embedding 4 windows.
-To begin with I allways get a "Cannot find a class or type name "BrowserEngineManager"" and I've tried like three different releases of JDIC... 
-If I comment lines 43 and 44 the applet runs but I cannot choose which browser to use and the presentation does not display the 2X2 grid it's suposed. I get a 3X2 grid with the top-left and bottom-right cells simply in grey. And yeah, I just want browser window and maybe some room to put my GUI in.

Any tips?

Edit: yeah, I'm running 1.2.1 on Win7 and the latest releases of JDIC, SWT and Native Swing

Replies(4)

I'm not expert in this, but I saw that nobody had replied to your question, so I thought I could at least provide some links:

I have successfully compiled and run the Kite example... it works fine.

here's an old discussion:

As I recall from earlier research, the powers that be (Fry, Reas) dislike Swing generally.  Most GUI work around here seems to be with ControlP5 or the other Processing GUI libraries.

Hope this helps.
" the powers that be (Fry, Reas) dislike Swing generally"
They don't dislike (necessarily) Swing, Processing is an AWT applet, and Swing's threading model (EDT) doesn't mix well with Processing's one.
gotcha, phi.lho... I just remember Fry calling Swing " a bloated piece of crap" on more than one occasion.  :)

seriously, though, I've been looking at Swing recently... I am getting a big kick out of Processing these days, and I'm interested in using it in a more conventional software GUI context.  Might just use processing.js and JQuery UI, though... that looks like a sexy combo, at least for the web.  Or maybe Python-QT and Processing.py...
Yes, I remember these comments (also in the code), that's why I added the "(necessarily)"...
Ie. I just wanted to say that they don't block Swing because they dislike it, but it is blocked because of the architecture of the software.