It did work, how ever my code has been polished and the random generators are now in the constructor. Infact new values are no longer created like that, myX, myY, ect only get values set to them...
Type: Posts; User: Spidey1980
It did work, how ever my code has been polished and the random generators are now in the constructor. Infact new values are no longer created like that, myX, myY, ect only get values set to them...
they do get in there though. the random numbers get to the constructor because I did not declare them private. I was having a problem using the random in the constructor because my star.class was...
validate(); has the same result as repaint();
complete code so far:
StarScape.java
// starscape.java
// by Jon Crawford
import Star.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
That's better... I had forgot java wants two constructors:
public Star()
{
for (int num = 0;num < 9; num++)
{
starField[num] = 0;
}// end for
lol and yet it works. I did not want to become a hacker....
and when I remove the void it tells me I forget to add a return.
Is this because I forgot to put in a default constructor, and I just...
They are being passed, your only seeing half the code here. It does work I assure you, I just want to make it so it is not system crippling.
The constructor:
public void Star(double myX,...
Thought that was calling the constructor
I still have more reading to do on threads, I gotta go to work soon so I'm leaving that till tonight
lol doIt should be converted to a thread i guess.
...
how do I force a repaint?
I thought
stars[index] = new Star();//fill array with stars
was calling the consrtuctor
okay it sort of works. I have to keep resizing the window to see the animation. Is there a way to make it run on it's own without the need to resize the window to see the next frame?
here is the...
Thank you. I will post back after some re-coding.
unless they need a for loop.
I'm not gonna Star1..Star2....Star1000. on 1000 different lines
Can repaint be called outside of a thread, yet inside a method? (is using a thread absolutely...
so in other words, the paint method should just loop through the total number of stars one time, moving each star one time. then in the do...while some where else a repaint() will call the paint...
I am confused as to this point. I just spent 4 hours last night trying to put the animation loop of my StarScape outside of the paint method so that my code does not cripple the system, and have hit...