import javax.swing.*; public class DialogBox { public static void main2(String [] args) { JOptionPane myin = new JOptionPane(); String instructor = myin.showInputDialog("Enter instructor's name"); System.out.println(instructor); System.exit(0); // kills off UI thread } public static void main() { String inString; double radius; double area; JOptionPane inBox = new JOptionPane(); JOptionPane outBox = new JOptionPane(); inString = inBox.showInputDialog("Enter Radius"); radius = Double.parseDouble(inString); area = Math.PI * radius * radius; outBox.showMessageDialog( null, // select default parent frame "Radius: " + radius + ", Area: " + area ); /* outBox.showMessageDialog( null, // select default parent frame String.format("Radius: %.2f, area: %.2f", radius, area) ); */ System.exit(0); // kills off UI thread } }