• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validate()

 
Dave Morley
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I really need either someone to check out the code that I have written for a basic Java Course and explain in simple terms to me why the applet is not displaying correctly or (B) explain validate to me in simple terms or (C) can any show me where to get an idiots guide to all the classes and commands within Java. I have the java docs on PC but you need to know quite a lot of Java to be able to make sense of it and I have just begun.

Any Help is greatlt appreciated.
Many Thanks
Dave M
Cape Town
 
Robert Konigsberg
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yuch,

I hate when I am in your situation.

I would recommend that you try a couple of other things first.

For instance, get out of the Applet. Make an application instead. I happen to know that in the Core Java series they document how to convert Applets to Applications, or vice versa, I can't recall.

Now depending on which JVM you are using on your browser, you're either using AWT or Swing. That doesn't make much of a difference, but you might find it difficult to find documentation on AWT and Applets nowdays, or at least, you might find yourself sifting through Swing documentation when you don't want it.

Go back to basics. Remove pieces and see if things get a little simpler.

Good luck and keep us posted!
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
get out of the Applet. Make an application instead.

Why?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I really need either someone to check out the code that I have written for a basic Java Course and explain in simple terms to me why the applet is not displaying correctly or (B) explain validate to me in simple terms or (C) can any show me where to get an idiots guide to all the classes and commands within Java. I have the java docs on PC but you need to know quite a lot of Java to be able to make sense of it and I have just begun.

Welcome to JavaRanch, Dave!

As far as advice on becoming more familiar and comfortable with Java and GUI things goes, I'd recommend writing a lot of programs. If your course has you do 10 as assignments, do 100. No hyperbole intended.

You also might like to mosey on over to our GUI (Swing / JFC / AWT) forum or our Applet forum, post yer code, and ask a question.
[ July 23, 2004: Message edited by: Dirk Schreckmann ]
 
Paul Santa Maria
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I absolutely agree with Robert's and Dirk's suggestions ...

... but I also absolutely understand your frustration. The Sun Java docs are *not* at all useful unless you have a certain degree of knowledge. Sun's tutorials are an excellent way to acquire that knowledge ... but they're not going to help you get your homework assignment done on time!

I also agree with Robert that you need to "go back to the basics". I would try writing a minimal "Hello world" applet (if you haven't already done so).

Another thing to consider is your browser: perhaps your code is OK, but your browser isn't configured to handle applets. Double check your program with the JDK applet viewer.

Finally, if you're still having problems, please post the text of your "hello world" to one of the Java Ranch groups. We'd all be delighted to help you!

Sincerely .. PSM
 
Dave Morley
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly thanks for the swift response, all of you. What they are doing in this course is getting us to do stand alone programs and then doing the same program as an applet. The programs run this is no problem but in the example that they give in the book, the text label and the field display next to each other nice and neatly down the length of the applet. When I compile and run mine all the components are there but they are all over the place. I have changed the size of the applet in the html tag but I can't seem to get it to display as it should in the book.

Do I take it that applets are on the way out and I should rather concentrate on free standing programs??? I haven't reached the swing section yet !

Thanks
Dave M
Cape Town
 
Marilyn de Queiroz
Sheriff
Posts: 9065
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Applets have their problems with browsers, but learning the GUI stuff is important as lots of people want a GUI interface to their application.

I think your problem is not with validate(), but rather with the type of layout you are using. The default applet layout is FlowLayout which just puts the components sequentially (left to right) in the order they were added.

My guess is that you want something more like GridLayout (arranges the components into rows and columns) even if you only have one column.
 
Robert Konigsberg
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dirk Schreckmann:
get out of the Applet. Make an application instead.

Why?

Because we don't know which JVM he's working with and IMHO they're sometimes inconsistent, and also you're several steps closer to using a debugger with an application over an applet.
 
Robert Konigsberg
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dave Cape Town:

Do I take it that applets are on the way out and I should rather concentrate on free standing programs??? I haven't reached the swing section yet !


Naw, don't do that. Applets have a good place. I like the suggestion of starting with a "Hello, World" applet. I think you might want to look at the browser's JVM console. Depends on your browser, OS and JVM (are you using the Java Plug-In?)

Also, you don't need SWING for an application, you *can* use AWT just fine.
 
Dave Morley
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With regards to the OS and JVM, I am on Win XP home and I am using the java plug in, I am on explorer 6 and SDK 1.4.2_03. With regards to the whole validate() thing , this is some advice I got off the Java Forum on there web site , however I found some of the comments that I received a little condescending, I am not into that, only trying to learn, hence am quite happy I stumbled onto this site.

Many Thanks
Dave M

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic