Question
java
Write an application that will show 5 different messages (no input, 5 types: error message, question message, information mes
Icon Code IDE Value JOptionPane.PLAIN MESSAGE JOptionPane.ERROR MESSAGE No icon -1 X 0 JOptionPane.INFORMATION MESSAGE 1 JOpt
Write an application that will show 5 different messages (no input, 5 types: error message, question message, information message, warning message and plain message). Use the welcome.java example from lecture slides. You should end up with just one file.
Icon Code IDE Value JOptionPane.PLAIN MESSAGE JOptionPane.ERROR MESSAGE No icon -1 X 0 JOptionPane.INFORMATION MESSAGE 1 JOptionPane.WARNING MESSAGE 2 JOptionPane QUESTION MESSAGE 3
0 0
Add a comment Improve this question Transcribed image text
Answer #1

import javax.swing.*;
public class OptionPaneMesseges {
   public static void main(String[] args) {
       JFrame f=new JFrame();
       //to display plain message
       JOptionPane.showMessageDialog(f,"Plain Message","Alert",JOptionPane.PLAIN_MESSAGE);
       //to display error message
       JOptionPane.showMessageDialog(f,"Error Message","Alert",JOptionPane.ERROR_MESSAGE);
       //to display information message
       JOptionPane.showMessageDialog(f,"Information Message","Alert",JOptionPane.INFORMATION_MESSAGE);
       //to display warning message
       JOptionPane.showMessageDialog(f,"Warning Message","Alert",JOptionPane.WARNING_MESSAGE);
       //to display question message
       JOptionPane.showMessageDialog(f,"Question Message","Alert",JOptionPane.QUESTION_MESSAGE);
      
   }
}

Alert Plain Message OK

Alert X Error Message OK

Alert (i Information Message OK

X Alert Warning Message OK

X Alert ? Question Message OK

Add a comment
Know the answer?
Add Answer to:
java Write an application that will show 5 different messages (no input, 5 types: error message,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I'm working with Java and I have a error message  1 error Error: Could not find or...

    I'm working with Java and I have a error message  1 error Error: Could not find or load main class Flowers. This is the problem: Instructions Make sure the source code file named Flowers.java is open. Declare the variables you will need. Write the Java statements that will open the input file, flowers.dat, for reading. Write a while loop to read the input until EOF is reached. In the body of the loop, print the name of each flower and where...

  • writte application ask 5 word ( input) and show all of them and then show them...

    writte application ask 5 word ( input) and show all of them and then show them in order from least to greatest in word lenght. write this word for example: watermelon , app, oranges , grap ، cucumber show this on input ( for example) app , grap , oranges , cucumber , watermelon please send it with html code and java-script thanks ?

  • Please write in Java in Jgrasp check code before posting Please write in Java in Jgrasp...

    Please write in Java in Jgrasp check code before posting Please write in Java in Jgrasp check code before posting Please write in Java in Jgrasp check code before posting, will give thumbs up FOP- 2. Write a program that ciphers a plain text message using double transposition scheme and vice versa. [50 Marks) The program should accept five tuples of input: plain text, row, column, permutation of row and columns. An example of encrypted text for the plain text...

  • Write program in JAVA with a method that returns an array. The method should accept as input a co...

    Write program in JAVA with a method that returns an array. The method should accept as input a comma-delimited string with three values from a user. The array should store each value in a different element. Use Try..Catch error handling and print any failure messages, or print success from within method if execution is successful (see Chapter 13 in the text). Call the method from the main method of the program to demonstrate its functionality by looping through the array...

  • Please do in java as simply as possible with code available for copy and comments Write...

    Please do in java as simply as possible with code available for copy and comments Write a program that reads a file (provided as attachment to this assignment) and writes the file to a different file with line numbers inserted at the beginning of each line. Throw an exception if the file does not exist. An error message should result. For example if file input is: This is a test File output should be 1. This is a test I...

  • In this exercise, you’ll upgrade a version of the MPG application so the error messages are...

    In this exercise, you’ll upgrade a version of the MPG application so the error messages are displayed in span elements to the right of the text boxes. Open the HTML and JavaScript files in this folder: exercises_short\ch06\mpg\ Then, run the application and click the Calculate MPG button to see that an error message is displayed in an alert dialog box for each of the two input fields. 2. In the HTML file, add a span element after the input element...

  • Hello, Could you please input validate this code so that the code prints an error message...

    Hello, Could you please input validate this code so that the code prints an error message if the user enters in floating point numbers or characters or ANYTHING but VALID ints? And then could you please post a picture of the output testing it to make sure it works? * Write a method called evenNumbers that accepts a Scanner * reading input from a file with a series of integers, and * report various statistics about the integers to the...

  • MASM Assembly language -- Message Encryption Pgm You are to write a program to input a...

    MASM Assembly language -- Message Encryption Pgm You are to write a program to input a text and a key and encrypt the text. I will supply you an encryption key consisting of multiple characters. Use this key to encrypt and decrypt the plain text by XOR-ing each character of the key against a corresponding byte in the message. Repeat the key as many times as necessary until all plain text bytes are translated. Suppose, for example, the key were...

  • Programming question. Using Visual Studio 2019 C#. Windows Forms Application. Write the code to display the message “Entry error” in the msgLabel when the value in the Integer units variable is less t...

    Programming question. Using Visual Studio 2019 C#. Windows Forms Application. Write the code to display the message “Entry error” in the msgLabel when the value in the Integer units variable is less than or equal to 0. Otherwise, calculate the total owed as follows: If the value stored in the units variable is less than 20, multiply the value by $10; otherwise, multiply it by $5. Store the total owed in the total variable.

  • Exercise: Pinata pricing You sell three different types of pinatas. Pandas cost $14 each, lambs cost...

    Exercise: Pinata pricing You sell three different types of pinatas. Pandas cost $14 each, lambs cost $12 each, and bunnies cost $9 each. Write a program that computes the total price of an order. Here’s a sample: The program validates the three input fields. They should all be numbers zero or more. If any of them is bad, show one error message, like this: Don’t create your own workbook. Download this one instead. It has some code already there: Private...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT