476179

dialog boxes

Oct 10th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. package lessons;
  2.  
  3.  
  4. import javax.swing.JOptionPane;
  5. public class DialogBoxes
  6. {
  7.  
  8. public static void main(String[] args)
  9. {
  10. JOptionPane.showMessageDialog(null, "hello world");
  11. // null sets to center
  12. // whatever is enters into the dialog box is ALWAYS saved as a string literal
  13.  
  14. String name;
  15. name = JOptionPane.showInputDialog("enter your name");
  16.  
  17. JOptionPane.showMessageDialog(null, name);
  18.  
  19. System.exit(0);
  20. // whenever you are done with a thread of boxes close the system with this
  21.  
  22.  
  23. }
  24.  
  25. }
Add Comment
Please, Sign In to add comment