Martedi' 15 Ottobre 2002 : 14 23 3 - Anonimo da labmul15.fisica.uniba.it 193.204.188.74
import java.awt.*;
import javax.swing.*;

public class Ovale extends JApplet {

Display disegno;
double r,r1,spessore,rcavanti,rcdietro,xcavanti,xcdietro;
double rcravanti,rcrdietro,xcravanti,xcrdietro;
Image img;
double xmin,xmax,ymin,ymax;
public void init(){
xmin = -5.0;//mm
xmax = 42.0;ymin = -20.5;ymax = 27.5;
img=getImage(getCodeBase(),"eye.gif");

disegno = new Display(this);
setContentPane(disegno);
r=12.8 ;r1=11.8;spessore=.5;
xcavanti=-2.5;xcdietro=-2.1; rcavanti=7.25; rcdietro=5.68;
xcravanti=1.1;xcrdietro=-8.1; rcravanti=9.67; rcrdietro=6.32;
disegno.setBackground(Color.yellow);
}
class Display extends JPanel {
int larghezza, altezza;
Ovale appl;
Display(Ovale appl1){appl=appl1;}
public void paintComponent(Graphics g){
larghezza = getSize().width;
altezza = getSize().height;
super.paintComponent(g);
//g.drawImage(img,5,152, this);
g.setColor(Color.black);
g.drawLine(xconv(xmin),yconv(0.),xconv(xmax),yconv(0.));
g.drawLine(xconv(0.),yconv(ymin),xconv(0.),yconv(ymax));
g.setColor(Color.black);
//System.out.println(xconv(0.)+" "+yconv(r)+" "+xconv(2*r)+" "+yconv(-r));
g.drawArc(xconv(-spessore/2.),yconv(r),xconv(2*r-spessore/2.)-xconv(-spessore/2.),yconv(-r)-yconv(r),210,300);
g.drawArc(xconv(spessore/2.),yconv(r1),xconv(2*r1+spessore/2.)-xconv(spessore/2.),yconv(-r1)-yconv(r1),210,300);
g.setColor(Color.red);
g.drawArc(xconv(xcavanti),yconv(rcavanti),xconv(2*rcavanti+xcavanti)-xconv(xcavanti),yconv(-rcavanti)-yconv(rcavanti),240,-120);
g.drawArc(xconv(xcdietro),yconv(rcdietro),xconv(2*rcdietro+xcdietro)-xconv(xcdietro),yconv(-rcdietro)-yconv(rcdietro),240,-120);

g.setColor(Color.green);
g.drawArc(xconv(xcravanti),yconv(rcravanti),xconv(2*rcravanti+xcravanti)-xconv(xcravanti),yconv(-rcravanti)-yconv(rcravanti),209,-60);
g.drawArc(xconv(xcrdietro),yconv(rcrdietro),xconv(2*rcrdietro+xcrdietro)-xconv(xcrdietro),yconv(-rcrdietro)-yconv(rcrdietro),50,-99);
}
int xconv(double x){
return((int)((x-xmin)/(xmax-xmin)*larghezza));
}
int yconv(double y){return(altezza-(int)((y-ymin)/(ymax-ymin)*altezza));
}
}

}
Martedi' 15 Ottobre 2002 : 14 36 3 - ç da labmul10.fisica.uniba.it 193.204.188.67
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class Ovale extends JApplet implements ActionListener {
Timer timer;
Display disegno;
double r,r1,spessore,rcavanti,rcdietro,xcavanti,xcdietro;
double rcravanti,rcrdietro,xcravanti,xcrdietro;
Image img;
double xmin,xmax,ymin,ymax;
double x ;


public void init(){
xmin = -5.0;//mm
xmax = 42.0;ymin = -20.5;ymax = 27.5;
x=xmin;
img=getImage(getCodeBase(),"eye.gif");

disegno = new Display(this);
setContentPane(disegno);
r=12.8 ;r1=11.8;spessore=.5;
xcavanti=-2.5;xcdietro=-2.1; rcavanti=7.25; rcdietro=5.68;
xcravanti=1.1;xcrdietro=-8.1; rcravanti=9.67; rcrdietro=6.32;
disegno.setBackground(Color.yellow);
}

public void start() {
if (timer == null) {
timer = new Timer(100,this);
timer.start();
}
}

public void stop() {
if (timer != null) {
timer.stop();
}
}


public void actionPerformed(ActionEvent e) {
x=x+1.; if (x>xmax)stop();

disegno.repaint();
}

class Display extends JPanel {
int larghezza, altezza;
Ovale appl;
Display(Ovale appl1){appl=appl1;}

public void paintComponent(Graphics g){
larghezza = getSize().width;
altezza = getSize().height;
super.paintComponent(g);
g.drawImage(img,5,152, this);
g.setColor(Color.black);
g.drawLine(xconv(xmin),yconv(0.),xconv(xmax),yconv(0.));
g.drawLine(xconv(0.),yconv(ymin),xconv(0.),yconv(ymax));
g.setColor(Color.black);
g.drawLine(xconv(x),yconv(-.5),xconv(x),yconv(.5));
//System.out.println(xconv(0.)+" "+yconv(r)+" "+xconv(2*r)+" "+yconv(-r));
g.drawArc(xconv(-spessore/2.),yconv(r),xconv(2*r-spessore/2.)-xconv(-spessore/2.),yconv(-r)-yconv(r),210,300);
g.drawArc(xconv(spessore/2.),yconv(r1),xconv(2*r1+spessore/2.)-xconv(spessore/2.),yconv(-r1)-yconv(r1),210,300);
g.setColor(Color.red);
g.drawArc(xconv(xcavanti),yconv(rcavanti),xconv(2*rcavanti+xcavanti)-xconv(xcavanti),yconv(-rcavanti)-yconv(rcavanti),240,-120);
g.drawArc(xconv(xcdietro),yconv(rcdietro),xconv(2*rcdietro+xcdietro)-xconv(xcdietro),yconv(-rcdietro)-yconv(rcdietro),240,-120);

g.setColor(Color.green);
g.drawArc(xconv(xcravanti),yconv(rcravanti),xconv(2*rcravanti+xcravanti)-xconv(xcravanti),yconv(-rcravanti)-yconv(rcravanti),209,-60);
g.drawArc(xconv(xcrdietro),yconv(rcrdietro),xconv(2*rcrdietro+xcrdietro)-xconv(xcrdietro),yconv(-rcrdietro)-yconv(rcrdietro),50,-99);
}
int xconv(double x){
return((int)((x-xmin)/(xmax-xmin)*larghezza));
}
int yconv(double y){return(altezza-(int)((y-ymin)/(ymax-ymin)*altezza));
}
}

}
Martedi' 15 Ottobre 2002 : 14 37 5 - zito da 193.204.188.254

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;


public class Ovale extends JApplet implements ActionListener {
Timer timer;
Display disegno;
double r,r1,spessore,rcavanti,rcdietro,xcavanti,xcdietro;
double rcravanti,rcrdietro,xcravanti,xcrdietro;
Image img;
double xmin,xmax,ymin,ymax;
double x;
public void init(){

xmin = -5.0;//mm
xmax = 42.0;ymin = -20.5;ymax = 27.5;
x = xmin;
img=getImage(getCodeBase(),"eye.gif");

disegno = new Display(this);
setContentPane(disegno);
r=12.8 ;r1=11.8;spessore=.5;
xcavanti=-2.5;xcdietro=-2.1; rcavanti=7.25; rcdietro=5.68;
xcravanti=1.1;xcrdietro=-8.1; rcravanti=9.67; rcrdietro=6.32;
disegno.setBackground(Color.yellow);
}
public void start() {
if (timer == null) {
timer = new Timer(100,this);
timer.start();
}
}

public void stop() {
if (timer != null) {
timer.stop();
}
}

public void actionPerformed(ActionEvent e) {
x = x +1.; if(x > xmax) stop();

disegno.repaint();
}

class Display extends JPanel {
int larghezza, altezza;
Ovale appl;
Display(Ovale appl1){appl=appl1;}
public void paintComponent(Graphics g){
larghezza = getSize().width;
altezza = getSize().height;
super.paintComponent(g);
//g.drawImage(img,5,152, this);
g.setColor(Color.black);
g.drawLine(xconv(x),yconv(-.5),xconv(x),yconv(.5));
g.drawLine(xconv(xmin),yconv(0.),xconv(xmax),yconv(0.));
g.drawLine(xconv(0.),yconv(ymin),xconv(0.),yconv(ymax));
g.setColor(Color.black);
//System.out.println(xconv(0.)+" "+yconv(r)+" "+xconv(2*r)+" "+yconv(-r));
g.drawArc(xconv(-spessore/2.),yconv(r),xconv(2*r-spessore/2.)-xconv(-spessore/2.),yconv(-r)-yconv(r),210,300);
g.drawArc(xconv(spessore/2.),yconv(r1),xconv(2*r1+spessore/2.)-xconv(spessore/2.),yconv(-r1)-yconv(r1),210,300);
g.setColor(Color.red);
g.drawArc(xconv(xcavanti),yconv(rcavanti),xconv(2*rcavanti+xcavanti)-xconv(xcavanti),yconv(-rcavanti)-yconv(rcavanti),240,-120);
g.drawArc(xconv(xcdietro),yconv(rcdietro),xconv(2*rcdietro+xcdietro)-xconv(xcdietro),yconv(-rcdietro)-yconv(rcdietro),240,-120);

g.setColor(Color.green);
g.drawArc(xconv(xcravanti),yconv(rcravanti),xconv(2*rcravanti+xcravanti)-xconv(xcravanti),yconv(-rcravanti)-yconv(rcravanti),209,-60);
g.drawArc(xconv(xcrdietro),yconv(rcrdietro),xconv(2*rcrdietro+xcrdietro)-xconv(xcrdietro),yconv(-rcrdietro)-yconv(rcrdietro),50,-99);
}
int xconv(double x){
return((int)((x-xmin)/(xmax-xmin)*larghezza));
}
int yconv(double y){return(altezza-(int)((y-ymin)/(ymax-ymin)*altezza));
}
}

}
Martedi' 15 Ottobre 2002 : 14 41 - Anonimo da labmul7.fisica.uniba.it 193.204.188.64

Grazie,Giuda due volte!

Martedi' 15 Ottobre 2002 : 14 58 - Anonimo da labmul6.fisica.uniba.it 193.204.188.63
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class Ovale extends JApplet implements ActionListener {
Timer timer;
Display disegno;
double r,r1,spessore,rcavanti,rcdietro,xcavanti,xcdietro;
double rcravanti,rcrdietro,xcravanti,xcrdietro;
Image img;
double xmin,xmax,ymin,ymax;
double x;
public void init(){
xmin = -5.0;//mm
xmax = 42.0;ymin = -20.5;ymax = 27.5;
x = xmin;
img=getImage(getCodeBase(),"eye.gif");

disegno = new Display(this);
setContentPane(disegno);
r=12.8 ;r1=11.8;spessore=.5;
xcavanti=-2.5;xcdietro=-2.1; rcavanti=7.25; rcdietro=5.68;
xcravanti=1.1;xcrdietro=-8.1; rcravanti=9.67; rcrdietro=6.32;
disegno.setBackground(Color.yellow);
}
public void start() {
if (timer == null) {
timer = new Timer(100,this);
timer.start();
}
}

public void stop() {
if (timer != null) {
timer.stop();
}
}
public void actionPerformed(ActionEvent e) {
x = x+1.; if (x > xmax) stop();
disegno.repaint();
}
class Display extends JPanel {
int larghezza, altezza;
Ovale appl;
Display(Ovale appl1){appl=appl1;}
public void paintComponent(Graphics g){
larghezza = getSize().width;
altezza = getSize().height;
super.paintComponent(g);
//g.drawImage(img,5,152, this);
g.setColor(Color.black);
g.drawLine(xconv(xmin),yconv(0.),xconv(xmax),yconv(0.));
double xbar;
for ( xbar=xmin;xbar g.drawLine(xconv(xbar),yconv(-.5),xconv(xbar),yconv(.5)); }
double ybar;
for ( ybar=-20.;ybar g.drawLine(xconv(-.5),yconv(ybar),xconv(.5),yconv(ybar)); }
g.drawLine(xconv(-10.),yconv(4.5),xconv(-1.5),yconv(4.5));
g.drawLine(xconv(-10.),yconv(-4.5),xconv(-1.5),yconv(-4.5));
g.drawLine(xconv(-1.5),yconv(4.5),xconv(31.),yconv(0.));
g.drawLine(xconv(-1.5),yconv(-4.5),xconv(31.),yconv(0.));
g.drawLine(xconv(0.),yconv(ymin),xconv(0.),yconv(ymax));
g.setColor(Color.black);
g.drawLine(xconv(x),yconv(-.5),xconv(x),yconv(.5));
//System.out.println(xconv(0.)+" "+yconv(r)+" "+xconv(2*r)+" "+yconv(-r));
g.drawArc(xconv(-spessore/2.),yconv(r),xconv(2*r-spessore/2.)-xconv(-spessore/2.),yconv(-r)-yconv(r),210,300);
g.drawArc(xconv(spessore/2.),yconv(r1),xconv(2*r1+spessore/2.)-xconv(spessore/2.),yconv(-r1)-yconv(r1),210,300);
g.setColor(Color.red);
g.drawArc(xconv(xcavanti),yconv(rcavanti),xconv(2*rcavanti+xcavanti)-xconv(xcavanti),yconv(-rcavanti)-yconv(rcavanti),240,-120);
g.drawArc(xconv(xcdietro),yconv(rcdietro),xconv(2*rcdietro+xcdietro)-xconv(xcdietro),yconv(-rcdietro)-yconv(rcdietro),240,-120);

g.setColor(Color.green);
g.drawArc(xconv(xcravanti),yconv(rcravanti),xconv(2*rcravanti+xcravanti)-xconv(xcravanti),yconv(-rcravanti)-yconv(rcravanti),209,-60);
g.drawArc(xconv(xcrdietro),yconv(rcrdietro),xconv(2*rcrdietro+xcrdietro)-xconv(xcrdietro),yconv(-rcrdietro)-yconv(rcrdietro),50,-99);
}
int xconv(double x){
return((int)((x-xmin)/(xmax-xmin)*larghezza));
}
int yconv(double y){return(altezza-(int)((y-ymin)/(ymax-ymin)*altezza));
}
}

}
Martedi' 15 Ottobre 2002 : 15 2 3 - Anonimo da labmul6.fisica.uniba.it 193.204.188.63
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class Ovale extends JApplet implements ActionListener {
Timer timer;
Display disegno;
double r,r1,spessore,rcavanti,rcdietro,xcavanti,xcdietro;
double rcravanti,rcrdietro,xcravanti,xcrdietro;
Image img;
double xmin,xmax,ymin,ymax;
double x;
public void init(){
xmin = -5.0;//mm
xmax = 42.0;ymin = -20.5;ymax = 27.5;
x = xmin;
img=getImage(getCodeBase(),"eye.gif");

disegno = new Display(this);
setContentPane(disegno);
r=12.8 ;r1=11.8;spessore=.5;
xcavanti=-2.5;xcdietro=-2.1; rcavanti=7.25; rcdietro=5.68;
xcravanti=1.1;xcrdietro=-8.1; rcravanti=9.67; rcrdietro=6.32;
disegno.setBackground(Color.yellow);
}
public void start() {
if (timer == null) {
timer = new Timer(100,this);
timer.start();
}
}

public void stop() {
if (timer != null) {
timer.stop();
}
}
public void actionPerformed(ActionEvent e) {
x = x+1.; if (x > xmax) stop();
disegno.repaint();
}
class Display extends JPanel {
int larghezza, altezza;
Ovale appl;
Display(Ovale appl1){appl=appl1;}
public void paintComponent(Graphics g){
larghezza = getSize().width;
altezza = getSize().height;
super.paintComponent(g);
//g.drawImage(img,5,152, this);
g.setColor(Color.black);
g.drawLine(xconv(xmin),yconv(0.),xconv(xmax),yconv(0.));
double xbar;
for ( xbar=xmin;xbar g.drawLine(xconv(xbar),yconv(-.5),xconv(xbar),yconv(.5)); }
double ybar;
for ( ybar=-20.;ybar g.drawLine(xconv(-.5),yconv(ybar),xconv(.5),yconv(ybar)); }

g.drawLine(xconv(-10.),yconv(4.5),xconv(-1.5),yconv(4.5));
g.drawLine(xconv(-10.),yconv(-4.5),xconv(-1.5),yconv(-4.5));
g.drawLine(xconv(-1.5),yconv(4.5),xconv(31.),yconv(0.));
g.drawLine(xconv(-1.5),yconv(-4.5),xconv(31.),yconv(0.));

g.drawLine(xconv(-20.),yconv(0.),xconv(-1.5),yconv(4.5));
g.drawLine(xconv(-20.),yconv(0.),xconv(-1.5),yconv(-4.5));
g.drawLine(xconv(-1.5),yconv(4.5),xconv(34.),yconv(0.));
g.drawLine(xconv(-1.5),yconv(-4.5),xconv(34.),yconv(0.));

g.drawLine(xconv(0.),yconv(ymin),xconv(0.),yconv(ymax));
g.setColor(Color.black);
g.drawLine(xconv(x),yconv(-.5),xconv(x),yconv(.5));
//System.out.println(xconv(0.)+" "+yconv(r)+" "+xconv(2*r)+" "+yconv(-r));
g.drawArc(xconv(-spessore/2.),yconv(r),xconv(2*r-spessore/2.)-xconv(-spessore/2.),yconv(-r)-yconv(r),210,300);
g.drawArc(xconv(spessore/2.),yconv(r1),xconv(2*r1+spessore/2.)-xconv(spessore/2.),yconv(-r1)-yconv(r1),210,300);
g.setColor(Color.red);
g.drawArc(xconv(xcavanti),yconv(rcavanti),xconv(2*rcavanti+xcavanti)-xconv(xcavanti),yconv(-rcavanti)-yconv(rcavanti),240,-120);
g.drawArc(xconv(xcdietro),yconv(rcdietro),xconv(2*rcdietro+xcdietro)-xconv(xcdietro),yconv(-rcdietro)-yconv(rcdietro),240,-120);

g.setColor(Color.green);
g.drawArc(xconv(xcravanti),yconv(rcravanti),xconv(2*rcravanti+xcravanti)-xconv(xcravanti),yconv(-rcravanti)-yconv(rcravanti),209,-60);
g.drawArc(xconv(xcrdietro),yconv(rcrdietro),xconv(2*rcrdietro+xcrdietro)-xconv(xcrdietro),yconv(-rcrdietro)-yconv(rcrdietro),50,-99);
}
int xconv(double x){
return((int)((x-xmin)/(xmax-xmin)*larghezza));
}
int yconv(double y){return(altezza-(int)((y-ymin)/(ymax-ymin)*altezza));
}
}

}
Martedi' 15 Ottobre 2002 : 15 10 4 - Anonimo da labmul1.fisica.uniba.it 193.204.188.58
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;


public class Ovale extends JApplet implements ActionListener {
Timer timer;
Display disegno;
double r,r1,spessore,rcavanti,rcdietro,xcavanti,xcdietro;
double rcravanti,rcrdietro,xcravanti,xcrdietro;
Image img;
double xmin,xmax,ymin,ymax;
double x;
public void init(){

xmin = -5.0;//mm
xmax = 42.0;ymin = -20.5;ymax = 27.5;
x = xmin;
img=getImage(getCodeBase(),"eye.gif");

disegno = new Display(this);
setContentPane(disegno);
r=12.8 ;r1=11.8;spessore=.5;
xcavanti=-2.5;xcdietro=-2.1; rcavanti=7.25; rcdietro=5.68;
xcravanti=1.1;xcrdietro=-8.1; rcravanti=9.67; rcrdietro=6.32;
disegno.setBackground(Color.yellow);
}
public void start() {
if (timer == null) {
timer = new Timer(100,this);
timer.start();
}
}

public void stop() {
if (timer != null) {
timer.stop();
}
}

public void actionPerformed(ActionEvent e) {
x = x +1.; if(x > xmax) stop();

disegno.repaint();
}

class Display extends JPanel {
int larghezza, altezza;
Ovale appl;
Display(Ovale appl1){appl=appl1;}
public void paintComponent(Graphics g){
larghezza = getSize().width;
altezza = getSize().height;
super.paintComponent(g);
//g.drawImage(img,5,152, this);
g.setColor(Color.black);
//g.drawLine(xconv(x),yconv(-.5),xconv(x),yconv(.5));
double xbar ;
for (xbar=xmin;xbarg.drawLine(xconv(xbar),yconv(-.5),xconv(xbar),yconv(.5)); }
double ybar ;
for (ybar=-20;xbarg.drawLine(xconv(-.5),yconv(ybar),xconv(+.5),yconv(ybar)); }
g.drawLine(xconv(xim),yconv(4.5),xconv(-1.5),yconv(4.5));
g.drawLine(xconv(-10.),yconv(-4.5),xconv(-1.5),yconv(-4.5));
g.drawLine(xconv(-1.5),yconv(4.5),xconv(31),yconv(0.));
g.drawLine(xconv(-1.5),yconv(-4.5),xconv(31),yconv(0.));
/*
g.drawLine(xconv(-20.),yconv(0.),xconv(-1.5),yconv(4.5));
g.drawLine(xconv(-20.),yconv(0.),xconv(-1.5),yconv(-4.5));
g.drawLine(xconv(-1.5),yconv(4.5),xconv(34),yconv(0.));
g.drawLine(xconv(-1.5),yconv(-4.5),xconv(34),yconv(0.));
*/


g.drawLine(xconv(xmin),yconv(0.),xconv(xmax),yconv(0.));
g.drawLine(xconv(0.),yconv(ymin),xconv(0.),yconv(ymax));
g.setColor(Color.black);
//System.out.println(xconv(0.)+" "+yconv(r)+" "+xconv(2*r)+" "+yconv(-r));
g.drawArc(xconv(-spessore/2.),yconv(r),xconv(2*r-spessore/2.)-xconv(-spessore/2.),yconv(-r)-yconv(r),210,300);
g.drawArc(xconv(spessore/2.),yconv(r1),xconv(2*r1+spessore/2.)-xconv(spessore/2.),yconv(-r1)-yconv(r1),210,300);
g.setColor(Color.red);
g.drawArc(xconv(xcavanti),yconv(rcavanti),xconv(2*rcavanti+xcavanti)-xconv(xcavanti),yconv(-rcavanti)-yconv(rcavanti),240,-120);
g.drawArc(xconv(xcdietro),yconv(rcdietro),xconv(2*rcdietro+xcdietro)-xconv(xcdietro),yconv(-rcdietro)-yconv(rcdietro),240,-120);

g.setColor(Color.green);
g.drawArc(xconv(xcravanti),yconv(rcravanti),xconv(2*rcravanti+xcravanti)-xconv(xcravanti),yconv(-rcravanti)-yconv(rcravanti),209,-60);
g.drawArc(xconv(xcrdietro),yconv(rcrdietro),xconv(2*rcrdietro+xcrdietro)-xconv(xcrdietro),yconv(-rcrdietro)-yconv(rcrdietro),50,-99);
}
int xconv(double x){
return((int)((x-xmin)/(xmax-xmin)*larghezza));
}
int yconv(double y){return(altezza-(int)((y-ymin)/(ymax-ymin)*altezza));
}
}

}

Martedi' 15 Ottobre 2002 : 15 19 - zito da 193.204.188.254

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;


public class Ovale extends JApplet implements ActionListener {
Timer timer;
Display disegno;
double r,r1,spessore,rcavanti,rcdietro,xcavanti,xcdietro;
double rcravanti,rcrdietro,xcravanti,xcrdietro;
Image img;
double xmin,xmax,ymin,ymax;
double xim,xog;
public void init(){

xmin = -5.0;//mm
xmax = 42.0;ymin = -20.5;ymax = 27.5;
xim = 31.;xog=-1000.;
img=getImage(getCodeBase(),"eye.gif");

disegno = new Display(this);
setContentPane(disegno);
r=12.8 ;r1=11.8;spessore=.5;
xcavanti=-2.5;xcdietro=-2.1; rcavanti=7.25; rcdietro=5.68;
xcravanti=1.1;xcrdietro=-8.1; rcravanti=9.67; rcrdietro=6.32;
disegno.setBackground(Color.yellow);
}
public void start() {
if (timer == null) {
timer = new Timer(100,this);
timer.start();
}
}

public void stop() {
if (timer != null) {
timer.stop();
}
}

public void actionPerformed(ActionEvent e) {
xim = xim + 3./100.;if(xim > 34.) stop();
xog = xog + 980./100.;
disegno.repaint();
}

class Display extends JPanel {
int larghezza, altezza;
Ovale appl;
Display(Ovale appl1){appl=appl1;}
public void paintComponent(Graphics g){
larghezza = getSize().width;
altezza = getSize().height;
super.paintComponent(g);
//g.drawImage(img,5,152, this);
g.setColor(Color.black);
//g.drawLine(xconv(x),yconv(-.5),xconv(x),yconv(.5));
double xbar;
for( xbar=xmin;xbar g.drawLine(xconv(xbar),yconv(-.5),xconv(xbar),yconv(.5)); }
double ybar;
for( ybar=-20.;ybar g.drawLine(xconv(-.5),yconv(ybar),xconv(+.5),yconv(ybar)); }

g.drawLine(xconv(xog),yconv(0.),xconv(-1.5),yconv(4.5));
g.drawLine(xconv(xog),yconv(0.),xconv(-1.5),yconv(-4.5));
g.drawLine(xconv(-1.5),yconv(4.5),xconv(xim),yconv(0.));
g.drawLine(xconv(-1.5),yconv(-4.5),xconv(xim),yconv(0.));
/*
g.drawLine(xconv(-20.),yconv(0.),xconv(-1.5),yconv(4.5));
g.drawLine(xconv(-20.),yconv(0.),xconv(-1.5),yconv(-4.5));
g.drawLine(xconv(-1.5),yconv(4.5),xconv(34.),yconv(0.));
g.drawLine(xconv(-1.5),yconv(-4.5),xconv(34.),yconv(0.));
*/

g.drawLine(xconv(xmin),yconv(0.),xconv(xmax),yconv(0.));
g.drawLine(xconv(0.),yconv(ymin),xconv(0.),yconv(ymax));
g.setColor(Color.black);
//System.out.println(xconv(0.)+" "+yconv(r)+" "+xconv(2*r)+" "+yconv(-r));
g.drawArc(xconv(-spessore/2.),yconv(r),xconv(2*r-spessore/2.)-xconv(-spessore/2.),yconv(-r)-yconv(r),210,300);
g.drawArc(xconv(spessore/2.),yconv(r1),xconv(2*r1+spessore/2.)-xconv(spessore/2.),yconv(-r1)-yconv(r1),210,300);
g.setColor(Color.red);
g.drawArc(xconv(xcavanti),yconv(rcavanti),xconv(2*rcavanti+xcavanti)-xconv(xcavanti),yconv(-rcavanti)-yconv(rcavanti),240,-120);
g.drawArc(xconv(xcdietro),yconv(rcdietro),xconv(2*rcdietro+xcdietro)-xconv(xcdietro),yconv(-rcdietro)-yconv(rcdietro),240,-120);

g.setColor(Color.green);
g.drawArc(xconv(xcravanti),yconv(rcravanti),xconv(2*rcravanti+xcravanti)-xconv(xcravanti),yconv(-rcravanti)-yconv(rcravanti),209,-60);
g.drawArc(xconv(xcrdietro),yconv(rcrdietro),xconv(2*rcrdietro+xcrdietro)-xconv(xcrdietro),yconv(-rcrdietro)-yconv(rcrdietro),50,-99);
}
int xconv(double x){
return((int)((x-xmin)/(xmax-xmin)*larghezza));
}
int yconv(double y){return(altezza-(int)((y-ymin)/(ymax-ymin)*altezza));
}
}

}

Martedi' 15 Ottobre 2002 : 15 26 2 - zito da 193.204.188.254
java.awt
javax.swing
awt - abstract window toolkit
swing - interfaccia piu' moderna
awt - Panel
swing - JPanel
Martedi' 15 Ottobre 2002 : 15 30 - Anonimo da labmul1.fisica.uniba.it 193.204.188.58
Java Packages
The JDK contains:
directory bin:basic Java language tools
directory demo:Demo programs
directory lib:Class libraries
java.lang:basic language classes (String,etc)
java.applet:classes for applet manipulation.
java.awt:Abstract windowing toolkit (the classes for GUI)
Follows a partial AWT class hierarchy
Component
Label
Button
Canvas
Checkbox
Choice
Textfield
Scrollbar
Container
Panel
Applet
Window
Dialog
FileDialog
Frame
MenuComponent
MenuBar
MenuItem
CheckboxMenuItem
Menu
javax.swing:Swing libreria di oggetti grafici che hanno rimpiazzato in parte quelli di AWT da JDK 1.2 in poi.
Segue una lista dei principali oggetti:
(Component)
(Container)
JComponent
JBComboBox
JLabel
JList
JPanel
JProgressBar
JScrollBar
JScrollPane
JSplitPane
JTable
JTree
JAbstractButton
JButton
JToggleButton
JTextComponent
(Window)
(Frame)
JWindow
JDialog
JFrame
java.io:File input/output classes
java.net:Networking protocol API
java.util:Miscellanea like random-numbers,date,etc
Martedi' 15 Ottobre 2002 : 16 3 5 - Anonimo da labmul15.fisica.uniba.it 193.204.188.74
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class Ovale extends JApplet implements ActionListener {
Timer timer;
Display disegno;
double r,r1,spessore,rcavanti,rcdietro,xcavanti,xcdietro;
double rcravanti,rcrdietro,xcravanti,xcrdietro;
Image img;
double x;
double xmin,xmax,ymin,ymax;
double xim,xog;

public void init(){
xmin = -5.0;//mm
xmax = 42.0;ymin = -20.5;ymax = 27.5;
xim=31.;xog=-1000.;
img=getImage(getCodeBase(),"eye.gif");

disegno = new Display(this);
setContentPane(disegno);
r=12.8 ;r1=11.8;spessore=.5;
xcavanti=-2.5;xcdietro=-2.1; rcavanti=7.25; rcdietro=5.68;
xcravanti=1.1;xcrdietro=-8.1; rcravanti=9.67; rcrdietro=6.32;
disegno.setBackground(Color.yellow);
}
public void start() {
if (timer == null) {
timer = new Timer(100,this);
timer.start();
}
}

public void stop() {
if (timer != null) {
timer.stop();
}
}

public void actionPerformed(ActionEvent e) {
xim = xim + 3./100.; if (xim>34.) stop();
xog=xog + 980./100.;
disegno.repaint();
}
class Display extends JPanel {
int larghezza, altezza;
Ovale appl;
Display(Ovale appl1){appl=appl1;}
public void paintComponent(Graphics g){
larghezza = getSize().width;
altezza = getSize().height;
super.paintComponent(g);
//g.drawImage(img,5,152, this);
g.setColor(Color.black);
g.drawLine(xconv(x), yconv(-.5),xconv(x), yconv(.5));
double xbar;
for( xbar=xmin; xbarg.drawLine(xconv(xbar), yconv(-.5),xconv(xbar), yconv(.5));
}
double ybar;
for( ybar=-20; ybarg.drawLine(xconv(-.5), yconv(ybar),xconv(.5), yconv(ybar));
}
g.drawLine (xconv(xog), yconv(0.),xconv(-1.5),yconv(4.5));
g.drawLine (xconv(xog), yconv(0.),xconv(-1.5),yconv(-4.5));
g.drawLine(xconv(-1.5),yconv(4.5),xconv(xim),yconv(0.));
g.drawLine(xconv(-1.5),yconv(-4.5),xconv(xim),yconv(0.));
/*
g.drawLine (xconv(-20.), yconv(0.),xconv(-1.5),yconv(4.5));
g.drawLine (xconv(-20.), yconv(0.),xconv(-1.5),yconv(-4.5));
g.drawLine(xconv(-1.5),yconv(4.5),xconv(34.),yconv(0.));
g.drawLine(xconv(-1.5),yconv(-4.5),xconv(34.),yconv(0.));
*/

g.drawLine(xconv(xmin),yconv(0.),xconv(xmax),yconv(0.));
g.drawLine(xconv(0.),yconv(ymin),xconv(0.),yconv(ymax));
g.setColor(Color.black);
//System.out.println(xconv(0.)+" "+yconv(r)+" "+xconv(2*r)+" "+yconv(-r));
g.drawArc(xconv(-spessore/2.),yconv(r),xconv(2*r-spessore/2.)-xconv(-spessore/2.),yconv(-r)-yconv(r),210,300);
g.drawArc(xconv(spessore/2.),yconv(r1),xconv(2*r1+spessore/2.)-xconv(spessore/2.),yconv(-r1)-yconv(r1),210,300);
g.setColor(Color.red);
g.drawArc(xconv(xcavanti),yconv(rcavanti),xconv(2*rcavanti+xcavanti)-xconv(xcavanti),yconv(-rcavanti)-yconv(rcavanti),240,-120);
g.drawArc(xconv(xcdietro),yconv(rcdietro),xconv(2*rcdietro+xcdietro)-xconv(xcdietro),yconv(-rcdietro)-yconv(rcdietro),240,-120);

g.setColor(Color.green);
g.drawArc(xconv(xcravanti),yconv(rcravanti),xconv(2*rcravanti+xcravanti)-xconv(xcravanti),yconv(-rcravanti)-yconv(rcravanti),209,-60);
g.drawArc(xconv(xcrdietro),yconv(rcrdietro),xconv(2*rcrdietro+xcrdietro)-xconv(xcrdietro),yconv(-rcrdietro)-yconv(rcrdietro),50,-99);
}
int xconv(double x){
return((int)((x-xmin)/(xmax-xmin)*larghezza));
}
int yconv(double y){return(altezza-(int)((y-ymin)/(ymax-ymin)*altezza));
}
}

}