Results 1 to 5 of 5
- 04-01-2010, 07:04 PM #1
Member
- Join Date
- Apr 2010
- Posts
- 4
- Rep Power
- 0
string prompt doesn't appear in showInputDialog
I have the following code...
newSpecialAbilityName = (String) JOptionPane.showInputDialog(parentGUI, "Enter name of Special Ability to add.", "xyz", JOptionPane.PLAIN_MESSAGE, null, null, "");
The result is a dialog box that doesn't display the string, "Enter name of Special Ability to add."
Also, only an OK button appears. There is no Cancel button. I adapted this from a Sun tutorial, and their example shows the Cancel button.
What am I doing wrong?
- 04-01-2010, 07:20 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,399
- Blog Entries
- 7
- Rep Power
- 17
- 04-01-2010, 09:01 PM #3
Member
- Join Date
- Apr 2010
- Posts
- 4
- Rep Power
- 0
java -version yields...
java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)
This is on a MacBook Pro using XCode 3.1.2 if that makes any difference.Last edited by saxophone; 04-01-2010 at 09:02 PM. Reason: additional info
- 04-01-2010, 09:10 PM #4
Member
- Join Date
- Apr 2010
- Posts
- 4
- Rep Power
- 0
I built a simple java program that just uses that statement, and the dialog comes up fine. However, when it is part of my larger program, it doesn't work. So somehow the larger program is doing something that is screwing up the dialog box. I'll dig around some more.
- 04-01-2010, 10:05 PM #5
Member
- Join Date
- Apr 2010
- Posts
- 4
- Rep Power
- 0
Here's some more information on my problem.
Somewhere in the program, I have the following code...
specialAbilitiesTable = new ScrollableTable(pc, new Dimension(810, 90));
JScrollPane specialAbilitiesScrollPane = new JScrollPane(specialAbilitiesTable);
specialAbilitiesScrollPane.setPreferredSize(new Dimension(810, 300));
specialAbilitiesScrollPane.setBounds(0, y, 810, 300);
add(specialAbilitiesScrollPane);
specialAbilitiesTable is an instance of a class that extends JPanel.
If I comment out the add(specialAbilitiesScrollPane) statement, the dialog works as intended.
Similar Threads
-
How to cause a second prompt to run after the first.
By G-Unit in forum New To JavaReplies: 4Last Post: 03-25-2010, 04:47 PM -
Jcreator to DOS Prompt
By arshesander in forum New To JavaReplies: 5Last Post: 02-17-2010, 06:25 AM -
Problem in showInputDialog
By mghaheri in forum New To JavaReplies: 1Last Post: 03-05-2009, 11:29 PM -
JOptionPane.showInputDialog
By mayhewj7 in forum New To JavaReplies: 5Last Post: 02-25-2009, 06:04 AM -
Problem with JOptionPane.showInputDialog()
By romina in forum AWT / SwingReplies: 1Last Post: 08-07-2007, 05:33 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks