Here you can find the source of yesTo(String message, Component parent)
Parameter | Description |
---|---|
message | the message to show. |
parent | Parent component of this dialog. |
public static boolean yesTo(String message, Component parent)
//package com.java2s; /******************************************************************************* * Copyright (c) 2009-2014 Black Rook Software * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html ******************************************************************************/ import java.awt.Component; import javax.swing.JOptionPane; public class Main { /**//w w w . j a va 2 s .c o m * Displays a confirmation window asking a user a yes or no question. * @param message the message to show. * @return true if "yes" was clicked. false otherwise. */ public static boolean yesTo(String message) { return yesTo(message, null); } /** * Displays a confirmation window asking a user a yes or no question. * @param message the message to show. * @param parent Parent component of this dialog. * @return true if "yes" was clicked. false otherwise. */ public static boolean yesTo(String message, Component parent) { int c = JOptionPane.showConfirmDialog(parent, message, "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); boolean out = c == JOptionPane.YES_OPTION; return out; } }