Java Code Examples for javafx.stage.Stage#getTitle()

The following examples show how to use javafx.stage.Stage#getTitle() . 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: FxlDemo.java    From fxldemo-gradle with Apache License 2.0 7 votes vote down vote up
public void start(Stage stage) throws Exception {
    stage.setTitle("Hello World");
    stage.initStyle(StageStyle.UNDECORATED);

    Label label = new Label(stage.getTitle());
    label.setStyle("-fx-font-size: 25");

    // Alibi for including ControlsFX Dependency :)
    SegmentedButton fxcontrol = new SegmentedButton(new ToggleButton("One"), new ToggleButton("Two"), new ToggleButton("Three"));

    Button exitButton = new Button("Exit");
    exitButton.setStyle("-fx-font-weight: bold");
    exitButton.setOnAction(event -> Platform.exit());

    VBox root = new VBox(label, fxcontrol, exitButton);
    root.setAlignment(Pos.CENTER);
    root.setSpacing(20);
    root.setPadding(new Insets(25));
    root.setStyle("-fx-border-color: lightblue");

    stage.setScene(new Scene(root));
    stage.show();
}
 
Example 2
Source File: WindowsMenu.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
private void fillWindowsMenu() {
  while (getItems().size() > 2)
    getItems().remove(2);
  for (Window win : Window.getWindows()) {
    if (win instanceof Stage) {
      Stage stage = (Stage) win;
      final MenuItem item = new MenuItem(stage.getTitle());
      item.setOnAction(e -> {
        stage.toFront();
      });
      getItems().add(item);
    }
  }
}
 
Example 3
Source File: StageControllerImpl.java    From scenic-view with GNU General Public License v3.0 5 votes vote down vote up
@Override public void update() {
    updateListeners(target, true, false);
    SVNode root = createNode(target);
    /**
     * If the target is the root node of the scene include subwindows
     */
    if (targetScene != null && targetScene.getRoot() == target) {
        String title = "App";
        Image targetStageImage = null;
        if (targetScene.getWindow() instanceof Stage) {
            final Stage s = ((Stage) targetScene.getWindow());
            if (!s.getIcons().isEmpty()) {
                targetStageImage = ((Stage) targetScene.getWindow()).getIcons().get(0);
            }
            title = s.getTitle() != null ? s.getTitle() : "App";
        }
        final SVDummyNode app = new SVDummyNode(title, "Stage", getID().getStageID(), NodeType.STAGE);
        app.setIcon(targetStageImage);
        app.setRemote(remote);
        app.setExpanded(true);
        app.getChildren().add(root);
        if (!popupWindows.isEmpty()) {
            final SVNode subWindows = new SVDummyNode("SubWindows", "Popup", getID().getStageID(), NodeType.SUBWINDOWS_ROOT);
            for (int i = 0; i < popupWindows.size(); i++) {
                final PopupWindow window = popupWindows.get(i);
                final SVNode subWindow = new SVDummyNode("SubWindow -" + ConnectorUtils.nodeClass(window), ConnectorUtils.nodeClass(window), window.hashCode(), NodeType.SUBWINDOW);
                subWindow.getChildren().add(createNode(window.getScene().getRoot()));
                subWindows.getChildren().add(subWindow);
            }
            app.getChildren().add(subWindows);
        }
        root = app;
    }
    dispatchEvent(new NodeAddRemoveEvent(SVEventType.ROOT_UPDATED, getID(), root));
    updateSceneDetails();
}
 
Example 4
Source File: WindowTitle.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private String getTitle(Stage component) {
    String title = component.getTitle();
    if (title == null) {
        return component.getClass().getName();
    }
    return title;
}
 
Example 5
Source File: FxlDemo.java    From fxldemo with Apache License 2.0 5 votes vote down vote up
public void start(Stage stage) throws Exception {
	stage.setTitle("Hello World");
	stage.initStyle(StageStyle.UNDECORATED);

	Label label = new Label(stage.getTitle());
	label.setStyle("-fx-font-size: 25");

	// Alibi for including ControlsFX Dependency :)
	SegmentedButton fxcontrol = new SegmentedButton(new ToggleButton("One"), new ToggleButton("Two"), new ToggleButton("Three"));

       // Did we get any arguments?
       getParameters().getNamed().forEach((name, value) -> System.out.println(String.format("%s=%s", name, value)));

	Button fxmlButton = new Button("Open FXML View");
	fxmlButton.setOnAction(this::openFxmlView);

	Button exitButton = new Button("Exit");
	exitButton.setStyle("-fx-font-weight: bold");
	exitButton.setOnAction(event -> Platform.exit());

       HBox buttons = new HBox(10, fxmlButton, exitButton);

       VBox root = new VBox(label, fxcontrol, buttons);
	root.setAlignment(Pos.CENTER);
	root.setSpacing(20);
	root.setPadding(new Insets(25));
       root.setStyle("-fx-border-color: lightblue");

	stage.setScene(new Scene(root));
	stage.show();
}
 
Example 6
Source File: StreamDebuggerController.java    From ShootOFF with GNU General Public License v3.0 5 votes vote down vote up
public void init(CameraManager cameraManager) {
	streamDebuggerStage = (Stage) thresholdImageView.getScene().getWindow();
	defaultWindowTitle = streamDebuggerStage.getTitle();

	cameraManager.setThresholdListener(this);

	minDimSlider.valueProperty().addListener(new ChangeListener<Number>() {
		@Override
		public void changed(ObservableValue<? extends Number> observableValue, Number oldValue, Number newValue) {
			if (newValue == null) return;

			cameraManager.setMinimumShotDimension(newValue.intValue());
		}
	});
}
 
Example 7
Source File: WindowMenuUpdateListener.java    From NSMenuFX with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void addWindowMenuItem(Stage stage, Menu menu) {
	CheckMenuItem item = new CheckMenuItem(stage.getTitle());
	item.setOnAction(event -> stage.toFront());
	createdMenuItems.put(stage, item);
	menu.getItems().add(item);
}