我刚刚开始在我的编程中实现 Apache Pivot,但我遇到了@Override
. 我得到一个错误代码:
“Chief 类型的方法 shutdown(boolean) 必须覆盖或实现超类型方法”
这是我的代码非常简单,但无法让它工作。我用 . 标记了发生错误的位置//Error resides here
。
package portal;
import java.awt.Color;
import java.awt.Font;
import org.apache.pivot.collections.Map;
import org.apache.pivot.wtk.Application;
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.HorizontalAlignment;
import org.apache.pivot.wtk.Label;
import org.apache.pivot.wtk.VerticalAlignment;
import org.apache.pivot.wtk.Window;
public class Chief {
private Window window = null;
//Error resides here
@Override
public void startup(Display display, Map<string, String> properties) {
window = new Window();
Label label = new Label();
label.setText("Hello World!");
label.getStyles().put("font", new Font("Arial", Font.BOLD, 24));
label.getStyles().put("color", Color.RED);
label.getStyles().put("horizontalALignment",
HorizontalAlighnment.CENTER);
label.getStyles().put("verticalAlignment",
VerticalALignment.CENTER);
window.setContent(label);
window.setTitle("Hello World!");
window.setMaximized(true);
window.open(display);
}
//Error resides here
@Override
public boolean shutdown(boolean optional) {
if (window !=null) {
window.close();
}
return false;
}
//Error resides here
@Override
public void suspend() {
}
//Error resides here
@Override
public void resume() {
}
}