allows for user input of the 4 values (x, y, width, height) but it wont draw the rectangle with those values.
import java.awt.Graphics; import javax.swing.JApplet; import javax.swing.JOptionPane; public class drawRectangle extends JApplet { public int x; public int y; public int height; public int width; public void init() { String x = JOptionPane.showInputDialog( "Enter the x value"); String y = JOptionPane.showInputDialog( "Enter the y value"); String height = JOptionPane.showInputDialog( "Enter the height value"); String width = JOptionPane.showInputDialog( "Enter the width value"); } public void setWidth( int width ) { width = width; } public void setHeight( int height ) { height = height; } public void setX( int x ) { x = x; } public void setY( int y ) { y = y; } public void paint( Graphics g ) { super.paint(g); g.drawRect(x, y, width, height ); } }