alert("hello")
. The code can be modified to include several types of message box types such as an error icon or different button options. Have a look JOptionPane in the JavaDoc's for more information on these.
import javax.swing.JOptionPane; /** * Displays a popup message box in Java */ public class MessageBox { /** * Displays a popup message box with the Information Message icon and button "Okay" * * @param message the message to display in the popup */ public static void MessageBoxOkayInfo(String message) { JOptionPane.showMessageDialog(null, message, "Alert", JOptionPane.INFORMATION_MESSAGE); } }
To try this code use this snippet.
MessageBox.MessageBoxOkayInfo("Hello World!");
No comments:
Post a Comment