Te ayudo solo porque no tengo nada que hacer y es muy fácil, y además estoy mirando eso en mi certificación XD.
- /** 
-  * @(#)AppletLinea.java 
-  * 
-  * AppletLinea Applet application 
-  * 
-  * @author Darhius929 
-  * @version 1.00 2012/5/2 
-  */ 
-   
- import java.awt.*; 
- import java.applet.*; 
- import java.awt.event.*; 
-   
-   
- 	boolean pintar=false; 
-   
- 	public AppletLinea(){ 
- 		boton  = new Button("Aceptar");
- 		add(boton); 
- 		boton.addActionListener(this); 
- 	} 
-   
- 		if(ae.getSource() == boton){ 
- 			pintar=true; 
- 		} 
- 		repaint(); 
- 	} 
-   
- 	public void init() { 
- 	} 
-   
- 		if(pintar){ 
- 			g.drawLine(10, 30, 300, 30); 
-   
- 			/*boton.setEnabled(false); //Para algo mas nice quita los comentarios de este bloque y comenta la linea de arriba. 
- 			for(int x=10; x<300; x++){ 
- 				try{ 
- 					Thread.sleep(25); 
- 				}catch(Exception e){ 
- 					e.printStackTrace(); 
- 				} 
- 				g.drawLine(x, 30, x, 30); 
- 			} 
- 			boton.setEnabled(true);*/ 
- 		} 
- 	} 
- } 
-   
Saludos