Here you can find the source of show(String title, int type, Object message, Object[] options, Object initialOption)
public static Object show(String title, int type, Object message, Object[] options, Object initialOption)
//package com.java2s; /**//from w w w . ja v a2s.co m * ============================================================================================ * Menthor Editor -- Copyright (c) 2015 * * This file is part of Menthor Editor. Menthor Editor is based on TinyUML and as so it is * distributed under the same license terms. * * Menthor Editor 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. * * Menthor Editor 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 Menthor Editor; * if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, * MA 02110-1301 USA * ============================================================================================ */ import javax.swing.JDialog; import javax.swing.JOptionPane; public class Main { /** Helper method for constructing an always-on-top modal dialog. */ public static Object show(String title, int type, Object message, Object[] options, Object initialOption) { if (options == null) { options = new Object[] { "Ok" }; initialOption = "Ok"; } JOptionPane p = new JOptionPane(message, type, JOptionPane.DEFAULT_OPTION, null, options, initialOption); p.setInitialValue(initialOption); JDialog d = p.createDialog(null, title); p.selectInitialValue(); d.setAlwaysOnTop(true); d.setVisible(true); d.dispose(); return p.getValue(); } }