Here you can find the source of showMessage(Component parent, String message, int messageType)
Parameter | Description |
---|---|
parent | parent component |
message | the message string |
messageType | the message type as defined in <tt>JOptionPane</tt> |
public static void showMessage(Component parent, String message, int messageType)
//package com.java2s; /*//from w w w. j a v a 2s . c o m This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the license, or (at your option) any later version. */ import javax.swing.*; import java.awt.*; public class Main { /** * The title for message boxes. */ public static final String MESSAGE_TITLE = "jclasslib"; /** * Show a <tt>JOptionPane</tt> message dialog. * * @param parent parent component * @param message the message string * @param messageType the message type as defined in <tt>JOptionPane</tt> */ public static void showMessage(Component parent, String message, int messageType) { if (parent != null && !(parent instanceof Window)) { parent = SwingUtilities.getAncestorOfClass(Window.class, parent); } JOptionPane.showMessageDialog(parent, message, MESSAGE_TITLE, messageType, null); } }