aspose file tools*
The moose likes Beginning Java and the fly likes Problems with a program... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problems with a program..." Watch "Problems with a program..." New topic
Author

Problems with a program...

Adam Polak
Greenhorn

Joined: Oct 28, 2002
Posts: 23
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

Joined: Jul 22, 2000
Posts: 9044
    
  10
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 ]

JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
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

Joined: Oct 28, 2002
Posts: 23
You are right in your second post but the first one doesn't make a difference...
Adam Polak
Greenhorn

Joined: Oct 28, 2002
Posts: 23
Anyone else who could help me out with this?
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems with a program...