Java Code Examples for javafx.stage.Stage.setTitle()

The following are Jave code examples for showing how to use setTitle() of the javafx.stage.Stage class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Java-9-Programming-Blueprints   File: LoginController.java   View Source Code Vote up 8 votes
public static void showAndWait(String url, 
        Predicate<WebEngine> loginSuccessTest,
        Consumer<WebEngine> handler) {
    try {
        FXMLLoader loader = new FXMLLoader(LoginController.class.getResource("/fxml/login.fxml"));

        Stage stage = new Stage();
        stage.setScene(new Scene(loader.load()));
        LoginController controller = loader.<LoginController>getController();
        controller.setUrl(url);
        controller.setLoginSuccessTest(loginSuccessTest);
        controller.setHandler(handler);

        stage.setTitle("Login...");
        stage.initModality(Modality.APPLICATION_MODAL);

        stage.showAndWait();
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
}
 
Example 2
Project: fwm   File: JettyController.java   View Source Code Vote up 8 votes
public void start(Stage primaryStage, Pane rootLayout) throws Exception {
  	ourStage = primaryStage;
  	createTrayIcon(primaryStage);
      firstTime = true;
      Platform.setImplicitExit(false);
      primaryStage.setTitle("Fantasy World Manager Web Service - " + App.worldFileUtil.getWorldName());
      primaryStage.getIcons().add(new javafx.scene.image.Image(App.retGlobalResource("/src/main/webapp/WEB-INF/images/icons/server/64.png").openStream()));
      Scene myScene = new Scene(rootLayout);
      myScene.getStylesheets().add(App.retGlobalResource("/src/main/ui/jettyWindowStylesheet.css").toString());
      primaryStage.setScene(myScene);
      primaryStage.show();
      started = true;
      showAddress();
      showPassword();
      radio10.setSelected(WorldConfig.getRad10());
      radio15.setSelected(WorldConfig.getRad15());
      radioShowAll.setSelected(WorldConfig.getShowAll());
      setScene(myScene);
      visPasswordVar.toBack();
if(AppConfig.getDarkMode())
{
	setDark(true);
}
  }
 
Example 3
Project: Recordian   File: NewLogEntryTabController.java   View Source Code Vote up 7 votes
/**
 * Creates a new JavaFX stage for adding/editing/deleting a {@link DatabaseItem}
 *
 * @param viewPath      the path to the xml file representing the view
 * @param stageTitle    the title to be shown at the top of the stage
 */
private void createDatabaseItemModificationStage(String viewPath, String stageTitle) {
    try {
        FXMLLoader loader = new FXMLLoader(getClass().getResource(viewPath));
        Stage newStage = new Stage();
        newStage.setTitle(stageTitle);
        newStage.setScene(new Scene(loader.load()));
        DatabaseItemModificationController databaseItemModificationController = loader.getController();
        databaseItemModificationController.setNewLogEntryTabController(this);
        databaseItemModificationController.setStage(newStage);
        newStage.initModality(Modality.APPLICATION_MODAL);
        newStage.show();
    } catch (IOException e) {
        createErrorStage();
        e.printStackTrace();
    }
}
 
Example 4
Project: FYS_T3   File: contactController.java   View Source Code Vote up 7 votes
@FXML
public void openHelp(ActionEvent event) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/helpPopup.fxml"));
    final Scene scene = new Scene(root);
    final Stage stage = new Stage();
    stage.setTitle("Help");
    stage.setScene(scene);
    stage.show();
    stage.setResizable(false);
    stage.centerOnScreen();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.close();
            }
        }
    });
}
 
Example 5
Project: Vokabeltrainer   File: Main.java   View Source Code Vote up 7 votes
@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();
	}
 
Example 6
Project: Money-Manager   File: GoToOperation.java   View Source Code Vote up 7 votes
public void goToSettings(double positionX, double positionY) {
	try {
		Stage SettingsStage = new Stage();
		Parent root = FXMLLoader.load(getClass().getResource("/view/Settings.fxml"));
		Scene scene = new Scene(root,800,550);
		SettingsStage.setScene(scene);
		SettingsStage.setResizable(false);
		SettingsStage.getIcons().add(new Image(getClass().getResourceAsStream("/imges/purse.png")));
		SettingsStage.setTitle("Settings");
		SettingsStage.setX(positionX);
		SettingsStage.setY(positionY);
		SettingsStage.show();
	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
Example 7
Project: CyberTigerScoreboard   File: CPscorereport.java   View Source Code Vote up 7 votes
@Override
public void start(Stage mainWin) throws IOException {
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    DEFAULT_HEIGHT = screenSize.height - 100;
    DEFAULT_WIDTH = screenSize.width - 100;

    teamTabs = new TabPane(); // Initialize the pane with for the tabs
    setUpHelp = new GUIHelper(this); // Initialize the GUI helper class
    info = setUpHelp.createTextBox("Server not configured!"); // Initialize the textbox
    menuBar = setUpHelp.getMenu(info); // Initialize the menubar and the menus
    elementSect = new StackPane(); // Initialize the element stackpane
    elementSect.getChildren().add(teamTabs); // Add the tabs from teamtabs there
    borderPane = new BorderPane(); // Add the border pane
    borderPane.setTop(menuBar); // Add stuff to the borders
    borderPane.setCenter(elementSect); // But the elementSect in the middle
    borderPane.setBottom(info); // Put the textpane in the bottom
    Scene scene = new Scene(borderPane, DEFAULT_WIDTH, DEFAULT_HEIGHT); // Create the scene for the height
    mainWin.getIcons().add(new Image(ICON_LOC)); // Set the icon as the CyberTiger icon
    mainWin.setTitle("CyberTiger Scoreboard"); // Get the window name
    mainWin.setScene(scene); // Set the window
    mainWin.show(); // Show the window

    refreshData(); // Refresh the data since this creates the rest of teh GUI

    Timeline scoreboardRefresh = new Timeline(new KeyFrame(Duration.seconds(REFRESH_TIMEOUT), (ActionEvent event) -> {
        try {
            refreshData(); // Put the refresh method in this method to autorefresh every minute
        } catch (IOException ex) { // Catch the exception from the database conn
            info.setText("Error refreshing scores! " + ex); // Show the errors
        }
    }));
    scoreboardRefresh.setCycleCount(Timeline.INDEFINITE); // Set the number of times to run
    scoreboardRefresh.play(); // Run the timer
}
 
Example 8
Project: Artatawe   File: GUIController.java   View Source Code Vote up 7 votes
public GUIController(Stage primaryStage) {

        try
        {
            //Load persistent data
            artataweDatabase = new DataController();
        }
        catch (IOException e)
        {
            //If there was some error loading the data
            //Exit early
            System.err.println(e.getMessage());
            return;
        }

        this.primaryStage = primaryStage;

        primaryStage.setTitle(TITLE);
        primaryStage.setScene(new Scene(new LoginScene(artataweDatabase).getPane(),
                GUIConstants.LOGIN_WIDTH,GUIConstants.LOGIN_HEIGHT));
        primaryStage.show();
        centerize();
    }
 
Example 9
Project: KDTree   File: KDTreeDemo.java   View Source Code Vote up 7 votes
@Override
public void start(Stage primaryStage) throws Exception {
    primaryStage.setTitle("2DTree Demo");
    Group root = new Group();
    Canvas canvas = new Canvas(XSIZE, YSIZE);
    gc = canvas.getGraphicsContext2D();
    canvas.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent e) {
            gc.fillOval(e.getX(), e.getY(), 3, 3);
            double[] coords = { e.getX() / XSIZE, e.getY() / YSIZE };
            instance.insert(new HyperPoint(coords));
            instance.draw();
        }
    });

    root.getChildren().add(canvas);
    Scene sc = new Scene(root);
    primaryStage.setScene(sc);
    primaryStage.show();
}
 
Example 10
Project: Recordian   File: Main.java   View Source Code Vote up 6 votes
@Override
public void start(Stage primaryStage) throws Exception{

    // Create a new database file if one does not currently exist
    DatabaseHelper.createDatabase();

    // Creates the main view of the application
    FXMLLoader root = new FXMLLoader(getClass().getResource("/view/mainTabPane.fxml"));
    primaryStage.setTitle("Recordian");
    primaryStage.setScene(new Scene(root.load()));
    primaryStage.setOnCloseRequest(event -> Platform.exit());
    MainTabPaneController mainTabPaneController = root.getController();
    mainTabPaneController.setCurrentStage(primaryStage);
    primaryStage.show();
}
 
Example 11
Project: jfree-fxdemos   File: TimeSeriesChartFXDemo1.java   View Source Code Vote up 6 votes
@Override 
public void start(Stage stage) throws Exception {
    XYDataset dataset = createDataset();
    JFreeChart chart = createChart(dataset); 
    ChartViewer viewer = new ChartViewer(chart);
    stage.setScene(new Scene(viewer)); 
    stage.setTitle("JFreeChart: TimeSeriesFXDemo1.java"); 
    stage.setWidth(700);
    stage.setHeight(390);
    stage.show();
}
 
Example 12
Project: charts   File: MatrixHeatmapTest.java   View Source Code Vote up 6 votes
@Override public void start(Stage stage) {
    VBox pane = new VBox(10, matrixHeatMap1, matrixHeatMap2);
    pane.setPadding(new Insets(10));

    Scene scene = new Scene(pane);

    stage.setTitle("MatrixHeatMap");
    stage.setScene(scene);
    stage.show();

    timer.start();
}
 
Example 13
Project: file-transfer   File: Main.java   View Source Code Vote up 6 votes
@Override
public void start(Stage primaryStage) {
    System.setProperty("javax.net.ssl.trustStore", "trustStore" + File.separatorChar + "truststore.jks");
    System.setProperty("javax.net.ssl.trustStorePassword", "storePassword");
    Scene scene = new Scene(new MainWindow(primaryStage));
    scene.getStylesheets().add(getClass().getResource(".." + File.separator + "styles" + File.separator + "Style.css").toExternalForm());
    primaryStage.setTitle("FileSender");
    primaryStage.setScene(scene);
    primaryStage.getIcons().add(new Image(getClass().getResourceAsStream(".." + File.separator + "images" + File.separator + "logo.png")));
    primaryStage.setResizable(false);
    primaryStage.show();
}
 
Example 14
Project: szoftlab   File: Game.java   View Source Code Vote up 6 votes
@Override
public void start(Stage primaryStage) throws Exception {
    primaryStage.setTitle("Train Simulator 2017");
    primaryStage.setScene(view.getScene());
    primaryStage.show();
    view.reset();
}
 
Example 15
Project: QuickNote_Plus   File: main.java   View Source Code Vote up 6 votes
@Override
public void start(Stage primaryStage) {
	try {
		AnchorPane root = (AnchorPane)FXMLLoader.load(getClass().getResource("LogInScreen.fxml")); 
		Scene scene = new Scene(root, 340, 370);
	    scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
		primaryStage.setTitle("QuickNote Plus - Log in");
		primaryStage.setScene(scene);
		primaryStage.setResizable(false);
		primaryStage.show();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example 16
Project: bestia-palantir   File: MainApplication.java   View Source Code Vote up 6 votes
@Override
public void start(Stage primaryStage) {
	LOG.info("Starting Hello JavaFX and Maven demonstration application");

	try {
		final Parent rootNode = FXMLLoader.load(getClass().getResource(MAIN_FXML));
		final Scene scene = new Scene(rootNode, 400, 200);
		primaryStage.setTitle("Bestia Palantir");
		primaryStage.setScene(scene);
		primaryStage.show();
	} catch (Exception e) {
		LOG.error("Error during startup.", e);
	}
}
 
Example 17
Project: javafx-chart-zooming   File: LineChartSample.java   View Source Code Vote up 5 votes
@Override
   public void start(final Stage stage) {
stage.setTitle("Line Chart Sample");
// defining the axes
final NumberAxis xAxis = new NumberAxis();
final NumberAxis yAxis = new NumberAxis();
xAxis.setAutoRanging(true);
xAxis.setForceZeroInRange(false);
yAxis.setAutoRanging(true);
yAxis.setForceZeroInRange(false);
xAxis.setLabel("Number of Month");
// creating the chart
final LineChart<Number, Number> lineChart = new LineChart<Number, Number>(xAxis, yAxis);

lineChart.setTitle("Stock Monitoring, 2010");
// defining a series
final XYChart.Series series = new XYChart.Series();
series.setName("My portfolio");
// populating the series with data
series.getData().add(new XYChart.Data(1, 23));
series.getData().add(new XYChart.Data(2, 14));
series.getData().add(new XYChart.Data(3, 15));
series.getData().add(new XYChart.Data(4, 24));
series.getData().add(new XYChart.Data(5, 34));
series.getData().add(new XYChart.Data(6, 36));
series.getData().add(new XYChart.Data(7, 22));
series.getData().add(new XYChart.Data(8, 45));
series.getData().add(new XYChart.Data(9, 43));
series.getData().add(new XYChart.Data(10, 17));
series.getData().add(new XYChart.Data(11, 29));
series.getData().add(new XYChart.Data(12, 25));

// DO NOT ADD DATA TO CHART
// bc.getData().addAll(series1, series2, series3);
final StackPane pane = new StackPane();
pane.getChildren().add(lineChart);
final Scene scene = new Scene(pane, 500, 400);
new ZoomManager(pane, lineChart, series);
stage.setScene(scene);
stage.show();
   }
 
Example 18
Project: marathonv5   File: ChoiceBoxTreeViewApp.java   View Source Code Vote up 5 votes
@Override public void start(Stage primaryStage) throws Exception {
    primaryStage.setTitle("Choice Box TreeView");
    primaryStage.setScene(new Scene(new ChoiceBoxTreeViewSample()));
    primaryStage.sizeToScene();
    primaryStage.show();
}
 
Example 19
Project: fwm   File: WorldSettingsController.java   View Source Code Vote up 5 votes
public void start(Stage primaryStage, Pane rootLayout, String title) throws Exception {
   ourStage = primaryStage;
	primaryStage.setTitle(title);
   Scene myScene = new Scene(rootLayout);
   primaryStage.setScene(myScene);
   primaryStage.show();
   
   popUpOn.setToggleGroup(popUp);
   popUpOff.setToggleGroup(popUp);
   if(WorldConfig.getShowPlayersPopup()) {
	   popUpOn.setSelected(true);
   }
   else {
	   popUpOff.setSelected(true);
   }
   
   manualSaveOn.setToggleGroup(manualSaveGroup);
   manualSaveOff.setToggleGroup(manualSaveGroup);
   if(AppConfig.getManualSaveOnly()){
	   manualSaveOn.setSelected(true);
   }else{
	   manualSaveOff.setSelected(true);
   }
   
   darkModeOn.setToggleGroup(darkModeGroup);
   darkModeOff.setToggleGroup(darkModeGroup);
   if(AppConfig.getDarkMode()){
	   darkModeOn.setSelected(true);
   }else{
	   darkModeOff.setSelected(true);
   }
   
   autoUpdateTabsOn.setToggleGroup(autoUpdateGroup);
   autoUpdateTabsOff.setToggleGroup(autoUpdateGroup);
   if(AppConfig.getAutoUpdateTabs()){
	   autoUpdateTabsOn.setSelected(true);
   }else{
	   autoUpdateTabsOff.setSelected(true);
   }
   
   primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
       public void handle(WindowEvent we) {
           isOpen = false;
       }
   });
}
 
Example 20
Project: marathonv5   File: TooltipSample.java   View Source Code Vote up 5 votes
@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Tooltip Sample");
    stage.setWidth(330);
    stage.setHeight(150);

    total.setFont(new Font("Arial", 20));
    
    for (int i = 0; i < rooms.length; i++) {
        final CheckBox cb = cbs[i] = new CheckBox(rooms[i]);
        final Integer rate = rates[i];
        final Tooltip tooltip = new Tooltip("$" + rates[i].toString());
        tooltip.setFont(new Font("Arial", 16));
        cb.setTooltip(tooltip);
 cb.selectedProperty().addListener(
            (ObservableValue<? extends Boolean> ov, Boolean old_val, 
            Boolean new_val) -> {
                if (cb.isSelected()) {
                    sum = sum + rate;
                } else {
                    sum = sum - rate;
                }
                total.setText("Total: $" + sum.toString());
            }
        );
    }

    VBox vbox = new VBox();
    vbox.getChildren().addAll(cbs);
    vbox.setSpacing(5);
    HBox root = new HBox();
    root.getChildren().add(vbox);
    root.getChildren().add(total);
    root.setSpacing(40);
    root.setPadding(new Insets(20, 10, 10, 20));

    ((Group) scene.getRoot()).getChildren().add(root);

    stage.setScene(scene);
    stage.show();
}