Re: JOptionPane not working?
Can you make a small, complete program that compiles, executes and show the problem?
Did you read the API doc for that exception?
Re: JOptionPane not working?
Edit: API doc?
It is a small program that I just used just to see if the JOptionPane would work. It compiles. When I run it, it displays what I quoted in my original post
Code :
import javax.swing.JOptionPane;
public class Project0
{
public static void main(String [] args){
String name="";
int age=0;
name=JOptionPane.showInputDialog(null, "Please enter your name: ");
age=Integer.parseInt(JOptionPane.showInputDialog(null, "Please enter your age: "));
JOptionPane.showMessageDialog(null, "Hello" + name + ". You are " + age + "years old!");
}
}
Re: JOptionPane not working?
Quote:
java.awt.HeadlessException
That's a class. It is documented in the Java API doc: Java Platform SE 7
It works on my Windows7 system.
Re: JOptionPane not working?
Thanks for the link.
So I have to have this Java Platform on my computer in order for the JOptionPane to work?
Re: JOptionPane not working?
You must have a java program to have gotten the error message.
Does this mean anything: No X11 DISPLAY variable was set,
Re: JOptionPane not working?
^I have no idea what the message means. :(
Huh... looking at my applications, it seems that Java VisualM came with the Macintosh. Does that mean anything?
Re: JOptionPane not working?
I ran it on Eclipse and it worked fine. I guess Terminal doesn't do GUIs?