Reputation: 340
This is the method im trying to invoke.
public void update(int status) {
if (status == 1)
{
setBorder(new LineBorder(Color.YELLOW, BORDERSIZE+1));
}
else if (status == 2)
{
setBorder(new LineBorder(Color.CYAN, BORDERSIZE+1));
}
else if (status == 3)
{
setBorder(new LineBorder(Color.BLACK, BORDERSIZE));
}
revalidate();
}
This is the code trying to use it.
private void handleMouseClick(int x, int y, int button) {
try {
// This is called by the board squares when they are clicked
// Handle the logic of updates to the client/game here
if(button == 1){
if(x != -1 && y != -1){
update(1);
x = -1;
y = -1;
updateGrids();
}
else{
update(3);
}
}
else if(button == 3){
}
}
catch (IOException ex) {
System.err.println(ex);
}
The update method is inside a class called GridLayout, I've tried to just simply use GridLayout.update(aninteger); but it didn't work for me.
Upvotes: 0
Views: 201
Reputation: 8583
You need an instance of GridLayout object in order to call the update function.
Withouth knowning how GridLayout is related to your existing code I cannot advice further. However if GridLayout is a temporary object you could try:
GridLayout worker = new GridLayout(... whatever ...);
worker.update(aninteger);
Otherwise, you might need to get it from the framework involved, or something along these lines:
this.getGridLayout().update(aninteger);
Upvotes: 1