File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes need help! (one error) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "need help! (one error)" Watch "need help! (one error)" New topic
Author

need help! (one error)

federico elbl
Greenhorn

Joined: Oct 14, 2003
Posts: 13
Hi, I'm new with Java, and I need help with a program that I wrote.
It needs to prompt the user for the x value, the y value, and the radius value, and then display the info in a JTextArea. Is giving me the following error:

I don't know what I'm doing wrong. I would really appreciate your help with this. This is the code i have:

Thanks a lot
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

You've got a close bracket labelled "end main", but you've actually not got the beginning of a main() method, or any methods. You've written all the code inside the scope of the class itself, and this isn't legal. Classes can contain member variable declarations, but they can't contain statements -- statements (like "x = Integer.parseInt(...)") have to be inside a method.


[Jess in Action][AskingGoodQuestions]
federico elbl
Greenhorn

Joined: Oct 14, 2003
Posts: 13
Thanks a lot. Now is giving me these three errors:

federico elbl
Greenhorn

Joined: Oct 14, 2003
Posts: 13
Thanks a lot. Now is giving me these three errors:

Carl Pettersson
Ranch Hand

Joined: Sep 09, 2003
Posts: 73

Since you end the statement where you add text to the string with a ; it doesn't understand what you are doing. Replace the ; which I have marked with a +. After that change you will probaly get an error that says you cant use the += operator on a string, so replace it with .= which means append.
federico elbl
Greenhorn

Joined: Oct 14, 2003
Posts: 13
thanks a lot carl! i made that work, but now the jtextarea is not working. is giving me this error:

/tmp/26198/CircleTest.java:48: cannot resolve symbol
symbol : method showMessageDialog (,javax.swing.JTextArea,int)
location: class javax.swing.JOptionPane
JOptionPane.showMessageDialog( null, output, JOptionPane.INFORMATION_MESSAGE );
^
1 error
and this is the code i have:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help! (one error)