package BallGame;
import java.awt.*;
import javax.swing.*;
public class BallGame extends JFrame {
//创建窗口
void launchFrame() {
setSize(width;856,height,501);
setLocation(x:100,y:100);
setVisible(true);
}
public static void main(String[] args) {
System.out.println("我的小游戏开始了");
BallGame game = new BallGame();
game.launchFrame();
}
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The field Component.width is not visible
Syntax error on token ";", , expected
The field Component.height is not visible
The field Component.x is not visible
Syntax error on token ":", invalid AssignmentOperator
The field Component.y is not visible
Syntax error on token ":", invalid AssignmentOperator
at BallGame.BallGame.launchFrame(BallGame.java:10)
at BallGame.BallGame.main(BallGame.java:21)
老师请问一下这是为什么呢?是一开始没有定义嘛