2017-05-15 7 views
0

を見つけることができません私はhttps://github.com/HassanAlthaf/AlarmApplication からJava FXMLアプリをダウンロードして、私はMainView.javaクラスからエラー「のシンボルを見つけることができません」を取得、それを実行しようとします。ここでMainview.javaからコードがファイルであるのJava FXMLアプリが動作していないが - シンボルエラー

import java.net.URL; 
import java.util.ResourceBundle; 
import javafx.event.ActionEvent; 
import javafx.fxml.FXML; 
import javafx.fxml.Initializable; 
import javafx.scene.control.Alert; 
import javafx.scene.control.Alert.AlertType; 
import javafx.scene.control.TextField; 
public class MainView implements Initializable { 

@FXML 
private TextField hoursField; 

@FXML 
private TextField minutesField; 

@FXML 
private TextField secondsField; 

private final AlarmController alarmController; 

@FXML 
private void startAlarm(ActionEvent event) { 
    int response = this.alarmController.startAlarm(
     this.hoursField.getText(), 
     this.minutesField.getText(), 
     this.secondsField.getText() 
    ); 

    if (response == Alarm.ERROR_INVALID_INPUT) { 
     this.showWarning("Please enter a number only for the times!", "Invalid input received"); 
    } else if (response == Alarm.ERROR_ALARM_ALREADY_ON) { 
     this.showWarning("An alarm is already running at the moment! If you wish to override the current alarm, please stop it first!", "Cannot override current alarm."); 
    } else if (response == Alarm.ERROR_NO_TIME_SET) { 
     this.showWarning("You cannot set an alarm for 0 seconds! Please set a realistic time.", "No time set"); 
    } else { 
     this.showSuccessfulMessage("Successfully scheduled alarm!", "Success"); 
    } 
} 

public void showWarning(String message, String title) { 
    Alert alert = new Alert(AlertType.WARNING); 
    alert.setTitle(title); 
    alert.setHeaderText(null); 
    alert.setContentText(message); 
    alert.showAndWait(); 
} 

public void showSuccessfulMessage(String message, String title) { 
    Alert alert = new Alert(AlertType.INFORMATION); 
    alert.setTitle(title); 
    alert.setHeaderText(null); 
    alert.setContentText(message); 
    alert.showAndWait(); 
} 

@FXML 
private void stopAlarm(ActionEvent event) { 
    this.alarmController.stopAlarm(); 

    this.showSuccessfulMessage("Successfully stopped the alarm!", "Success"); 
} 


public MainView() { 
    this.alarmController = new AlarmController(); 
} 

@Override 
public void initialize(URL url, ResourceBundle rb) { 

}  

}

+2

を経由して、それを更新することで、それは見つけることができませんか? –

+0

スタックトレースを提供できますか? – Michael

+0

@Michaelどうすればいいですか? –

答えて

0

あなたのエラーメッセージは次のようになります。

[javacの]シンボルに

[javacのを見つけることができません] import javafx.scene.control.Alert;

[javac] ..........................................^

[javacの】記号:クラスアラート

それはコメントで述べたように:Alertクラスは、Java 8u40で導入されています。 8u40リリースで追加された変更点については、see this Oracle blog postを参照してください。

ので:あなたのJava分布はどちらか、更新by downloading it on the Oracle page、またはシンボルであるsudo apt-get update && sudo apt-get install openjdk-8-jdk openjfx -y

関連する問題