Look at the Random class. It has many methods to choose from.
Get the System time and test if its odd or even.
Type: Posts; User: Norm
Look at the Random class. It has many methods to choose from.
Get the System time and test if its odd or even.
// A class to save the starting and ending x,y coords for a line
class LineCoords {
int firstX;
int firstY;
int endX;
int endY;
// draw the above line
public void drawLine(Graphics...
Use classes to hold the properties of the figures vs using arrays.
If the center coords require too much programming, then save the x,y for the upper left corner vs the center.
What is random...
Ok, drawing the lines and repositioning them when the component changes size is solved.
Now you want to draw an image in one of the nine squares created by the lines.
Is that the problem?
A...
Which problem is this one? I thought we were working on how to draw the lines for the 3x3 grid.
What goes in the squares of the grid was going to be a simple "X" or "O" drawn by drawString().
...
Which problem are you working on? One at a time is better.
You compute the x,y of the ends of the lines and save them for the paint method to use.
If getting a image is a problem right now, leave it until later to solve.
Use something simple to get the logic working for now. Something like: drawString(x,y, "X") for example.
Ok, we'll want until you get a new design.
Are you asking how to choose which image to display?
See the Random class. It has methods to return random values that you could use to choose which image to display.
Again you can use the...