Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

First applet  RSS feed

 
Linda Guy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And yes, it is homework. However I'm not asking for anyone to do it for me!

We are using Eclipse SDK Ver. 3.2

The problem:
make an applet like this...
3D Ball

I figure to use the circle from the smile face code in our book(Problem Solving with Java) and insert two ovals within it at different widths. This is the code I have so far...



The part in bold is just to remind me of what I want to do. He also wants the source as "<applet code="minor3.class" Width=115 height=115>
</applet>"

Now my questions are....

Can I accomplish my goal this way?

Am I missing any steps that need to be done?

Is this the correct Import and public class to use to end with a "minor3.class"?

I'm almost 60 yrs. old, and suck at math, can someone please help me set the math involved? (This is the only part I will ask for someone to do it )

I don't know how the younger generation learns this stuff so quick!

Thanks,
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For this case, it may be best to use the JavaDoc for the Graphics class to understand the drawOval() method -- the parameters are pretty straightforward.


But... "Fedje", Welcome to the JavaRanch.

You may not have noticed that we have a policy on screen names here at the ranch. It must consist of a first name, a space, and a last name. It must also not be fictitious.

Unfortunately, your screen name does not seem to conform with this policy. Please take a moment to change it.

Thanks,
Henry
[ October 08, 2006: Message edited by: Henry Wong ]
 
Linda Guy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Henry, that helps a little. I've been all over the Internet with tutorials etc., and never found that one. I hope it sets up the same way.

Sorry about the name, it's fixed.
 
Linda Guy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I've been working on this off and on all afternoon. An applet will come up but not initialize. I get one error I can't find out how to fix. In the methods section the 'void' shows the error..."Syntax error on token "void", Identifier expected after this token."

How can I fix this? I'm getting a headache.
(But I'm so proud I got this far!)

Thanks, Here's my code so far....

 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I've been working on this off and on all afternoon. An applet will come up but not initialize. I get one error I can't find out how to fix. In the methods section the 'void' shows the error..."Syntax error on token "void", Identifier expected after this token."


You need to be able to successfully compile an applet before you can run it -- so I am not sure what you mean by "Applet will come up but not initialize", as you seem to be describing a compile problem.

Anyway, the compiler generally provides the file and line number location it thinks the problem is. You need to use the editor on the file, go to that line, and tell us where it is. We can't exactly tell from the post.

But if I had to take a guess on where the compile error is ...



This is not a valid syntax. First, you never named the method. Second, putting the semicolon between the parameter list and the open brace, is probably not what you intended. Third, if you meant the paint() method, then the method should not be static...



BTW, you still have other problems. But this is probably the main one that you are encountering...

Henry
 
Linda Guy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
THANKS HENRY!! That was the place I was trying to say. I now have the circle! There's hope for this old lady yet! Now to work on the ovals inside it.

Think I can figure it out before Wednesday when it's due?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!