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 & HelpOther Libraries › What should I do to use "import java.applet.*
Page Index Toggle Pages: 1
What should I do to use "import java.applet.* (Read 2004 times)
What should I do to use "import java.applet.*
Mar 28th, 2007, 6:09am
 
I always come across error when I need to run this line. What should I do? Thanks a lot!!
Re: What should I do to use "import java.appl
Reply #1 - Mar 28th, 2007, 6:29pm
 
Do I have to download any library or plugins?
Re: What should I do to use "import java.appl
Reply #2 - Mar 28th, 2007, 7:44pm
 
java.applet is a default java thing.. you shouldn't need to do anything..

Also, what are you trying to do that causes you to need to import that?
Re: What should I do to use "import java.appl
Reply #3 - Mar 29th, 2007, 7:25am
 
Thanks for replying:-)
This is the begining of a code I found on web:

import java.applet.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;
import java.util.zip.*;
import netscape.javascript.*;
import javax.comm.*;
import javax.sound.midi.*;
import javax.sound.midi.spi.*;
import javax.sound.sampled.*;
import javax.sound.sampled.spi.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.sax.*;
import javax.xml.transform.stream.*;
import org.xml.sax.*;
import org.xml.sax.ext.*;
import org.xml.sax.helpers.*;

When I want to run it, it shows that the first line can't be executed. I've downloaded the newest Java but it doesn't help. Pleeese help me!!
Re: What should I do to use "import java.appl
Reply #4 - Mar 29th, 2007, 8:24am
 
Processing already adds quite a fe of those to your code when you hit go.

That is pure java code, processing is a layer on top of java, so pure java examples you find on the web aren't going to "just work" inside processing.

If you want to use that code, don't use processing, use something like eclipse which is just a normal Java compiler/editor.

If you want to use procesing, look for specific processing examples to learn from, not normal java ones.
Re: What should I do to use "import java.appl
Reply #5 - Mar 29th, 2007, 10:42pm
 
Oh! Thanks a lot!
Re: What should I do to use "import java.appl
Reply #6 - Jun 1st, 2007, 11:46am
 
Quote:
Processing already adds quite a fe of those to your code when you hit go.

That is pure java code, processing is a layer on top of java, so pure java examples you find on the web aren't going to "just work" inside processing.

If you want to use that code, don't use processing, use something like eclipse which is just a normal Java compiler/editor.

If you want to use procesing, look for specific processing examples to learn from, not normal java ones.

dear johnG, i think the code that junejuly quote is from http://www.ghostagency.net/processing/glow/glow.java for the project on
http://www.ghostagency.net/processing/glow/

but seems this project is made by processing, if not, or can you give me some instructions on how to do "glow " effects?

i am new to processing.

thanks
Re: What should I do to use "import java.appl
Reply #7 - Jun 1st, 2007, 12:38pm
 
The .java is something that processing creates from .pde files. When you export a sketch as an applet, processing combines the .pde files, adds some stuff to the top of them, and then builds it. So whilst the .java is created it's not the "source" in processing terms, the source is the .pde files. It looks like that site uploaded the .java file which processing created, instead of the .pde.
Re: What should I do to use "import java.appl
Reply #8 - Jun 1st, 2007, 3:17pm
 
This is the back-converted java source to pde of glow  :


Quote:
//by Alessandro Capozzo - GHOSTAGENCY.NET
// 6 November 2003

Ball [] cont;
float n=0.00f;
float q=0.03f;
int num=5;
float dens;
float nnn;
int nn;

void setup() {
 size(200,200,P3D);
 frameRate(60);
 cont=new Ball[num];
 for (int index = 0; index < num; index++) {
   cont[index]=new Ball(10/((25.5f)*(index+1)),100,100,15);
loadPixels();
 }

}

void draw() {
 background(250);
 n=n+0.1f;
 for (int index = 0; index < num; index++){
   cont[index].update();
 }

 for (int _x = 0; _x < width; _x++) {
   for (int _y = 0; _y < height; _y++) {
     dens = 0;
     for (int res = 0; res <num; res++) {
       dens +=cont[res].dim/(sqrt(sq(_x - cont[res].bx) + sq(_y - cont[res].by)));
     }
     nn=(int)((dens)*(150));
     nnn=50*( noise(_x*q,_y*q,n));

     int c=color(nn-nnn,(nn-nnn)*0.8f,(nn-nnn)*0.5f);
     pixels[_y*width+_x] =c;

   }
 }
updatePixels();
}

class Ball {
 int bx,by;
 int difX,difY;
 int dim;
 float xSpeed,ySpeed,ndelay;

 Ball(float d,int initX,int initY,int magnitude){
   ndelay=d;
   bx=initX;
   by=initY;
   difX=0;
   difY=0;
   xSpeed=0.00f;
   ySpeed=0.00f;
   dim=magnitude;

 }
 void update (){
   difX=mouseX-bx;
   difY=mouseY-by;
   xSpeed+=difX*ndelay;
   ySpeed+=difY*ndelay;
   xSpeed*=.9f;
   ySpeed*=.9f;
   bx+=xSpeed;
   by+=ySpeed;

 }
}


It is possible with a little knowledge to reverse to pde from a java generated source from processing.
Page Index Toggle Pages: 1