Here you can find the source of promptForString(Component parentComponent, String message, String title, String oldValue)
Parameter | Description |
---|---|
message | the prompt message |
title | the dialog title |
oldValue | the original string value |
static public String promptForString(Component parentComponent, String message, String title, String oldValue)
//package com.java2s; //License from project: Open Source License import java.awt.Component; import javax.swing.JOptionPane; public class Main { /**//from w ww .java 2 s . co m * Utility function to prompt for new string value * * @param message the prompt message * @param title the dialog title * @param oldValue the original string value * @return the new string value */ static public String promptForString(Component parentComponent, String message, String title, String oldValue) { String result = oldValue; String newValue = (String) JOptionPane.showInputDialog(parentComponent, message, title, JOptionPane.PLAIN_MESSAGE, null, null, oldValue); if (newValue != null) { result = newValue; } return result; } }