1 31 32 package org.antlr.xjlib.appkit.utils; 33 34 import org.antlr.xjlib.appkit.app.XJApplication; 35 36 import javax.swing.*; 37 import java.awt.*; 38 import java.util.List ; 39 40 public class XJAlertInput { 41 42 public static int showInputDialog(Container parent, String title, String message, List <String > values, Object defaultValue) { 43 Object choosenObject = JOptionPane.showInputDialog(parent==null?XJApplication.getActiveContainer():parent, message, title, 44 JOptionPane.QUESTION_MESSAGE, null, values.toArray(), defaultValue); 45 if(choosenObject == null) 46 return -1; 47 else 48 return values.indexOf(choosenObject); 49 } 50 51 public static String showInputDialog(Container parent, String title, String message, Object defaultValue) { 52 Object choosenObject = JOptionPane.showInputDialog(parent==null?XJApplication.getActiveContainer():parent, message, title, 53 JOptionPane.QUESTION_MESSAGE, null, null, defaultValue); 54 return (String )choosenObject; 55 } 56 57 } 58 | Popular Tags |