Here you can find the source of queryInt(String message, int initialValue)
Parameter | Description |
---|---|
message | a parameter |
initialValue | a parameter |
Parameter | Description |
---|---|
Exception | an exception |
public static int queryInt(String message, int initialValue) throws Exception
//package com.java2s; import javax.swing.JOptionPane; public class Main { /**/* ww w.j a v a 2s. co m*/ * Queries the User for an Integer value using Swing. * @param message * @param initialValue * @return * @throws Exception */ public static int queryInt(String message, int initialValue) throws Exception { String input = JOptionPane.showInputDialog(message, "" + initialValue); if (input == null) throw new Exception("Selection aborted"); return Integer.parseInt(input); } }