Results 1 to 14 of 14
- 04-30-2012, 09:35 PM #1
Member
- Join Date
- Apr 2012
- Posts
- 88
- Rep Power
- 0
- 04-30-2012, 09:39 PM #2
Re: Help with JOptionPane.showInputDialog
What's a text box?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 04-30-2012, 09:39 PM #3
AN21XX
- Join Date
- Mar 2012
- Location
- Munich
- Posts
- 297
- Rep Power
- 2
Re: Help with JOptionPane.showInputDialog
From the google search "showInputDialog tutorial":
JOptionPane showInputDialog examples | JOptionPane show input | devdaily.comI like likes!.gif)
- 04-30-2012, 09:42 PM #4
Member
- Join Date
- Apr 2012
- Posts
- 88
- Rep Power
- 0
Re: Help with JOptionPane.showInputDialog
I have used that exact coding and I get numerous errors when I try to run javac to create my class file.
The 1st one is error: class, interface or enum expected
EDIT +++
I am using Notepad++ when trying this coding as well, does that have an affect on why I am getting that error?Last edited by Rahim2312; 04-30-2012 at 09:47 PM.
- 04-30-2012, 09:49 PM #5
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,609
- Rep Power
- 5
- 04-30-2012, 09:58 PM #6
Member
- Join Date
- Apr 2012
- Posts
- 88
- Rep Power
- 0
Re: Help with JOptionPane.showInputDialog
Maybe I am just impatient but when I try to upload a screenshot, my screen just shows a gray textbox it never opens up to show what to attach....Let's start with what has been proven to work, not my very newbie code I am trying.
Trying to run the code from the website you provided, I am only getting one error and that is:
class JOptionPaneShowInputDialogExample1 is public, should be declared in a file named JOptionPaneShowInputDialogExample1.java
public class JOptionPaneShowInputDialogExample1
- 04-30-2012, 10:01 PM #7
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,609
- Rep Power
- 5
Re: Help with JOptionPane.showInputDialog
What you posted (or what you were hoping to post - a screenshot) gets no closer to helping us understand what/where the problem is. Please read post 5
- 04-30-2012, 10:06 PM #8
Member
- Join Date
- Apr 2012
- Posts
- 88
- Rep Power
- 0
Re: Help with JOptionPane.showInputDialog
I thought post 5 was saying to provide code, and provide the error?
I was running this code from post # 3
JOptionPane showInputDialog examples | JOptionPane show input | devdaily.com
and I posted the error received. Am I not understanding the post?
- 04-30-2012, 10:34 PM #9
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,609
- Rep Power
- 5
- 04-30-2012, 10:36 PM #10
Member
- Join Date
- Apr 2012
- Posts
- 88
- Rep Power
- 0
Re: Help with JOptionPane.showInputDialog
Apalogies...
Java Code:import javax.swing.*; /** * JOptionPane showInputDialog example #1. * A simple showInputDialog example. * @author alvin alexander, devdaily.com. */ public class JOptionPaneShowInputDialogExample1 { public static void main(String[] args) { // a jframe here isn't strictly necessary, but it makes the example a little more real JFrame frame = new JFrame("InputDialog Example #1"); // prompt the user to enter their name String name = JOptionPane.showInputDialog(frame, "What's your name?"); // get the user's input. note that if they press Cancel, 'name' will be null System.out.printf("The user's name is '%s'.\n", name); System.exit(0); } }
- 04-30-2012, 10:39 PM #11
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,609
- Rep Power
- 5
Re: Help with JOptionPane.showInputDialog
Is the code contained within a file named JOptionPaneShowInputDialogExample1.java, as the error code states?
- 04-30-2012, 10:48 PM #12
Member
- Join Date
- Apr 2012
- Posts
- 88
- Rep Power
- 0
Re: Help with JOptionPane.showInputDialog
It is contained within a file titled Test1.java
- 04-30-2012, 11:02 PM #13
AN21XX
- Join Date
- Mar 2012
- Location
- Munich
- Posts
- 297
- Rep Power
- 2
Re: Help with JOptionPane.showInputDialog
As doWhile said:
One way: Rename the file to JOptionPaneShowInputDialogExample1.java
Other way: Rename the class and its references to Test1 and you may have no error anymoreI like likes!.gif)
- 05-01-2012, 02:10 AM #14
Member
- Join Date
- Apr 2012
- Posts
- 88
- Rep Power
- 0
Similar Threads
-
JOptionPane.showInputDialog with only 1 correct answer
By Gladiat0r in forum New To JavaReplies: 1Last Post: 03-18-2012, 09:42 PM -
string prompt doesn't appear in showInputDialog
By saxophone in forum New To JavaReplies: 4Last Post: 04-01-2010, 10:05 PM -
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