@FXML
private void handleAddNewDrug(ActionEvent event) throws IOException {
FXMLLoader fXMLLoader = new FXMLLoader();
fXMLLoader.setLocation(getClass().getResource("/view/drug/NewDrug.fxml"));
Stage stage = new Stage();
Scene scene = new Scene(fXMLLoader.load());
stage.setScene(scene);
stage.initModality(Modality.APPLICATION_MODAL);
stage.setTitle("New Drug");
stage.show();
stage.setOnCloseRequest((WindowEvent event1) -> {
drugs.clear();
loadDrug();
});
}
java类javafx.stage.WindowEvent的实例源码
NewPrescriptionController.java 文件源码
项目:Dr-Assistant
阅读 26
收藏 0
点赞 0
评论 0
SquidUI.java 文件源码
项目:Squid
阅读 20
收藏 0
点赞 0
评论 0
@Override
public void start(Stage primaryStage) throws Exception {
this.primaryStage = primaryStage;
Parent root = new AnchorPane();
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.getIcons().add(new Image(SQUID_LOGO_SANS_TEXT_URL));
primaryStage.setTitle("Squid 3.0 pre-release");
// this produces non-null window after .show()
primaryStageWindow = primaryStage.getScene().getWindow();
primaryStage.setOnCloseRequest((WindowEvent e) -> {
Platform.exit();
System.exit(0);
});
// postpone loading to allow for stage creation and use in controller
scene.setRoot(FXMLLoader.load(getClass().getResource("SquidUIController.fxml")));
primaryStage.show();
primaryStage.setMinHeight(scene.getHeight() + 15);
primaryStage.setMinWidth(scene.getWidth());
squidAboutWindow = new SquidAboutWindow(primaryStage);
}
GraphicalContext.java 文件源码
项目:GazePlay
阅读 15
收藏 0
点赞 0
评论 0
public void setUpOnStage(Stage stage) {
stage.setTitle("GazePlay");
// setting the scene again will exit fullscreen
// so we need to backup the fullscreen status, and restore it after the scene has been set
boolean fullscreen = stage.isFullScreen();
stage.setScene(scene);
stage.setFullScreen(fullscreen);
stage.setOnCloseRequest((WindowEvent we) -> stage.close());
final Configuration config = ConfigurationBuilder.createFromPropertiesResource().build();
CssUtil.setPreferredStylesheets(config, scene);
stage.show();
log.info("Finished setup stage with the game scene");
}
Overview.java 文件源码
项目:Pinggers-GIT-SVN-Client
阅读 25
收藏 0
点赞 0
评论 0
private void setupStage(Stage s)
{
stage = s;
s.setTitle("Pinggers Git/SVN Client");
s.setHeight(480);
s.setWidth(800);
s.setMinHeight(480);
s.setMinWidth(480);
s.centerOnScreen();
// Prevent Closing of the Main Window when it is disabled
s.addEventFilter(WindowEvent.WINDOW_CLOSE_REQUEST, event -> {
if(root.isDisable())
{
event.consume();
}
});
// Use own Exit handling (double check for isDisable ...)
s.setOnCloseRequest(event -> {
requestExit();
event.consume();
});
}
CryptoTest.java 文件源码
项目:CryptoPayAPI
阅读 25
收藏 0
点赞 0
评论 0
public void start(Stage primaryStage) throws Exception {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getLayout("test.fxml"));
StackPane root = new StackPane();
root.getChildren().add((Node)loader.load());
Scene s = new Scene(root, 800, 480);
primaryStage.setScene(s);
primaryStage.show();
primaryStage.setOnCloseRequest((WindowEvent event) -> {
for (Resource r : res) {
r.miners = 0;
}
System.exit(0);
});
char[] encpass = "J7fg9Gfekj5Fjf86".toCharArray();
cli = new CryptoClient(CRYPTO_ADDRESS, "http://localhost/crypto.php", "pay_manager", "s4BgNvfcmoj0q5bz".toCharArray(), encpass);
Button opt1 = (Button) s.lookup("#buy_opt1");
Button opt2 = (Button) s.lookup("#buy_opt2");
opt1.setOnAction((event) ->
cli.makeRequest("b1", B1_COST, this)
);
opt2.setOnAction((event) ->
cli.makeRequest("b2", B2_COST, this)
);
this.totalMoney = (Label) s.lookup("#money");
addRes(s, "stone", 5, 2, 10, 1.08);
addRes(s, "coal", 70, 15, 25, 1.08);
addRes(s, "iron", 450, 130, 75, 1.11);
addRes(s, "aluminum", 21000, 1100, 250, 1.09);
addRes(s, "lead", 160000, 10000, 760, 1.10);
addRes(s, "copper", 2200000, 860000, 2200, 1.08);
addRes(s, "silver", 19400000, 1500000, 5000, 1.08);
addRes(s, "gold", 620000000, 45000000, 12000, 1.07);
}
Main.java 文件源码
项目:CryptoPayAPI
阅读 16
收藏 0
点赞 0
评论 0
public void start(Stage primaryStage) throws Exception {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getLayout("server.fxml"));
StackPane root = new StackPane();
root.getChildren().add((Node)loader.load());
s = new Scene(root, 800, 480);
primaryStage.setScene(s);
primaryStage.show();
this.primaryStage = primaryStage;
this.table = (TableView<TX>) s.lookup("#table");
this.model = FXCollections.observableArrayList();
this.table.setItems(model);
ObservableList<TableColumn<TX, ?>> cols = this.table.getColumns();
TableColumn<TX, Integer> id = (TableColumn<TX, Integer>)cols.get(0);
id.setCellValueFactory(cellData -> cellData.getValue().id.asObject());
TableColumn<TX, String> pin = (TableColumn<TX, String>)cols.get(1);
pin.setCellValueFactory(cellData -> cellData.getValue().pin);
TableColumn<TX, String> desc = (TableColumn<TX, String>)cols.get(2);
desc.setCellValueFactory(cellData -> cellData.getValue().desc);
TableColumn<TX, String> status = (TableColumn<TX, String>)cols.get(3);
status.setCellValueFactory(cellData -> cellData.getValue().status);
TableColumn<TX, String> amount = (TableColumn<TX, String>)cols.get(4);
amount.setCellValueFactory(cellData -> cellData.getValue().amount);
TableColumn<TX, Long> time = (TableColumn<TX, Long>)cols.get(5);
time.setCellValueFactory(cellData -> cellData.getValue().timeFilled.asObject());
primaryStage.setOnCloseRequest((WindowEvent event) -> System.exit(0));
onRequestReceived(-1, "Test TX", new BigDecimal(1));
CryptoServer server = new CryptoServer(location, this);
Thread t = new Thread(server);
t.start();
}
StatBlockController.java 文件源码
项目:fwm
阅读 24
收藏 0
点赞 0
评论 0
public void start(Stage primaryStage, TabPane rootLayout){
tabPane = rootLayout;
primaryStage.setTitle("Statblock");
Scene myScene = new Scene(rootLayout);
App.getHotkeyController().giveGlobalHotkeys(myScene);
App.getHotkeyController().giveStatblockHotkeys(myScene);
primaryStage.setScene(myScene);
primaryStage.show();
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
public void handle(WindowEvent we) {
log.debug("Statblock Controller is closing");
started = false;
}
});
ourStage = primaryStage;
startAutoUpdateTabs();
started = true;
log.debug("started statblock controller.");
}
UssdClient.java 文件源码
项目:phone-simulator
阅读 18
收藏 0
点赞 0
评论 0
@Override
public void start(Stage stage) throws Exception {
impl = new Impl();
st=stage;
Parent root = FXMLLoader.load(getClass().getResource("/ussd/fxml/Host.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.setOnCloseRequest((WindowEvent event) -> {
System.exit(0);
});
stage.setResizable(false);
stage.show();
}
Launch.java 文件源码
项目:pandemie
阅读 24
收藏 0
点赞 0
评论 0
@Override
public void start(Stage stage) throws Exception {
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent e)
{
Platform.exit();
}
});
Parent root = FXMLLoader.load(getClass().getResource("/com/miage/pandemie/view/index.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
MainWindow.java 文件源码
项目:dialog-tool
阅读 26
收藏 0
点赞 0
评论 0
public MainWindow (LangLoader langLoader) {
super("Leeks & Dragons - Dialog Tool", 820, 640, "./data/ui/mainwindow.fxml", new MainWindowController(langLoader));
//add handler which will be executed, if user closes window
this.stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
System.exit(0);
}
});
//set window position to center and focus window
this.stage.centerOnScreen();
this.stage.requestFocus();
//set window visible
this.stage.show();
}
App.java 文件源码
项目:visual-spider
阅读 29
收藏 0
点赞 0
评论 0
@Override
public void start(Stage stage) throws Exception {
try {
BorderPane root = (BorderPane) FXMLLoader.load(getClass().getResource("view/MainWindow.fxml"));
stage.setScene(new Scene(root));
} catch (Exception e) {
logger.error("load fxml error: " + e.getMessage());
}
stage.setTitle(Values.MAIN_TITLE);
stage.getIcons().add(new Image(getClass().getResourceAsStream("view/spider.jpg")));
stage.show();
stage.setOnCloseRequest((WindowEvent event) -> {
stage.setIconified(true);
event.consume();
});
}
App.java 文件源码
项目:AquamarineLake
阅读 30
收藏 0
点赞 0
评论 0
@Override
public void start(Stage s) throws IOException
{
loader = new FXMLLoader(getClass().getResource("gui.fxml"));
root = loader.load();
contr = loader.getController();
contr.link(this);
st = s;
sc = new Scene(root);
s.setScene(sc);
s.setTitle("Plasmoxy::ThunderLord - VisionAlpha | by Sebo Petrík");
s.setResizable(true);
s.sizeToScene();
s.show();
s.setMinHeight(s.getHeight());
s.setMinWidth(s.getWidth());
s.setOnCloseRequest((new EventHandler<WindowEvent>() {
public void handle(WindowEvent we)
{
System.out.println("CLOSING");
contr.setClosed();
}
}));
}
PlayGraphic.java 文件源码
项目:Himalaya-JavaFX
阅读 20
收藏 0
点赞 0
评论 0
@Override
protected void humanActions(Player p) {
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("ActionsFXML.fxml"));
Parent root1 = (Parent) fxmlLoader.load();
ActionsFXMLController actionCtrl = fxmlLoader.getController();
actionCtrl.setPlayer(p);
actionCtrl.setBackground(background);
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
//Pour click sur close de action
stage.setOnCloseRequest((WindowEvent event) -> {
// consume event
event.consume();
// show close dialog
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Pas de précipitation !");
alert.setHeaderText(null);
alert.setContentText("Vous devez choisir 6 actions !\nNe pas oublier de choisir la région pour les délégations.");
alert.showAndWait();
});
stage.setTitle("Choix des actions");
stage.setScene(new Scene(root1));
stage.showAndWait();
} catch (IOException ex) {
Logger.getLogger(PlayGraphic.class.getName()).log(Level.SEVERE, null, ex);
}
}
EditTemplateController.java 文件源码
项目:Dr-Assistant
阅读 21
收藏 0
点赞 0
评论 0
@FXML
private void handleAddNewDrug(ActionEvent event) throws IOException {
FXMLLoader fXMLLoader = new FXMLLoader();
fXMLLoader.setLocation(getClass().getResource("/view/drug/NewDrug.fxml"));
Stage stage = new Stage();
Scene scene = new Scene(fXMLLoader.load());
stage.setScene(scene);
stage.initModality(Modality.APPLICATION_MODAL);
stage.setTitle("New Drug");
stage.show();
stage.setOnCloseRequest((WindowEvent event1) -> {
drugs.clear();
loadDrug();
});
}
NewTemplateController.java 文件源码
项目:Dr-Assistant
阅读 24
收藏 0
点赞 0
评论 0
@FXML
private void handleAddNewDrug(ActionEvent event) throws IOException {
FXMLLoader fXMLLoader = new FXMLLoader();
fXMLLoader.setLocation(getClass().getResource("/view/drug/NewDrug.fxml"));
Stage stage = new Stage();
Scene scene = new Scene(fXMLLoader.load());
stage.setScene(scene);
stage.initModality(Modality.APPLICATION_MODAL);
stage.setTitle("New Drug");
stage.show();
stage.setOnCloseRequest((WindowEvent event1) -> {
drugs.clear();
loadDrug();
});
}
MainView.java 文件源码
项目:MysticMaze
阅读 28
收藏 0
点赞 0
评论 0
@Override
public void start(Stage primaryStage) {
this.primaryStage = primaryStage;
MainViewController mainController = new MainViewController();
initStartView();
/*Thread CardGameThread = new Thread(CardGame.instance);
CardGameThread.start();
socketClient = new GUISocket(CardGame.instance.getSocketServer());*/
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent t) {
Platform.exit();
System.exit(0);
}
});
}
EditorController.java 文件源码
项目:CloneHero
阅读 22
收藏 0
点赞 0
评论 0
/**
* Start view
*/
public void start() {
saveBtn.setVisible(false);
Stage stage = (Stage) startBtn.getScene().getWindow();
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
public void handle(WindowEvent we) {
try {
mediaPlayer.stop();
} catch (Exception e) {
//Sometimes expected ;)
}
mediaPlayer = null;
}
});
isRecording = false;
textPresses.setDisable(true);
}
MainController.java 文件源码
项目:WholesomeChat
阅读 26
收藏 0
点赞 0
评论 0
public void passStage(Stage stage, ChatAccess chatAccess) {
this.stage = stage;
this.chatAccess = chatAccess;
this.chatAccess.addObserver(this);
this.stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
public void handle(WindowEvent we) {
System.out.println("Stage is closing");
if (chatAccess != null && chatAccess.isConnected()) {
JsonObject str = new JsonObject();
str.addProperty("text", "/quit");
str.addProperty("intent", "message");
chatAccess.send(gson.toJson(str));
chatAccess.close();
}
}
});
}
StartApplication.java 文件源码
项目:ABC-List
阅读 18
收藏 0
点赞 0
评论 0
@Override
public void start(Stage primaryStage) throws Exception {
final ApplicationView applicationView = new ApplicationView();
final Scene scene = new Scene(applicationView.getView(), 1280, 720);
primaryStage.setTitle(Properties.getPropertyForApplication(KEY__APPLICATION__TITLE)
+ Properties.getPropertyForApplication(KEY__APPLICATION__VERSION));
primaryStage.setScene(scene);
primaryStage.setOnCloseRequest((WindowEvent we) -> {
we.consume();
this.onCloseRequest();
});
// primaryStage.getIcons().add(new Image("http://icons.iconarchive.com/icons/guillendesign/variations-2/256/Favourites-icon.png"));
primaryStage.show();
}
LoginController.java 文件源码
项目:Planchester
阅读 31
收藏 0
点赞 0
评论 0
@FXML
private void login() {
AccountAdministrationManager.getInstance().setAccount(username.getText(), password.getText());
if(AccountAdministrationManager.getInstance().getLoggedInAccount() == null) {
username.requestFocus();
username.selectAll();
MessageHelper.showErrorAlertMessage(PlanchesterMessages.LOGIN_FAILED);
} else {
PlanchesterGUI.primaryStage.fireEvent(
new WindowEvent(
PlanchesterGUI.primaryStage,
WindowEvent.WINDOW_CLOSE_REQUEST
)
);
}
}
InstrumentationController.java 文件源码
项目:Planchester
阅读 52
收藏 0
点赞 0
评论 0
@FXML
private void apply() {
apply = true;
selectedMusicalWorks = new ArrayList<>();
for(String s : tableSelected.getItems()) {
MusicalWorkDTO musicalWorkDTO = musicalWorks.stream().filter(o -> o.getName().equals(s)).findFirst().get();
selectedMusicalWorks.add(musicalWorkDTO);
}
stage.fireEvent(
new WindowEvent(
stage,
WindowEvent.WINDOW_CLOSE_REQUEST
)
);
}
EditRequestsController.java 文件源码
项目:Planchester
阅读 18
收藏 0
点赞 0
评论 0
@FXML
public void save() {
List<RequestEntry> editedEntries = table.getItems().stream().filter(p -> p.edited == true).collect(Collectors.toList());
for(RequestEntry requestEntry : editedEntries) {
RequestType requestType = null;
if(requestEntry.getRequestType().equals(RequestTypeGUI.Absence)) {
requestType = RequestType.Leave_of_absence;
} else if(requestEntry.getRequestType().equals(RequestTypeGUI.Playrequest)) {
requestType = RequestType.Playrequest;
}
AccountEntity accountEntity = AccountAdministrationManager.getInstance().getLoggedInAccount();
EventScheduleManager.updateRequest(requestEntry.eventDutyDTO, requestType, AccountAdministrationManager.getInstance().getLoggedInAccount(), requestEntry.getRequestDescription().getText());
}
stage.fireEvent(
new WindowEvent(
stage,
WindowEvent.WINDOW_CLOSE_REQUEST
)
);
}
CreateRehearsalController.java 文件源码
项目:Planchester
阅读 17
收藏 0
点赞 0
评论 0
@FXML
void applyNewRehearsal() {
if(validate()) {
eventDutyDTO = new EventDutyDTO();
eventDutyDTO.setName(name.getText());
eventDutyDTO.setDescription(description.getText());
eventDutyDTO.setStartTime(DateHelper.mergeDateAndTime(date.getValue(), startTime.getValue()));
eventDutyDTO.setEndTime(endTime.getValue() == null ? DateHelper.mergeDateAndTime(date.getValue(), startTime.getValue().plusHours(2)) : DateHelper.mergeDateAndTime(date.getValue(), endTime.getValue()));
eventDutyDTO.setEventType(EventType.Rehearsal);
eventDutyDTO.setEventStatus(EventStatus.Unpublished);
eventDutyDTO.setConductor(conductor.getText());
eventDutyDTO.setLocation(eventLocation.getText());
eventDutyDTO.setPoints(((points.getText() == null || points.getText().isEmpty()) ? null : Double.valueOf(points.getText())));
eventDutyDTO.setRehearsalFor(null);
apply = true;
stage.fireEvent(new WindowEvent(stage, WindowEvent.WINDOW_CLOSE_REQUEST));
}
}
ScreensConfig.java 文件源码
项目:springfx
阅读 29
收藏 0
点赞 0
评论 0
public void showMainScreen() {
root = new StackPane();
root.getStylesheets().add(STYLE_FILE);
root.getStyleClass().add("main-window");
stage.setTitle("SpringFX");
scene = new Scene(root, WIDTH, HEIGHT);
stage.setScene(scene);
stage.setResizable(false);
stage.setOnHiding(new EventHandler<WindowEvent>() {
public void handle(WindowEvent event) {
System.exit(0);
// TODO you could add code to open an "are you sure you want to exit?" dialog
}
});
stage.show();
}
SupernovaeGameWithoutMenu.java 文件源码
项目:supernovae
阅读 17
收藏 0
点赞 0
评论 0
@Override
public void start(Stage primaryStage) {
stage = primaryStage;
stage.setTitle("Supernovae, the coolest game ever ;-)");
stage.setMinWidth(MINIMUM_WINDOW_WIDTH);
stage.setMinHeight(MINIMUM_WINDOW_HEIGHT);
gotoGame();
primaryStage.show();
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
Platform.exit();
System.exit(0);
}
});
}
SupernovaeGame.java 文件源码
项目:supernovae
阅读 20
收藏 0
点赞 0
评论 0
@Override
public void start(Stage primaryStage) {
try {
stage = primaryStage;
stage.setTitle("Supernovae, the coolest game ever ;-)");
stage.setMinWidth(MINIMUM_WINDOW_WIDTH);
stage.setMinHeight(MINIMUM_WINDOW_HEIGHT);
gotoLogin();
primaryStage.show();
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
Platform.exit();
System.exit(0);
}
});
} catch (Exception ex) {
Logger.getLogger(SupernovaeGame.class.getName()).log(Level.SEVERE, null, ex);
}
}
MainProgramSceneController.java 文件源码
项目:Hostel-Management-System
阅读 26
收藏 0
点赞 0
评论 0
@FXML
private void changePasswordAction(ActionEvent event)
{
mainTopAnchorPane.setEffect(new BoxBlur());
passwordStage = new Stage();
passwordStage.setOnCloseRequest(new EventHandler<WindowEvent>()
{
@Override
public void handle(WindowEvent t)
{
mainTopAnchorPane.effectProperty().setValue(null);
}
});
passwordStage.setTitle("Change Password");
passwordStage.initModality(Modality.APPLICATION_MODAL);
passwordStage.initStyle(StageStyle.UTILITY);
passwordStage.setResizable(false);
try
{
Parent passwordParent = FXMLLoader.load(getClass().getResource("changepassword.fxml"));
passwordStage.setScene(new Scene(passwordParent));
passwordStage.show();
} catch (IOException ex)
{
}
}
MainProgramSceneController.java 文件源码
项目:Hostel-Management-System
阅读 26
收藏 0
点赞 0
评论 0
@FXML
private void activityLogButtonAction(ActionEvent event)
{
mainTopAnchorPane.setEffect(new BoxBlur());
passwordStage = new Stage();
passwordStage.setOnCloseRequest(new EventHandler<WindowEvent>()
{
@Override
public void handle(WindowEvent t)
{
mainTopAnchorPane.effectProperty().setValue(null);
}
});
passwordStage.setTitle("Activity Log");
passwordStage.initModality(Modality.APPLICATION_MODAL);
passwordStage.initStyle(StageStyle.UTILITY);
passwordStage.setResizable(false);
try
{
Parent passwordParent = FXMLLoader.load(getClass().getResource("activityLog.fxml"));
passwordStage.setScene(new Scene(passwordParent));
passwordStage.show();
} catch (IOException ex)
{
}
}
StudentDetailController.java 文件源码
项目:Hostel-Management-System
阅读 21
收藏 0
点赞 0
评论 0
@FXML
private void viewPayBillAction(ActionEvent event)
{
MainProgramSceneController.mainTopAnchorPane.setEffect(new BoxBlur());
billStage = new Stage();
billStage.setOnCloseRequest(new EventHandler<WindowEvent>()
{
@Override
public void handle(WindowEvent t)
{
MainProgramSceneController.mainTopAnchorPane.effectProperty().setValue(null);
}
});
billStage.setTitle("View And Pay Due Bills");
billStage.initModality(Modality.APPLICATION_MODAL);
billStage.initStyle(StageStyle.UTILITY);
billStage.setResizable(false);
try
{
Parent passwordParent = FXMLLoader.load(getClass().getResource("viewPayBill.fxml"));
billStage.setScene(new Scene(passwordParent));
billStage.show();
} catch (IOException ex)
{
}
}
StartApplication.java 文件源码
项目:Project-Templates
阅读 17
收藏 0
点赞 0
评论 0
@Override
public void start(Stage primaryStage) throws Exception {
final ApplicationView applicationView = new ApplicationView();
final ApplicationPresenter applicationPresenter = applicationView.getRealPresenter();
final Scene scene = new Scene(applicationView.getView(), 1280, 720);
primaryStage.setTitle(this.getProperty(KEY__APPLICATION__TITLE) + this.getProperty(KEY__APPLICATION__VERSION));
primaryStage.setScene(scene);
primaryStage.setOnCloseRequest((WindowEvent we) -> {
we.consume();
this.onCloseRequest();
});
primaryStage.show();
applicationPresenter.initializeAfterWindowIsShowing();
}