当前位置: 首页>>代码示例>>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;未经允许,请勿转载。