Java Code Examples for javafx.stage.Stage#setTitle()
The following examples show how to use
javafx.stage.Stage#setTitle() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Exercise_15_19.java From Intro-to-Java-Programming with MIT License | 6 votes |
@Override // Override the start method in the Application class public void start(Stage primaryStage) { // Create a pane Pane pane = new Pane(); double width = 200; // pane width double height = 200; // pane height // Create a circle Circle circle = new Circle(10); setRandomProperties(circle, width, height); pane.getChildren().add(circle); // Create and register the handle circle.setOnMouseClicked(e -> { pane.getChildren().clear(); setRandomProperties(circle, width, height); pane.getChildren().add(circle); }); // Create a scene and place it in the stage Scene scene = new Scene(pane, width, height); primaryStage.setTitle("Exercise_15_19"); // Set the stage title primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage }
Example 2
Source File: ActivityDashboard.java From medusademo with Apache License 2.0 | 6 votes |
@Override public void start(Stage stage) { Scene scene = new Scene(pane); stage.setTitle("Medusa Activity Dashboard"); stage.setScene(scene); stage.show(); steps.setValue(8542); distance.setValue(9.2); actvCalories.setValue(1341); foodCalories.setValue(923); weight.setValue(78.8); bodyFat.setValue(14.03); // Calculate number of nodes calcNoOfNodes(pane); System.out.println(noOfNodes + " Nodes in SceneGraph"); }
Example 3
Source File: Exercise_15_18.java From Intro-to-Java-Programming with MIT License | 6 votes |
@Override // Override the start method in the Application class public void start(Stage primaryStage) { // Create a pane Pane pane = new Pane(); // Create a rectangle Rectangle rectangle = new Rectangle(5, 5, 30, 20); pane.getChildren().add(rectangle); // Create and register the handle pane.setOnMouseDragged(e -> { if (rectangle.contains(e.getX(), e.getY())) { pane.getChildren().clear(); rectangle.setX(e.getX() - rectangle.getWidth() * .5); rectangle.setY(e.getY() - rectangle.getHeight() * .5); pane.getChildren().add(rectangle); } }); // Create a scene and place it in the stage Scene scene = new Scene(pane, 200, 200); primaryStage.setTitle("Exercise_15_18"); // Set the stage title primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage }
Example 4
Source File: StretchRendererSample.java From arcgis-runtime-samples-java with Apache License 2.0 | 5 votes |
@Override public void start(Stage stage) throws IOException { // set up the scene FXMLLoader loader = new FXMLLoader(getClass().getResource("/stretch_renderer/main.fxml")); Parent root = loader.load(); controller = loader.getController(); Scene scene = new Scene(root); // set up the stage stage.setTitle("Stretch Renderer Sample"); stage.setWidth(800); stage.setHeight(700); stage.setScene(scene); stage.show(); }
Example 5
Source File: HelloWorld.java From Learn-Java-12-Programming with MIT License | 5 votes |
public void start2(Stage primaryStage) { Text txt = new Text("Fill the form and click Submit"); TextField tfFirstName = new TextField(); TextField tfLastName = new TextField(); TextField tfAge = new TextField(); Button btn = new Button("Submit"); btn.setOnAction(e -> action(tfFirstName, tfLastName, tfAge)); GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(15); grid.setVgap(5); grid.setPadding(new Insets(20, 20, 20, 20)); int i = 0; grid.add(txt, 0, i++, 2, 1); GridPane.setHalignment(txt, HPos.CENTER); grid.addRow(i++, new Label("First Name"),tfFirstName); grid.addRow(i++, new Label("Last Name"), tfLastName); grid.addRow(i++, new Label("Age"), tfAge); grid.add(btn, 1, i); GridPane.setHalignment(btn, HPos.CENTER); //grid.setGridLinesVisible(true); primaryStage.setTitle("Simple form example"); primaryStage.onCloseRequestProperty() .setValue(e -> System.out.println("\nBye! See you later!")); primaryStage.setScene(new Scene(grid, 300, 300)); primaryStage.show(); }
Example 6
Source File: TimeSeriesChartFXDemo1.java From buffer_bci with GNU General Public License v3.0 | 5 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 7
Source File: ReproduceTableViewerBug.java From chart-fx with Apache License 2.0 | 5 votes |
@Override public void start(final Stage primaryStage) { ProcessingProfiler.setVerboseOutputState(false); ProcessingProfiler.setLoggerOutputState(true); ProcessingProfiler.setDebugState(false); final BorderPane root = new BorderPane(); final Scene scene = new Scene(root); final XYChart chart = new XYChart(); chart.getXAxis().setName("x axis"); chart.getYAxis().setName("y axis"); chart.legendVisibleProperty().set(true); // set them false to make the plot faster chart.setAnimated(false); final TableViewer tableViewer = new TableViewer(); tableViewer.setRefreshRate(200); chart.getPlugins().add(tableViewer); generateData(chart); long startTime = ProcessingProfiler.getTimeStamp(); ProcessingProfiler.getTimeDiff(startTime, "adding data to chart"); startTime = ProcessingProfiler.getTimeStamp(); root.setTop(getHeaderBar(chart)); root.setCenter(chart); ProcessingProfiler.getTimeDiff(startTime, "adding chart into StackPane"); startTime = ProcessingProfiler.getTimeStamp(); primaryStage.setTitle(this.getClass().getSimpleName()); primaryStage.setScene(scene); primaryStage.setOnCloseRequest(evt -> Platform.exit()); primaryStage.show(); ProcessingProfiler.getTimeDiff(startTime, "for showing"); }
Example 8
Source File: MolecularMusicGenerator.java From molecular-music-generator with MIT License | 5 votes |
@Override public void start(Stage primaryStage) throws Exception { FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource("/mmg/application.fxml")); VBox vbox = loader.<VBox>load(); Scene scene = new Scene(vbox, 480, 480); Controller controller = (Controller)loader.getController(); controller.setup(primaryStage); primaryStage.setTitle("Molecular Music Generator"); primaryStage.setScene(scene); primaryStage.show(); }
Example 9
Source File: PdfsamApp.java From pdfsam with GNU Affero General Public License v3.0 | 5 votes |
@Override public void start(Stage primaryStage) { this.primaryStage = primaryStage; injector = initInjector(); Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionLogger()); initSejda(); cleanIfRequired(); primaryStage.setScene(initScene()); primaryStage.getIcons().addAll(injector.instancesOfType(Image.class)); primaryStage.setTitle(injector.instance(Pdfsam.class).name()); primaryStage.setOnCloseRequest(e -> Platform.exit()); requestPremiumModulesDescriptionIfRequired(); initWindowsStatusController(primaryStage); initDialogsOwner(primaryStage); initActiveModule(); loadWorkspaceIfRequired(); initOpenButtons(); primaryStage.show(); requestCheckForUpdateIfRequired(); requestLatestNewsIfRequired(); eventStudio().addAnnotatedListeners(this); closeSplash(); STOPWATCH.stop(); LOG.info(DefaultI18nContext.getInstance().i18n("Started in {0}", DurationFormatUtils.formatDurationWords(STOPWATCH.getTime(), true, true))); new InputPdfArgumentsController().accept(rawParameters); }
Example 10
Source File: LineChart3DFXDemo1.java From jfree-fxdemos with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void start(Stage stage) throws Exception { StackPane sp = new StackPane(); sp.getChildren().add(createDemoNode()); Scene scene = new Scene(sp, 768, 512); stage.setScene(scene); stage.setTitle("Orson Charts: LineChart3DFXDemo1.java"); stage.show(); }
Example 11
Source File: DesignerApplication.java From OEE-Designer with MIT License | 5 votes |
void showMessagingTrendDialog(EventResolver eventResolver) throws Exception { // Load the fxml file FXMLLoader loader = FXMLLoaderFactory.messagingTrendLoader(); AnchorPane page = (AnchorPane) loader.getRoot(); // Create the dialog Stage. Stage dialogStage = new Stage(StageStyle.DECORATED); dialogStage.setTitle(DesignerLocalizer.instance().getLangString("rmq.event.trend")); dialogStage.initModality(Modality.NONE); Scene scene = new Scene(page); dialogStage.setScene(scene); // get the controller RmqTrendController messagingTrendController = loader.getController(); messagingTrendController.setDialogStage(dialogStage); messagingTrendController.setApp(this); // add the trend chart SplitPane chartPane = messagingTrendController.initializeTrend(); AnchorPane.setBottomAnchor(chartPane, 50.0); AnchorPane.setLeftAnchor(chartPane, 5.0); AnchorPane.setRightAnchor(chartPane, 5.0); AnchorPane.setTopAnchor(chartPane, 50.0); page.getChildren().add(0, chartPane); // set the script resolver messagingTrendController.setEventResolver(eventResolver); // subscribe to broker messagingTrendController.subscribeToDataSource(); // show the window messagingTrendController.getDialogStage().show(); }
Example 12
Source File: OldScoresApplication.java From examples-javafx-repos1 with Apache License 2.0 | 5 votes |
@Override public void start(Stage primaryStage) throws Exception { if( logger.isDebugEnabled() ) { logger.debug("[START]"); } FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/MainView.fxml")); Parent p = loader.load(); MainViewController mv = loader.getController(); Scene scene = new Scene( p ); scene.setOnKeyPressed(evt -> { if( evt.getCode().equals(KeyCode.F1) ) { try { if( logger.isDebugEnabled() ) { logger.debug("[OPEN HELP]"); } mv.openHelpDialog(); } catch (IOException exc) { String msg = "error showing help dialog"; logger.error(msg); Alert alert = new Alert(Alert.AlertType.ERROR, msg); alert.showAndWait(); } } }); primaryStage.setTitle("Old Scores"); primaryStage.setScene(scene); primaryStage.show(); }
Example 13
Source File: PasswordFieldApp.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void start(Stage primaryStage) throws Exception { primaryStage.setTitle("PasswordField Sample"); primaryStage.setScene(new Scene(new PasswordFieldSample())); primaryStage.sizeToScene(); primaryStage.show(); }
Example 14
Source File: LabelSample.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void start(Stage stage) { VBox box = getVBox(); stage.setTitle("Tree View Sample"); final Scene scene = new Scene(box, 400, 300); scene.setFill(Color.LIGHTGRAY); stage.setScene(scene); stage.show(); }
Example 15
Source File: RadarChartTest.java From charts with Apache License 2.0 | 5 votes |
@Override public void start(Stage stage) { StackPane pane = new StackPane(chart); Scene scene = new Scene(pane); stage.setTitle("RadarChart"); stage.setScene(scene); stage.show(); timer.start(); }
Example 16
Source File: ClientMainFrame.java From Open-Lowcode with Eclipse Public License 2.0 | 5 votes |
/** * Creates a client mainframe and showing it * * @param stage javafx application stage * @param clientversion version of the client * @param clientversiondate date of the version of the client * @param clientupgradepage the page to show in case of upgrade * @param actionsourcetransformer transformer of widgets sending events to * action event to their significant parent (e.g. * tablecell -> tableview) * @param pagenodecatalog list of CPageNodes managed * @param urltoconnectto URL to connect to at start * @param nolog no logs are shown in the server * @param smallicon URL to the small icon (32x32) * @param bigicon URL to the big icon (64x64) * @param questionmarkicon URL of the question mark uicon * @param cssfile URL to the CSS file * @throws IOException if any bad happens while setting up the logs */ public ClientMainFrame(Stage stage, String clientversion, Date clientversiondate, ClientUpgradePageGenerator clientupgradepage, ActionSourceTransformer actionsourcetransformer, CPageNodeCatalog pagenodecatalog, String urltoconnectto, boolean nolog, String smallicon, String bigicon, String questionmarkicon, String cssfile) throws IOException { this.nolog = nolog; this.stage = stage; this.clientversion = clientversion; this.clientversiondate = clientversiondate; this.clientupgradepage = clientupgradepage; CPageNode.setPageCatelog(pagenodecatalog); initiateLog(); logger.severe("--------------- * * * Open Lowcode client * * * ---------------"); logger.severe(" * * version="+clientversion+", client built date="+sdf.format(clientversiondate)+"* *"); // ---------------------------------------- initiates the first tab uniqueclientsession = new ClientSession(this, actionsourcetransformer, urltoconnectto, questionmarkicon); if (smallicon != null) stage.getIcons().add(new Image(smallicon)); if (bigicon != null) stage.getIcons().add(new Image(bigicon)); Scene scene = new Scene(this.uniqueclientsession.getClientSessionNode(), Color.WHITE); if (cssfile != null) scene.getStylesheets().add(cssfile); stage.setScene(scene); stage.setTitle("Open Lowcode client"); // ---------------------------------------- show the stage stage.setMaximized(true); this.stage.show(); }
Example 17
Source File: Main.java From dev-tools with Apache License 2.0 | 5 votes |
@Override public void start(Stage primaryStage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("/views/main.fxml")); primaryStage.setTitle("Development tools"); primaryStage.getIcons().add(new Image("/images/icons8-toolbox-64.png")); Scene scene = new Scene(root, 900, 500); scene.getStylesheets().addAll("/css/main.css", "/css/json-highlighting.css"); primaryStage.setScene(scene); primaryStage.show(); }
Example 18
Source File: TreeTableSampleApp.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void start(Stage primaryStage) { primaryStage.setTitle("TreeTable View Sample"); primaryStage.setScene(new Scene(new TreeTableSample())); primaryStage.sizeToScene(); primaryStage.show(); TreeTableView<?> treeTableView = (TreeTableView<?>) primaryStage.getScene().getRoot().lookup(".tree-table-view"); treeTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); }
Example 19
Source File: Game2048.java From util4j with Apache License 2.0 | 4 votes |
/** * * @param primaryStage */ @Override public void start(Stage primaryStage) { gameManager = new GameManager(); gameBounds = gameManager.getLayoutBounds(); StackPane root = new StackPane(gameManager); root.getStyleClass().addAll("game-root"); ChangeListener<Number> resize = (ov, v, v1) -> { double scale = Math.min((root.getWidth() - MARGIN) / gameBounds.getWidth(), (root.getHeight() - MARGIN) / gameBounds.getHeight()); gameManager.setScale(scale); gameManager.setLayoutX((root.getWidth() - gameBounds.getWidth()) / 2d); gameManager.setLayoutY((root.getHeight() - gameBounds.getHeight()) / 2d); }; root.widthProperty().addListener(resize); root.heightProperty().addListener(resize); Scene scene = new Scene(root); scene.getStylesheets().add(CSS); addKeyHandler(scene); addSwipeHandlers(scene); if (isARMDevice()) { primaryStage.setFullScreen(true); primaryStage.setFullScreenExitHint(""); } if (Platform.isSupported(ConditionalFeature.INPUT_TOUCH)) { scene.setCursor(Cursor.NONE); } Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds(); double factor = Math.min(visualBounds.getWidth() / (gameBounds.getWidth() + MARGIN), visualBounds.getHeight() / (gameBounds.getHeight() + MARGIN)); primaryStage.setTitle("2048FX"); primaryStage.setScene(scene); primaryStage.setMinWidth(gameBounds.getWidth() / 2d); primaryStage.setMinHeight(gameBounds.getHeight() / 2d); primaryStage.setWidth((gameBounds.getWidth() + MARGIN) * factor); primaryStage.setHeight((gameBounds.getHeight() + MARGIN) * factor); primaryStage.show(); }
Example 20
Source File: LocalServerMapImageLayerSample.java From arcgis-runtime-samples-java with Apache License 2.0 | 4 votes |
@Override public void start(Stage stage) { try { // create stack pane and application scene StackPane stackPane = new StackPane(); Scene scene = new Scene(stackPane); // set title, size, and add scene to stage stage.setTitle("Local Server Map Image Layer Sample"); stage.setWidth(APPLICATION_WIDTH); stage.setHeight(700); stage.setScene(scene); stage.show(); // create a view with a map and basemap ArcGISMap map = new ArcGISMap(Basemap.createStreets()); mapView = new MapView(); mapView.setMap(map); // track progress of loading map image layer to map imageLayerProgress = new ProgressIndicator(ProgressIndicator.INDETERMINATE_PROGRESS); imageLayerProgress.setMaxWidth(30); // check that local server install path can be accessed if (LocalServer.INSTANCE.checkInstallValid()) { LocalServer server = LocalServer.INSTANCE; // start local server server.addStatusChangedListener(status -> { if (status.getNewStatus() == LocalServerStatus.STARTED) { // start map image service String mapServiceURL = new File(System.getProperty("data.dir"), "./samples-data/local_server/RelationshipID.mpk").getAbsolutePath(); mapImageService = new LocalMapService(mapServiceURL); mapImageService.addStatusChangedListener(this::addLocalMapImageLayer); mapImageService.startAsync(); } }); server.startAsync(); } else { Platform.runLater(() -> { Alert dialog = new Alert(AlertType.INFORMATION); dialog.initOwner(mapView.getScene().getWindow()); dialog.setHeaderText("Local Server Load Error"); dialog.setContentText("Local Geoprocessing Failed to load."); dialog.show(); }); } // add view to application window with progress bar stackPane.getChildren().addAll(mapView, imageLayerProgress); StackPane.setAlignment(imageLayerProgress, Pos.CENTER); } catch (Exception e) { // on any error, display the stack trace. e.printStackTrace(); } }