Here you can find the source of showMessage(String msg)
public static void showMessage(String msg)
//package com.java2s; /*//from www. jav a 2 s.co m * This file is part of Giswater * Copyright (C) 2013 Tecnics Associats * * This program 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Author: * David Erill <derill@giswater.org> */ import java.awt.Component; import java.util.ResourceBundle; import java.util.logging.Logger; import javax.swing.JOptionPane; public class Main { private static Logger logger; private static ResourceBundle bundleText; public static void showMessage(String msg) { showMessage(msg, ""); } public static void showMessage(String msg, String param) { showMessage(null, msg, ""); } public static void showMessage(Component comp, String msg) { showMessage(comp, msg, ""); } public static void showMessage(Component comp, String msg, String param) { String userMsg = getBundleString(msg); if (!param.equals("")) { userMsg += "\n" + param; } if (logger != null) { String infoMsg = getBundleString(msg); if (!param.equals("")) { infoMsg += "\nParameter: " + param; } logger.info(infoMsg); } JOptionPane.showMessageDialog(comp, userMsg, getBundleString("inp_descr"), JOptionPane.INFORMATION_MESSAGE); } public static String getBundleString(String key) { return getBundleString(bundleText, key); } public static String getBundleString(ResourceBundle bundle, String key) { try { return bundle.getString(key); } catch (Exception e) { return key; } } }