License dialog update

This commit is contained in:
Jannik 2017-11-26 11:35:02 +01:00
parent c6737fc387
commit 0f7d262bcb
2 changed files with 41 additions and 8 deletions

View File

@ -41,7 +41,6 @@ import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Properties;
import javax.imageio.ImageIO;
import javax.swing.ProgressMonitor;
import javax.swing.ProgressMonitorInputStream;
@ -391,7 +390,6 @@ public class MainWindowController {
}
if (settingsTrue) {
settingsScrollPane.setVisible(false);
// setPath(tfPath.getText());
saveSettings();
settingsTrue = false;
}
@ -650,6 +648,7 @@ public class MainWindowController {
@Override
public void handle(MouseEvent mouseEvent) {
if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){
String headingText = "cemu_UI";
String bodyText = "cemu_UI is licensed under the terms of GNU GPL 3.\n\n"
+ "JFoenix, Apache License 2.0\n"
@ -659,8 +658,24 @@ public class MainWindowController {
+ "Apache Commons Logging, Apache License 2.0\n"
+ "Apache Commons Codec, Apache License 2.0\n"
+ "Apache Log4j 2, Apache License 2.0\n";
JFXInfoDialog licenseDialog = new JFXInfoDialog(headingText, bodyText, dialogBtnStyle, 350, 275, main.pane);
licenseDialog.show();
EventHandler<ActionEvent> okayAction = new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
// do nothing
}
};
EventHandler<ActionEvent> cancelAction = new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
// show licenses
}
};
JFXOkayCancelDialog licenseOverviewDialog = new JFXOkayCancelDialog(headingText, bodyText, dialogBtnStyle,
350, 275, okayAction, cancelAction, main.pane);
licenseOverviewDialog.setCancelText("show licenses");
licenseOverviewDialog.show();
}
}
});

View File

@ -39,6 +39,8 @@ public class JFXOkayCancelDialog {
private String headingText;
private String bodyText;
private String dialogBtnStyle;
private String okayText = "okay";
private String cancelText = "cancel";
private int dialogWidth;
private int dialogHeight;
private EventHandler<ActionEvent> okayAction;
@ -75,19 +77,19 @@ public class JFXOkayCancelDialog {
StackPane stackPane = new StackPane();
stackPane.autosize();
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
JFXButton okayBtn = new JFXButton("Okay");
okayBtn.addEventHandler(ActionEvent.ACTION, okayAction);
JFXButton okayBtn = new JFXButton(okayText);
okayBtn.addEventHandler(ActionEvent.ACTION, (e)-> {
dialog.close();
});
okayBtn.addEventHandler(ActionEvent.ACTION, okayAction);
okayBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
okayBtn.setPrefHeight(32);
okayBtn.setStyle(dialogBtnStyle);
JFXButton cancelBtn = new JFXButton("Cancel");
cancelBtn.addEventHandler(ActionEvent.ACTION, cancelAction);
JFXButton cancelBtn = new JFXButton(cancelText);
cancelBtn.addEventHandler(ActionEvent.ACTION, (e)-> {
dialog.close();
});
cancelBtn.addEventHandler(ActionEvent.ACTION, cancelAction);
cancelBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
cancelBtn.setPrefHeight(32);
cancelBtn.setStyle(dialogBtnStyle);
@ -101,6 +103,22 @@ public class JFXOkayCancelDialog {
dialog.show();
}
public String getOkayText() {
return okayText;
}
public void setOkayText(String okayText) {
this.okayText = okayText;
}
public String getCancelText() {
return cancelText;
}
public void setCancelText(String cancelText) {
this.cancelText = cancelText;
}
public EventHandler<ActionEvent> getOkayAction() {
return okayAction;
}