This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with a program...

 
Adam Polak
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a couple of problems with the following problem.
The color for the circel and the ovaal objects are set to red but change when you add them both. Also if you start with circle you'll get ovaal out of it. I want them to co exist together...
If I change the place of the line in the Y-scale but not in the X-scale it becomes longer instead of moving.
Hope you can help!

 
Marilyn de Queiroz
Sheriff
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm seeing more than one problem. First of all I suggest that you initialize your vorm1, lijn1, cir1, and ov1. Maybe something like this in init():

vorm1 = new Vorm(0,0);
lijn1 = new Lijn(0,0,0,0);
cir1 = new Circel(0,0,0);
ov1 = new Ovaal(0,0,0);

This will help with the NullPointerExceptions.

Second, I think part of the problem is due to polymorphism. Try putting the
vorm1.laatZien( g ,Color.red );
line at the end of the print() method and see if that helps you get what you want.
[ February 16, 2003: Message edited by: Marilyn de Queiroz ]
 
Marilyn de Queiroz
Sheriff
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I change the place of the line in the Y-scale but not in the X-scale it becomes longer instead of moving.

Should this be

y0 = y0 + dy ;

??
 
Adam Polak
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right in your second post but the first one doesn't make a difference...
 
Adam Polak
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone else who could help me out with this?
 
Marilyn de Queiroz
Sheriff
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmmm. That's odd. When I changed from

to

it made a big difference in the way the applet ran for me.

Are you using the appletviewer or a browser? If a browser, which one?

Vorm = form, Lijn = line, Circel = circle, and Ovaal = oval, right? What does laatZien mean? What does verplaats mean?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic