Option Panes

import javax.swing.*; //The OptionPanes Library
import java.applet.*;
public class inputEx extends Applet
{
   int ans = 0; //Declare your variables out here.
   
   public void init ()
   {//Init is a method that runs before you paint

	//This line makes the option pane appear.
   //The String in the brackets is the question.
     String input = JOptionPane.showInputDialog ("Enter a number between 1 and 10:");
     
	//This line takes the string and makes it into a number
	//  so that you can use it.
	  ans = Integer.parseInt (input);
   }
   public void paint ()
   {
	//Do whatever you want with your variables in paint
     showStatus ("The number entered was " + ans);
   }
}