I made this class:
class InOb {
int i, j;
boolean pass = true;
public InOb(int si, int sj) {
i = si;
j = sj;
}
public void drs(Graphics g, int xplus, int yplus, Container cont) {
tileIcon.paintIcon(cont, g, xplus, yplus);
g.drawLine(xplus, yplus, xplus + 50, yplus);
g.drawLine(xplus, yplus, xplus, yplus + 50);
g.drawLine(xplus + 50, yplus + 50, xplus + 50, yplus);
g.drawLine(xplus + 50, yplus + 50, xplus, yplus + 50);
g.drawString("its" + i + " " + j, xplus + 5, yplus + 30);
}
}
works fine.
But:
class Bush extends InOb {
public void drs(Graphics g, int xplus, int yplus) {
g.drawLine(xplus, yplus, xplus + 50, yplus);
g.drawLine(xplus, yplus, xplus, yplus + 50);
g.drawLine(xplus + 50, yplus + 50, xplus + 50, yplus);
g.drawLine(xplus + 50, yplus + 50, xplus, yplus + 50);
g.drawString("its" + i + " " + j, xplus + 5, yplus + 30);
}
}
doesn't work - it says:
Move/Move.java [39:1] cannot resolve symbol
symbol : constructor Bush (int,int)
location: class Move.Bush
bits [0] [i] = new Bush(0, i);
^
Move/Move.java [143:1] InOb(int,int) in Move.InOb cannot be applied to ()
class Bush extends InOb {
^
2 errors
Errors compiling Move.
please help!
11-08-2004, 06:02 PM
Kram
symbol : constructor Bush (int,int)
location: class Move.Bush
bits [0] [i] = new Bush(0, i);
means that you are trying to create an object of class type "Bush" by passing it 2 int values. This wont work becuase you need to define a constructor for that class that takes 2 int values as parameters.
In other words, it is looking for a constructor in the class "Bush" that it cant find
as for the second error i think your going to have to show us more code, it looks like it is trying to apply some sort of calculation or something on an erronous type, maybe just a syntax error somewhere, but im not sure, ill leave it open for someone to have a crack at
11-09-2004, 08:04 AM
JJS
never mind-
i've solved it now - i had do add the constructor with super(InOb(si, sj));
which works