Guest User

Untitled

a guest
Oct 19th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. package thirdPdf;
  2.  
  3. import javax.swing.*;
  4. import javax.swing.plaf.FontUIResource;
  5. import java.awt.*;
  6.  
  7. import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
  8. import static javax.swing.JOptionPane.showInputDialog;
  9. import static javax.swing.JOptionPane.showMessageDialog;
  10.  
  11. /**
  12. * Created by Kurnosova Iryna on 01.10.2017.
  13. */
  14. public class DayOfWeek {
  15. public static void main(String[] args) {
  16.  
  17. UIManager.put("OptionPane.messageFont", new FontUIResource(new Font("Arial", Font.BOLD, 20)));
  18. UIManager.put("OptionPane.buttonFont", new FontUIResource(new Font("Serif", Font.ITALIC, 18)));
  19.  
  20. String choice = showInputDialog(null, "Enter the digit from 1 to 7", "Getting the day", INFORMATION_MESSAGE);
  21.  
  22. switch (choice){
  23. case "1": {
  24. showMessageDialog(null, "Sunday", "The day of the week", INFORMATION_MESSAGE);
  25. break;
  26. }
  27. case "2": {
  28. showMessageDialog(null, "Monday", "The day of the week", INFORMATION_MESSAGE);
  29. break;
  30. }
  31. case "3": {
  32. showMessageDialog(null, "Tuesday", "The day of the week", INFORMATION_MESSAGE);
  33. break;
  34. }
  35. case "4": {
  36. showMessageDialog(null, "Wednesday", "The day of the week", INFORMATION_MESSAGE);
  37. break;
  38. }
  39. case "5": {
  40. showMessageDialog(null, "Thursday", "The day of the week", INFORMATION_MESSAGE);
  41. break;
  42. }
  43. case "6": {
  44. showMessageDialog(null, "Friday", "The day of the week", INFORMATION_MESSAGE);
  45. break;
  46. }
  47. case "7": {
  48. showMessageDialog(null, "Saturday", "The day of the week", INFORMATION_MESSAGE);
  49. break;
  50. }
  51. default:{
  52. showMessageDialog(null, "Wrong data!", "Error", JOptionPane.ERROR_MESSAGE);
  53. break;
  54. }
  55. }
  56. }
  57. }
Add Comment
Please, Sign In to add comment