We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Processing and Swing
Page Index Toggle Pages: 1
Processing and Swing (Read 2128 times)
Processing and Swing
May 29th, 2009, 8:03am
 
Hi there,

I'm using Eclipse right now, to code my Processing Apps. At the moment some sample-code looks like this:

Code:

public class myApp extends PApplet{
 Drawer myDrawer = new Drawer();
 
 public void setup(){
   size(500,600);
   frameRate(30);
 }

 public void draw(){
   background(185,165,255);
   myDrawer.update();
 }

 class Drawer
 {
   ... (class for my drawings) ...
 }
}



My question is: Can I Implement a simple GUI (mybe with java.swing), to change Properties of my painting, e.g. color by hand.
Re: Processing and Swing
Reply #1 - May 29th, 2009, 9:21am
 
Yes.
I've done this before using NetBeans.

My idea was to put a java.awt.Panel into a javax.swing.JFrame and add the extended PApplet into that Panel.

The JFrame has to contain a reference to the extended PApplet, so you can call methods of the PApplet from the JFrame.
Re: Processing and Swing
Reply #2 - May 29th, 2009, 9:22am
 
Look at Libraries > Graphic Interface.
AFAIK, the GUI have to be drawn using Processing's methods.
AWK or Swing doesn't mix well with Processing, perhaps because of threading and event handling issues.
There was an AWT GUI library in the past, nice because you could paste text in the text fields, for example, but it have been phased out for the latest versions, probably not working well anymore.
Re: Processing and Swing
Reply #3 - May 29th, 2009, 10:08am
 
also check out:
http://processing.org/hacks/hacks:swingsliders
Re: Processing and Swing
Reply #4 - May 29th, 2009, 11:06am
 
Heyyy, thanks a lot...  Grin

I check the swingsliders hacks out and try it.

CYA
Page Index Toggle Pages: 1