[英]No Suitable Method Found
這是我嘗試調用的方法。
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();
}
這是嘗試使用它的代碼。
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);
}
update方法位於一個名為GridLayout的類中,我嘗試僅使用GridLayout.update(aninteger);。 但這對我沒有用。
您需要GridLayout對象的實例才能調用更新函數。
不知道GridLayout與您現有代碼的關系,我無法進一步提出建議。 但是,如果GridLayout是一個臨時對象,則可以嘗試:
GridLayout worker = new GridLayout(... whatever ...);
worker.update(aninteger);
否則,您可能需要從所涉及的框架中獲取它,或者遵循以下方式:
this.getGridLayout().update(aninteger);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.