本文整理匯總了Java中net.sf.freecol.client.gui.dialog.FreeColStringInputDialog類的典型用法代碼示例。如果您正苦於以下問題:Java FreeColStringInputDialog類的具體用法?Java FreeColStringInputDialog怎麽用?Java FreeColStringInputDialog使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FreeColStringInputDialog類屬於net.sf.freecol.client.gui.dialog包,在下文中一共展示了FreeColStringInputDialog類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showNamingDialog
import net.sf.freecol.client.gui.dialog.FreeColStringInputDialog; //導入依賴的package包/類
/**
* Display a dialog to set a new name for something.
*
* @param template A {@code StringTemplate} for the message
* to explain the dialog.
* @param defaultName The default name.
* @param unit The {@code Unit} discovering it.
* @param handler A {@code DialogHandler} for the dialog response.
*/
public void showNamingDialog(StringTemplate template, String defaultName,
Unit unit, DialogHandler<String> handler) {
SwingUtilities.invokeLater(
new DialogCallback<>(
new FreeColStringInputDialog(freeColClient, frame, false,
Messages.message(template),
defaultName, "ok", null),
unit.getTile(), handler));
}
示例2: showInputDialog
import net.sf.freecol.client.gui.dialog.FreeColStringInputDialog; //導入依賴的package包/類
/**
* Displays a modal dialog with a text field and a ok/cancel option.
*
* @param tile An optional tile to make visible (not under the dialog).
* @param template A {@code StringTemplate} that explains the
* action to the user.
* @param defaultValue The default value appearing in the text field.
* @param okKey A key displayed on the "ok"-button.
* @param cancelKey A key displayed on the optional "cancel"-button.
* @return The text the user entered, or null if cancelled.
*/
public String showInputDialog(Tile tile, StringTemplate template,
String defaultValue,
String okKey, String cancelKey) {
FreeColStringInputDialog fcd
= new FreeColStringInputDialog(freeColClient, frame, true,
Messages.message(template),
defaultValue, okKey, cancelKey);
return showFreeColDialog(fcd, tile);
}