[Mark Quin:] serialVersion because Big Brother is watching That stuff goes in Meaningless Drivel
[Mark Quin:] trying to get just the Top Left and center left square to work Go ahead and allocate something, if you know how, that will be all the squares and just use the top left one or something.
What are ttl, ctl and tcl and so on ?
In one line you assign a numeric to indicate square taken, in another boolean - try to make some consistency and since taken is by nature boolean ... then make the variable boolean.
You do
if (event.getY()>= 100 && event.getY()<= 200){ which is correct in that it does or is a placeholder for error checking, but if the whatchamacallit passes the
test, then drop directly into making the square's boolean consistent with that test. Also there is no
System.out.println() when I tried to prototype my GUI over the last month: You have to do something along the lines of a Dialog Box or have a text field or text area that you put such stuff up in ~ There is probably a status bar class in swing: try
Java Code Example: JStatus Bar which is probably not the ideal collection of java advices but his window drawing code looks more conformant than that which you posted.
[Mark Quin:] Demonstrate class extension and mouse listeners. Is this homework ? We don't do homework.
private static final long serialVersionUID = 1L; You have got it wrong anyway and I don't think it is gonna be used much longer anyway and so just don't use it right now unless a Really Big Brother says you have to, it will not affect compiles or testing as you posted it.
private Display it; Well if it is 'other classes' then it should not be private, make it public and what is it for ?
Your //Set up a window and // add Display are well meaning, and may well display a displayable window but are characteristic of someone who has not spent enough time in the tutorials, just spend more time there -> that is what I have to do.
Look in awt some more for your
//Line spaceing, try to use something that sounds like line or something .... just dig around ... lines can be given state with variables like (Point ,Point) Just write or find something that notes the endpoints in terms of x,y | x,y pairs and then declare multiple variables off of the same data-type, look in
Applet demos, try to stick with JStuff if your compiler and Applet are conformant == do not mix JStuff with awt unless you really, really cannot find another way.
YOur
void mousePressed(MouseEvent event duplicates code seen earlier, something is wrong that would be best analyzed by Object Oriented Camp - there are plenty of them here @ Java Ranch and should speak up for you.
You should do
this.getContentPane.add(new Display),also you need to hava a type to the left of
it = new Display(); the type would be display.
A typical varable declaration looks like this:
The second one is called an Object, everyting in Java is either an Object, a primitive or an Array, but an array looks like
There is also an Array class, but it is a class and not an array.
If you are gonna code in computer science, you will see enough of stuff like this last sentence that it will become second self, no big deal.