Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package thirdPdf;
- import javax.swing.*;
- import javax.swing.plaf.FontUIResource;
- import java.awt.*;
- import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
- import static javax.swing.JOptionPane.showInputDialog;
- import static javax.swing.JOptionPane.showMessageDialog;
- /**
- * Created by Kurnosova Iryna on 01.10.2017.
- */
- public class DayOfWeek {
- public static void main(String[] args) {
- UIManager.put("OptionPane.messageFont", new FontUIResource(new Font("Arial", Font.BOLD, 20)));
- UIManager.put("OptionPane.buttonFont", new FontUIResource(new Font("Serif", Font.ITALIC, 18)));
- String choice = showInputDialog(null, "Enter the digit from 1 to 7", "Getting the day", INFORMATION_MESSAGE);
- switch (choice){
- case "1": {
- showMessageDialog(null, "Sunday", "The day of the week", INFORMATION_MESSAGE);
- break;
- }
- case "2": {
- showMessageDialog(null, "Monday", "The day of the week", INFORMATION_MESSAGE);
- break;
- }
- case "3": {
- showMessageDialog(null, "Tuesday", "The day of the week", INFORMATION_MESSAGE);
- break;
- }
- case "4": {
- showMessageDialog(null, "Wednesday", "The day of the week", INFORMATION_MESSAGE);
- break;
- }
- case "5": {
- showMessageDialog(null, "Thursday", "The day of the week", INFORMATION_MESSAGE);
- break;
- }
- case "6": {
- showMessageDialog(null, "Friday", "The day of the week", INFORMATION_MESSAGE);
- break;
- }
- case "7": {
- showMessageDialog(null, "Saturday", "The day of the week", INFORMATION_MESSAGE);
- break;
- }
- default:{
- showMessageDialog(null, "Wrong data!", "Error", JOptionPane.ERROR_MESSAGE);
- break;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment