added info alert
This commit is contained in:
parent
8ec7653a5e
commit
34371bb2b5
|
@ -31,7 +31,13 @@ import java.util.ResourceBundle;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
import com.jfoenix.controls.JFXAlert;
|
||||||
|
import com.jfoenix.controls.JFXButton;
|
||||||
|
import com.jfoenix.controls.JFXDialogLayout;
|
||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.event.EventHandler;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.Alert;
|
import javafx.scene.control.Alert;
|
||||||
|
@ -40,8 +46,10 @@ import javafx.scene.control.ButtonBar.ButtonData;
|
||||||
import javafx.scene.control.ButtonType;
|
import javafx.scene.control.ButtonType;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
|
import javafx.scene.text.Text;
|
||||||
import javafx.stage.DirectoryChooser;
|
import javafx.stage.DirectoryChooser;
|
||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
|
import javafx.stage.Modality;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
public class Main extends Application {
|
public class Main extends Application {
|
||||||
|
@ -104,6 +112,12 @@ public class Main extends Application {
|
||||||
posterCache = new File(dirLinux + "/posterCache");
|
posterCache = new File(dirLinux + "/posterCache");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// generate window
|
||||||
|
scene = new Scene(pane); // create new scene, append pane to scene
|
||||||
|
scene.getStylesheets().add(getClass().getResource("/css/MainWindow.css").toExternalForm());
|
||||||
|
primaryStage.setScene(scene); // append scene to stage
|
||||||
|
primaryStage.show(); // show stage
|
||||||
|
|
||||||
// startup checks
|
// startup checks
|
||||||
if (!configFile.exists()) {
|
if (!configFile.exists()) {
|
||||||
directory.mkdir();
|
directory.mkdir();
|
||||||
|
@ -119,11 +133,11 @@ public class Main extends Application {
|
||||||
posterCache.mkdir();
|
posterCache.mkdir();
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate window
|
// // generate window
|
||||||
scene = new Scene(pane); // create new scene, append pane to scene
|
// scene = new Scene(pane); // create new scene, append pane to scene
|
||||||
scene.getStylesheets().add(getClass().getResource("/css/MainWindow.css").toExternalForm());
|
// scene.getStylesheets().add(getClass().getResource("/css/MainWindow.css").toExternalForm());
|
||||||
primaryStage.setScene(scene); // append scene to stage
|
// primaryStage.setScene(scene); // append scene to stage
|
||||||
primaryStage.show(); // show stage
|
// primaryStage.show(); // show stage
|
||||||
|
|
||||||
// init here as it loads the games to the mwc and the gui, therefore the window must exist
|
// init here as it loads the games to the mwc and the gui, therefore the window must exist
|
||||||
mainWindowController.init();
|
mainWindowController.init();
|
||||||
|
@ -182,7 +196,6 @@ public class Main extends Application {
|
||||||
// JFXDirStrmCancelDialog selectFirstSource = new JFXDirStrmCancelDialog(bundle.getString("addSourceHeader"),
|
// JFXDirStrmCancelDialog selectFirstSource = new JFXDirStrmCancelDialog(bundle.getString("addSourceHeader"),
|
||||||
// bundle.getString("addSourceBody"), "", 200, 100, btn1Action, btn2Action, pane, bundle);
|
// bundle.getString("addSourceBody"), "", 200, 100, btn1Action, btn2Action, pane, bundle);
|
||||||
// selectFirstSource.show();
|
// selectFirstSource.show();
|
||||||
|
|
||||||
|
|
||||||
Alert alert = new Alert(AlertType.CONFIRMATION); //new alert with DirectoryChooser
|
Alert alert = new Alert(AlertType.CONFIRMATION); //new alert with DirectoryChooser
|
||||||
alert.setTitle("Project HomeFlix");
|
alert.setTitle("Project HomeFlix");
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
package org.kellerkinder.Alerts;
|
||||||
|
|
||||||
|
import com.jfoenix.controls.JFXAlert;
|
||||||
|
import com.jfoenix.controls.JFXButton;
|
||||||
|
import com.jfoenix.controls.JFXDialogLayout;
|
||||||
|
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.event.EventHandler;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
public class JFXInfoAlert {
|
||||||
|
|
||||||
|
private String titleText;
|
||||||
|
private String headerText;
|
||||||
|
private String contentText;
|
||||||
|
private String btnStyle;
|
||||||
|
private Stage stage;
|
||||||
|
|
||||||
|
public JFXInfoAlert() {
|
||||||
|
// Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public JFXInfoAlert(String titleText, String headerText, String contentText, String btnStyle, Stage stage) {
|
||||||
|
setTitleText(titleText);
|
||||||
|
setHeaderText(headerText);
|
||||||
|
setContentText(contentText);
|
||||||
|
setBtnStyle(btnStyle);
|
||||||
|
setStage(stage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showAndWait( ) {
|
||||||
|
JFXAlert<Void> alert = new JFXAlert<>(stage);
|
||||||
|
alert.setTitle(titleText);
|
||||||
|
alert.setHeaderText(headerText);
|
||||||
|
alert.setContentText(contentText);
|
||||||
|
|
||||||
|
JFXButton button = new JFXButton("Okay");
|
||||||
|
button.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
|
@Override
|
||||||
|
public void handle(ActionEvent event) {
|
||||||
|
alert.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
button.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
|
||||||
|
button.setPrefHeight(32);
|
||||||
|
button.setStyle(btnStyle);
|
||||||
|
|
||||||
|
JFXDialogLayout content = new JFXDialogLayout();
|
||||||
|
content.setActions(button);
|
||||||
|
alert.setContent(content);
|
||||||
|
alert.showAndWait();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitleText() {
|
||||||
|
return titleText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitleText(String titleText) {
|
||||||
|
this.titleText = titleText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHeaderText() {
|
||||||
|
return headerText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaderText(String headerText) {
|
||||||
|
this.headerText = headerText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContentText() {
|
||||||
|
return contentText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContentText(String contentText) {
|
||||||
|
this.contentText = contentText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBtnStyle() {
|
||||||
|
return btnStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnStyle(String btnStyle) {
|
||||||
|
this.btnStyle = btnStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Stage getStage() {
|
||||||
|
return stage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStage(Stage stage) {
|
||||||
|
this.stage = stage;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue