當前位置: 首頁>>代碼示例>>Java>>正文


Java WindowEvent類代碼示例

本文整理匯總了Java中javafx.stage.WindowEvent的典型用法代碼示例。如果您正苦於以下問題:Java WindowEvent類的具體用法?Java WindowEvent怎麽用?Java WindowEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


WindowEvent類屬於javafx.stage包,在下文中一共展示了WindowEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleAddNewDrug

import javafx.stage.WindowEvent; //導入依賴的package包/類
@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();
    });
}
 
開發者ID:kmrifat,項目名稱:Dr-Assistant,代碼行數:17,代碼來源:NewPrescriptionController.java

示例2: start

import javafx.stage.WindowEvent; //導入依賴的package包/類
@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);
}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:27,代碼來源:SquidUI.java

示例3: setUpOnStage

import javafx.stage.WindowEvent; //導入依賴的package包/類
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");
}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:18,代碼來源:GraphicalContext.java

示例4: setupStage

import javafx.stage.WindowEvent; //導入依賴的package包/類
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();
	});
}
 
開發者ID:Pingger,項目名稱:Pinggers-GIT-SVN-Client,代碼行數:23,代碼來源:Overview.java

示例5: start

import javafx.stage.WindowEvent; //導入依賴的package包/類
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);
}
 
開發者ID:Roxas240,項目名稱:CryptoPayAPI,代碼行數:43,代碼來源:CryptoTest.java

示例6: start

import javafx.stage.WindowEvent; //導入依賴的package包/類
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();
}
 
開發者ID:Roxas240,項目名稱:CryptoPayAPI,代碼行數:37,代碼來源:Main.java

示例7: start

import javafx.stage.WindowEvent; //導入依賴的package包/類
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.");
}
 
開發者ID:ForJ-Latech,項目名稱:fwm,代碼行數:20,代碼來源:StatBlockController.java

示例8: start

import javafx.stage.WindowEvent; //導入依賴的package包/類
@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();
   
}
 
開發者ID:RestComm,項目名稱:phone-simulator,代碼行數:17,代碼來源:UssdClient.java

示例9: start

import javafx.stage.WindowEvent; //導入依賴的package包/類
@Override
public void start(Stage primaryStage) {
  try {
    // Load root layout from fxml file.
    FXMLLoader loader = new FXMLLoader(getClass().getResource("fxml/ui_mockup.fxml"));

    LMSFxController controller = new LMSFxController();
    controller.setParent(primaryStage);
    loader.setController(controller);

    rootLayout = loader.load();

    primaryStage.setTitle("LMSGrabber");

    // Show the scene containing the root layout.
    Scene scene = new Scene(rootLayout);
    primaryStage.setScene(scene);
    primaryStage.show();

    primaryStage.setOnHiding(new EventHandler<WindowEvent>() {

      @Override
      public void handle(WindowEvent event) {
          Platform.runLater(new Runnable() {

              @Override
              public void run() {
                  System.exit(0);
              }
          });
      }
  });
  } catch (IOException e) {
    logger.error("IOException", e);
  }

}
 
開發者ID:LMSGrabber,項目名稱:LMSGrabber,代碼行數:38,代碼來源:App.java

示例10: start

import javafx.stage.WindowEvent; //導入依賴的package包/類
@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();
}
 
開發者ID:tillind,項目名稱:pandemie,代碼行數:16,代碼來源:Launch.java

示例11: MainWindow

import javafx.stage.WindowEvent; //導入依賴的package包/類
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();
}
 
開發者ID:leeks-and-dragons,項目名稱:dialog-tool,代碼行數:19,代碼來源:MainWindow.java

示例12: start

import javafx.stage.WindowEvent; //導入依賴的package包/類
@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();
	});
}
 
開發者ID:zhazhapan,項目名稱:visual-spider,代碼行數:17,代碼來源:App.java

示例13: start

import javafx.stage.WindowEvent; //導入依賴的package包/類
@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();
        }
    }));
    
}
 
開發者ID:Plasmoxy,項目名稱:AquamarineLake,代碼行數:30,代碼來源:App.java

示例14: humanActions

import javafx.stage.WindowEvent; //導入依賴的package包/類
@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);
    }
}
 
開發者ID:sebastienscout,項目名稱:Himalaya-JavaFX,代碼行數:32,代碼來源:PlayGraphic.java

示例15: handleAddNewDrug

import javafx.stage.WindowEvent; //導入依賴的package包/類
@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();
    });

}
 
開發者ID:kmrifat,項目名稱:Dr-Assistant,代碼行數:18,代碼來源:EditTemplateController.java


注:本文中的javafx.stage.WindowEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。