help with buttons
hello,
I'm new in java and i need some help with buttons and their actions.
I need to insert buttons to perform three actions (draw lines). can anybody help?
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;
import java.awt.event.*;
publicclass antrasextends JApplet{
private Rectangle2D Shape4;
public antras (){
setBackground( Color.black );
Shape4 =new Rectangle2D.Float (10.F, 10.F, 480.F, 280.F);
}
publicvoid paint (Graphics g){
Graphics2D g2D;
boolean Contained;
g2D = (Graphics2D) g;
g2D.setColor(Color.white);
g2D.fill (Shape4);
Contained = Shape4.intersectsLine (400., 10., 480., 70.);
//first action
g2D.setColor (Color.green);
g2D.drawLine (10, 100, 489, 100);
//second action
g2D.setStroke(new BasicStroke(1f, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_ROUND,
1f,newfloat[]{2f},0f));
g2D.setColor (Color.green);
g2D.drawLine (10, 140, 490, 140);
//third action
g2D.setStroke(new BasicStroke(1f, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_ROUND,
1f,newfloat[]{5f},0f));
g2D.setColor (Color.green);
g2D.drawLine (10, 200, 490, 200);
}
}

