Code Comments
Programming Forum and web based access to our favorite programming groups.Is there a way I can prefill a JOptionPane.showInputDialog()? (User fills in from scratch by I want to put something that s/he can edit)
Post Follow-up to this messageOn Sat, 29 Mar 2008 13:18:56 -0700 (PDT), alex_us01 <arisalex@gmail.com> wrote, quoted or indirectly quoted someone who said : >Is there a way I can prefill a JOptionPane.showInputDialog()? > >(User fills in from scratch by I want to put something that s/he can >edit) the term you are looking for is "default", and yes. String constellationName = (String)JOptionPane.showInputDialog( this, "Enter unique new constellation name:", "New Constellation", JOptionPane.QUESTION_MESSAGE, null /* icon */, null /* possibilities */, null /* default */ ); -- Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Post Follow-up to this messageI think there is a function in that class that lets u pass an array of components to be displayed. http://groups.google.com/group/java...eloupment?hl=en
Post Follow-up to this messageOn Mar 31, 4:48=A0am, Chase Preuninger <chasepreunin...@gmail.com> wrote: > I think there is a function in that class that lets u pass an array of > components to be displayed. Is this supposed to be a sig? A sig. is normally delimited by a single line containing '-- '*, followed by a name or equivalent, then any message or promotion such as.. > http://groups.google.SPAm/group/jav...oupment?hl=3Den =2E.this. See my reply for an example. Be warned that I will report you to Google for any further posts to the comp.lang.java.* groups where you promote your toy group without any attempt at a correct sig. * But note that GG posters such as you and I are unable to post correct sig. delimiters due to our damaged WITUN. -- Andrew T. PhySci.org
Post Follow-up to this messagealex_us01 wrote: > Is there a way I can prefill a JOptionPane.showInputDialog()? > > (User fills in from scratch by I want to put something that s/he can > edit) > There are many functions that do so. Did you try Google? Seriously, if you know the class name, you should be able to find what you are looking for in the online Javadocs. It's the best way of looking stuff up, imo. Google for "java classname se 6" to find the latest APIs. For example, Google "java JOptionPane.showInputDialog se 6" goes here: <http://java.sun.com/javase/6/docs/a...OptionPane.html> And you can see there are several forms of showInputDialog() that allow you to pass various values. The last one in particular may be of interest to you. static String showInputDialog(Component parentComponent, Object message) Shows a question-message dialog requesting input from the user parented to parentComponent. static String showInputDialog(Component parentComponent, Object message, Object initialSelectionValue) Shows a question-message dialog requesting input from the user and parented to parentComponent. static String showInputDialog(Component parentComponent, Object message, String title, int messageType) Shows a dialog requesting input from the user parented to parentComponent with the dialog having the title title and message type messageType. static Object showInputDialog(Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue) Prompts the user for input in a blocking dialog where the initial selection, possible selections, and all other options can be specified. static String showInputDialog(Object message) Shows a question-message dialog requesting input from the user. static String showInputDialog(Object message, Object initialSelectionValue) Shows a question-message dialog requesting input from the user, with the input value initialized to initialSelectionValue.
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.