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 › Non-applet based java application!
Page Index Toggle Pages: 1
Non-applet based java application! (Read 528 times)
Non-applet based java application!
Jun 26th, 2009, 1:24pm
 
Hey guys, I started using processing to make an applet but then soon realized that my app would be better off as a basic java application (with all the security issues and headache). SO, I wana keep using processing but keep running into problems because I want my primary GUI to extend a JFrame instead of a PApplet. I tried creating PGraphics separately but nothing seems to be working right now.

Does anyone know how to get started on this? My first attempt looked something like this... (Please note I just typed this code out so you can see what I'm doing conceptually. It doesn't actually work.)

Code:
public ProcessingScreen extends JPanel
{
PGraphics graphics = new PGraphics();

protected void paint(Graphics g)
{
if (graphics.width!=getWidth() || graphics.height!=getHeight())
graphics.setSize(getWidth(), getHeight());

graphics.text("draw some text");
g.drawImage(graphics.getImage(), 0,0);
}
}

Re: Non-applet based java application!
Reply #1 - Jun 28th, 2009, 12:59am
 
Unless you really need a JPanel for something, I would recommend just exporting your sketch as an application (from the File menu).

Otherwise, follow this example of embedding a PApplet into another application:
http://dev.processing.org/reference/core/javadoc/processing/core/PApplet.html
Page Index Toggle Pages: 1