コンパイルエラーを解決する方法を教えていただきたいです。
javac MapGameController.java
MapGameController.java:102: エラー: シンボルを見つけられません
public class MapGame extends Application {
^
シンボル: クラス Application
場所: クラス MapGameController
MapGameController.java:103: エラー: シンボルを見つけられません
Stage stage;
^
シンボル: クラス Stage
場所: クラス MapGameController.MapGame
エラー2個
Java
1import java.net.URL; 2import java.util.ResourceBundle; 3import javafx.fxml.Initializable; 4import javafx.event.ActionEvent; 5import javafx.scene.control.Label; 6import javafx.scene.image.Image; 7import javafx.scene.image.ImageView; 8import javafx.scene.layout.GridPane; 9import javafx.scene.input.KeyEvent; 10import javafx.scene.input.KeyCode; 11import javafx.scene.Group; 12import javafx.scene.control.Alert; 13import javafx.scene.control.Alert.AlertType; 14 15import javafx.animation.*; 16import javafx.event.*; 17import javafx.fxml.*; 18import javafx.scene.control.*; 19import javafx.util.*; 20import java.io.File; 21import java.io.FileWriter; 22import java.io.IOException; 23 24 25 26public class MapGameController implements Initializable { 27 public MapData mapData; 28 public MoveChara chara; 29 public GridPane mapGrid; 30 public ImageView[] mapImageViews; 31// public Group[] mapGroups; 32 33 @Override 34 public void initialize(URL url, ResourceBundle rb) { 35 mapData = new MapData(21,15); 36 chara = new MoveChara(1,1,mapData); 37// mapGroups = new Group[mapData.getHeight()*mapData.getWidth()]; 38 mapImageViews = new ImageView[mapData.getHeight()*mapData.getWidth()]; 39 for(int y=0; y<mapData.getHeight(); y++){ 40 for(int x=0; x<mapData.getWidth(); x++){ 41 int index = y*mapData.getWidth() + x; 42 mapImageViews[index] = mapData.getImageView(x,y); 43 } 44 } 45 mapPrint(chara, mapData); 46 } 47 48 public void mapPrint(MoveChara c, MapData m){ 49 int cx = c.getPosX(); 50 int cy = c.getPosY(); 51 mapGrid.getChildren().clear(); 52 for(int y=0; y<mapData.getHeight(); y++){ 53 for(int x=0; x<mapData.getWidth(); x++){ 54 int index = y*mapData.getWidth() + x; 55 if (x==cx && y==cy) { 56 mapGrid.add(c.getCharaImageView(), x, y); 57 } else { 58 mapGrid.add(mapImageViews[index], x, y); 59 } 60 } 61 } 62 } 63 64 public void func1ButtonAction(ActionEvent event) { } 65 public void func2ButtonAction(ActionEvent event) { } 66 public void func3ButtonAction(ActionEvent event) { } 67 public void func4ButtonAction(ActionEvent event) { } 68 69 public void keyAction(KeyEvent event){ 70 KeyCode key = event.getCode(); 71 if (key == KeyCode.DOWN){ 72 downButtonAction(); 73 }else if (key == KeyCode.RIGHT){ 74 rightButtonAction(); 75 } 76 } 77 78 public void outputAction(String actionString) { 79 System.out.println("Select Action: " + actionString); 80 } 81 82 public void downButtonAction(){ 83 outputAction("DOWN"); 84 chara.setCharaDir(MoveChara.TYPE_DOWN); 85 chara.move(0, 1); 86 mapPrint(chara, mapData); 87 } 88 public void downButtonAction(ActionEvent event) { 89 downButtonAction(); 90 } 91 92 public void rightButtonAction(){ 93 outputAction("RIGHT"); 94 chara.setCharaDir(MoveChara.TYPE_RIGHT); 95 chara.move( 1, 0); 96 mapPrint(chara, mapData); 97 } 98 public void rightButtonAction(ActionEvent event) { 99 rightButtonAction(); 100 } 101 102 public class MapGame extends Application { 103 Stage stage; 104 105 int CountTime=10; 106 @FXML private Label TIMELabel; 107 public void MapGameTimer(int action) { //引数0のときスタート、1のときストップ 108 Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(1), 109 new EventHandler<ActionEvent>() { 110 public void handle(ActionEvent actionEvent) { 111 TIMELabel.setText("TIME:" + String.valueOf(CountTime--)); 112 if(CountTime == 0) { 113 System.out.println("...GAME OVER..."); 114 System.exit(0); 115 } 116 } 117 } 118 )); 119 timeline.setCycleCount(Timeline.INDEFINITE); 120 if (action == 0){ 121 timeline.play(); 122 } else if (action == 1){ 123 timeline.stop(); 124 } 125 } 126} 127} 128
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。