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


Java Stage.show方法代碼示例

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


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

示例1: start

import javafx.stage.Stage; //導入方法依賴的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

示例2: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override
	public void start(Stage stage) {
		stage.setTitle("Vokabeltrainer");
        Scene scene = new Scene(new VBox(), 400, 350);
        scene.setFill(Color.OLDLACE);
 
        MenuBar menuBar = new MenuBar();
 
        // --- Menu File
        Menu menuFile = new Menu("Vokabeln");
        
        MenuItem sample = new MenuItem("Sample");
        sample.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
//				Do stuff here
			}
		});
        
        menuFile.getItems().add(sample);
 
        // --- Menu Edit
        Menu menuEdit = new Menu("Abfragemodus");
 
        // --- Menu View
        Menu menuView = new Menu("Statistik");
 
        menuBar.getMenus().addAll(menuFile, menuEdit, menuView);
 
 
        ((VBox) scene.getRoot()).getChildren().addAll(menuBar);
 
        stage.setScene(scene);
        stage.show();
	}
 
開發者ID:dunkelziffer,項目名稱:Vokabeltrainer,代碼行數:36,代碼來源:Main.java

示例3: showMainStage

import javafx.stage.Stage; //導入方法依賴的package包/類
private void showMainStage() {        
    mainStage = new Stage(StageStyle.DECORATED);
    mainStage.setTitle("Chess Bot");
    mainStage.setResizable(false);
    mainStage.setAlwaysOnTop(true);
    mainStage.setOnCloseRequest(event -> {
        Platform.exit();
        System.exit(0);
    });
    mainStage.getIcons().add(new Image(APPLICATION_ICON));
    mainStage.setScene(new Scene(PageResources.getRoot(PagePath.PATH_SCREEN_APPLICATION), 208, 491));
    mainStage.show();
}
 
開發者ID:mhusam,項目名稱:ChessBot,代碼行數:14,代碼來源:ChessBotAppSplash.java

示例4: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override
    public void start(Stage primaryStage) throws Exception {
        final VBox vb = new VBox(7.0d);
        vb.setPadding(new Insets(20));
        
        final SignFlowPane signFlowPaneA = new SignFlowPane();
        signFlowPaneA.configure(ESign.A);
        vb.getChildren().add(signFlowPaneA);
        
        final SignFlowPane signFlowPaneB = new SignFlowPane();
        signFlowPaneB.configure(ESign.B);
        vb.getChildren().add(signFlowPaneB);
        
        final SignFlowPane signFlowPaneC = new SignFlowPane();
        signFlowPaneC.configure(ESign.C);
        vb.getChildren().add(signFlowPaneC);
        
        Scene myScene = new Scene(vb);

//        String stylesheet = getClass().getResource("test.css").toExternalForm();
        primaryStage.setScene(myScene);
        primaryStage.setWidth(300);
        primaryStage.setHeight(200);
        primaryStage.show();
    }
 
開發者ID:Naoghuman,項目名稱:ABC-List,代碼行數:26,代碼來源:SignFlowPaneTest.java

示例5: show

import javafx.stage.Stage; //導入方法依賴的package包/類
public static void show() throws IOException {
	ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
	URL fxmlUrl = classLoader.getResource("gui/splash.fxml");
	if (fxmlUrl == null) {
		OneClientLogging.logger.error("An error has occurred loading instance_creation.fxml!");
		return;
	}
	FXMLLoader fxmlLoader = new FXMLLoader();
	fxmlLoader.setLocation(fxmlUrl);
	fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
	Parent root = fxmlLoader.load(fxmlUrl.openStream());
	stage = new Stage();
	stage.setTitle("One Client - Loading");
	stage.getIcons().add(new Image("images/icon.png"));
	stage.setResizable(false);
	stage.initOwner(Main.stage);
	stage.initModality(Modality.WINDOW_MODAL);
	Scene scene = new Scene(root, 600, 400);
	scene.getStylesheets().add("gui/css/theme.css");
	stage.setScene(scene);
	splashScreenController = fxmlLoader.getController();
	stage.show();
	loaded = true;
}
 
開發者ID:HearthProject,項目名稱:OneClient,代碼行數:25,代碼來源:SplashScreen.java

示例6: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override
public void start(Stage primaryStage) throws Exception {
	GridPane pane = new GridPane();
	pane.setAlignment(Pos.CENTER);
	pane.setMaxSize(800, 600);
	pane.setPrefSize(800, 600);
	pane.setManaged(true);
	pane.setVgap(3);
	pane.setHgap(3);
	pane.addRow(1, new Label("Chess Master"));
	ComboBox<RenderWrapper> renderCombo = new ComboBox<>();
	renderCombo.getItems().addAll(new RenderWrapper(new BGFXRenderer()), new RenderWrapper(new OpenGLRenderer()));
	ChessMaster.getPluginManager().getExtensions(Renderer.class).stream().map(RenderWrapper::new).forEach(renderCombo.getItems()::add);
	pane.addRow(2, new Label("Select a renderer:"), renderCombo);
	Button button = new Button("Start!");
	button.setOnAction(event -> {
		ChessMaster.getLogger().info("Using renderer: {} ({})", renderCombo.getSelectionModel().getSelectedItem().renderer.getName(), renderCombo.getSelectionModel().getSelectedItem().renderer.getClass().getName());
		renderCombo.getSelectionModel().getSelectedItem().renderer.render();
		primaryStage.close();
	});
	pane.addRow(3, button);
	primaryStage.setScene(new Scene(pane));
	primaryStage.show();
}
 
開發者ID:HuajiStudio,項目名稱:ChessMaster,代碼行數:25,代碼來源:RenderEngineSelector.java

示例7: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override
public void start(Stage stage) {
    stage.setTitle("QuizOff");
    stage.setOnCloseRequest(event -> logout());
    stage.setScene(new LoginScreen(stage, 640, 720));
    stage.setResizable(false);
    stage.sizeToScene();
    stage.show();
}
 
開發者ID:markrzyszkowski,項目名稱:QuizOff,代碼行數:10,代碼來源:Client.java

示例8: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override
public void start(Stage primaryStage) throws Exception{
    Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
    primaryStage.setTitle("Hello World");
    primaryStage.setScene(new Scene(root, 600, 400));
    primaryStage.setResizable(false);
    primaryStage.sizeToScene();
    primaryStage.show();
}
 
開發者ID:Plasmoxy,項目名稱:AquamarineLake,代碼行數:10,代碼來源:Main.java

示例9: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override 
public void start(Stage stage) 
{
    // create the scene
    stage.setTitle("Social Network");
    scene = new Scene(new Browser(),750,500, Color.web("#666970"));
    stage.setScene(scene);
    scene.getStylesheets().add("webviewsample/BrowserToolbar.css");        
    stage.show();
}
 
開發者ID:ksg14,項目名稱:duncan,代碼行數:11,代碼來源:WatchYoutube.java

示例10: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
Scene scene = new Scene(root);
scene.getStylesheets().add("/styles/Styles.css");
stage.setTitle("FYS project");
stage.setScene(scene);
stage.show();
stage.setResizable(false);
stage.centerOnScreen();
}
 
開發者ID:dewarian,項目名稱:FYS_T3,代碼行數:12,代碼來源:MyApp.java

示例11: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override
    public void start(Stage primaryStage) throws Exception {
        GMain.getInstance().setPrimaryStage(primaryStage);

        // instructs the javafx system not to exit implicitly when the last application window is shut.
        Platform.setImplicitExit(false);

        // sets up the tray icon (using awt code run on the swing thread).
//        javax.swing.SwingUtilities.invokeLater(this::addAppToTray);

        ViewTuple viewTuple = ViewLoader.load(LoginView.class);
        Scene scene = new Scene(viewTuple.getRoot(), 800, 640);
        primaryStage.setScene(scene);
        primaryStage.show();
    }
 
開發者ID:cmlanche,項目名稱:easyMvvmFx,代碼行數:16,代碼來源:Launcher.java

示例12: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override
public void start(Stage stage) throws Exception {
    Parent root = FXMLLoader.load(getClass().getResource("Login.fxml"));
    
    Scene scene = new Scene(root);
    mainStage = stage;
    stage.setScene(scene);
    stage.show();
}
 
開發者ID:kmhasan-class,項目名稱:spring2017java,代碼行數:10,代碼來源:MultipleUIDemoSection4.java

示例13: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override
public void start(Stage stage) throws Exception {
    try {
        Parent root = createContents();
        Scene scene = new Scene(root, 800, 600);
        stage.setScene(scene);
        stage.show();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:mbari-media-management,項目名稱:vars-annotation,代碼行數:12,代碼來源:FilterableTreeItemDemo.java

示例14: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override
public void start(final Stage stage) {
    this.testButton = new Button();
    final AnchorPane testPane = new AnchorPane(this.testButton);
    stage.setScene(new Scene(testPane, WIDTH_PANE, HEIGHT_PANE));
    stage.show();
}
 
開發者ID:Tristan971,項目名稱:EasyFXML,代碼行數:8,代碼來源:DomUtilsTest.java

示例15: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override
public void start(Stage primStage) throws Exception {
    Parent root = FXMLLoader.load(getClass().getResource("/View/main.fxml"));
    primStage.setTitle("HWF");
    primStage.setScene(new Scene(root));
    primStage.show();
}
 
開發者ID:starsriver,項目名稱:JavaHomework,代碼行數:8,代碼來源:MainWindows.java


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