59 lines
1.6 KiB
Java
59 lines
1.6 KiB
Java
package workshop;
|
|
|
|
import javafx.fxml.FXML;
|
|
import javafx.scene.control.Alert;
|
|
import javafx.scene.control.Label;
|
|
import javafx.scene.control.Button;
|
|
|
|
public class Controller {
|
|
@FXML public Label basicPriceLabel;
|
|
@FXML public Label ProPriceLabel;
|
|
@FXML public Label enterPrisePrice;
|
|
@FXML private Label titleLabel;
|
|
@FXML private Button themeToggle;
|
|
|
|
private boolean isDark = true;
|
|
|
|
@FXML
|
|
private void initialize(){
|
|
basicPriceLabel.setText("$12.99 / month");
|
|
ProPriceLabel.setText("$20.66 / month");
|
|
enterPrisePrice.setText("Join us");
|
|
}
|
|
|
|
@FXML
|
|
private void buyBasic() {
|
|
showAlert("Bacis plan Selected",Alert.AlertType.INFORMATION);
|
|
}
|
|
|
|
@FXML
|
|
private void buyPro() {
|
|
showAlert("Pro plan Selected",Alert.AlertType.WARNING);
|
|
}
|
|
|
|
@FXML
|
|
private void buyEnterprise() {
|
|
showAlert("Enter price Selected",Alert.AlertType.CONFIRMATION);
|
|
}
|
|
|
|
@FXML
|
|
private void toggleTheme() {
|
|
isDark= !isDark;
|
|
themeToggle.getScene().getStylesheets().clear();
|
|
if(isDark){
|
|
themeToggle.getScene().getStylesheets().add(getClass().getResource("style.css").toExternalForm());
|
|
themeToggle.setText("Switch to light mood");
|
|
}
|
|
else{
|
|
themeToggle.getScene().getStylesheets().add(getClass().getResource("light.css").toExternalForm());
|
|
themeToggle.setText("Switch to Dark mood");
|
|
}
|
|
}
|
|
|
|
private void showAlert(String msseage, Alert.AlertType alertType) {
|
|
Alert alert = new Alert(alertType);
|
|
alert.setHeaderText(msseage);
|
|
alert.show();
|
|
}
|
|
}
|