aspose file tools*
The moose likes Beginning Java and the fly likes Newbie is missing something... (javax.swing) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Newbie is missing something... (javax.swing)" Watch "Newbie is missing something... (javax.swing)" New topic
Author

Newbie is missing something... (javax.swing)

Bryant Evans
Greenhorn

Joined: Jan 31, 2009
Posts: 3
Hi everyone. I am quite new at this and am trying to write a little piece of code. I keep getting errors in NetBeans 6.1 and I am wondering what I am missing.

Here's the code:



The problem seems to surround JoptionPane. I am getting an error saying it cannot find the symbol.

Thanks for your help and guidance!
Bryant
Brian Pianczk
Ranch Hand

Joined: Jan 26, 2009
Posts: 45
Don't forget Java is case sensitive. Double check your import message.
Bryant Evans
Greenhorn

Joined: Jan 31, 2009
Posts: 3
Thanks! I only looked at it for a half hour trying to figure out what was wrong. I feel like I just called the Maytag repairman who discovered my washer wouldn't run because it was unplugged!




Bryant
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2316
    
  49
When you get compiler errors it pays to look very carfeully at the error message as it generally tells you exactly what's wrong. When the compiler says it can't find a symbol it often means either you haven't declared whatever you are referring to or you haven't spelled it correctly (the wrong case being a particularly common problem).
Mo Jay
Ranch Hand

Joined: Feb 16, 2009
Posts: 83
Your code is correct except that JoptionPane should be JOptionPane that's all.

Good luck!
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8829
    
    5
Hi Bryant -

It's hard to tell how much experience you have based on what you said, but if you're really new to Java I'd steer clear of Swing for a while. You can do a lot and learn a lot from the command line. For instance, you might start off by just doing a simple program that uses the new Console class - which provides an easy way to get input from the command line and send output to the command line.

Swing is really intense no matter how simple your goals, and frankly it gets in the way of learning the important parts of Java.

hth,

Bert


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39409
    
  28
Agree with Bert. And stop using NetBeans until you are more experienced.
Most people consider using a JOptionPane dialogue like that old-fashioned programming; if you are using Java5 or Java6 try using Scanner instead. This is your code, altered:Note: the Scanner#next method will take a single word; if you want several words use nextLine() instead. I haven't tested that code for spelling errors.
Bryant Evans
Greenhorn

Joined: Jan 31, 2009
Posts: 3
HI guys and thanks for the suggestions. I came across this in a workbook put out by JEDI in 2006. I am actually working through a Sun tutorial for beginners, the CDJ110 series and I am mostly using JEdit or Notepad. I confess to my frustrations at not moving faster but the slower pace is much better and things are beginning to stick. I still struggle some with the right syntax and spend a lot of time going back and looking up the right syntax. I guess that will improve.

I have NetBeans and MyEclipse on my computer but found that try to learn the language and the IDE was too troublesome and confusing for now. So, for the foreseeable future it is command line for me!

FWIW, Scanner does look simpler and more intuitive.

Thanks again!

Bryant
Brian Pianczk
Ranch Hand

Joined: Jan 26, 2009
Posts: 45
Bryant, Google Notepad++, and give it a try. It is rather nice for java. Doesn't have all the bells and whistles of an IDE, but it does highlight java reserved words, curly brackets and parenthesis, which makes life a little easier.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39409
    
  28
Good idea, moving slowly and avoiding IDEs at this stage.

Agree about Notepad++. A lovely application. But jEdit will do quite a lot of that too. Avoid ordinary Notepad for programming, however.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Newbie is missing something... (javax.swing)