Example usage for javafx.stage Stage setTitle

List of usage examples for javafx.stage Stage setTitle

Introduction

In this page you can find the example usage for javafx.stage Stage setTitle.

Prototype

public final void setTitle(String value) 

Source Link

Usage

From source file:com.esri.geoevent.test.performance.ui.ProducerUI.java

@Override
public void start(Stage primaryStage) {
    String modeStr = "Producer";
    if (StringUtils.isEmpty(modeStr)) {
        System.err.print(UIMessages.getMessage("STARTUP_ERROR_MODE_NULL")
                + UIMessages.getMessage("STARTUP_MODE_TYPES", Mode.getAllowableValues()));
        Platform.exit();/*from   w  w w .j  a va  2 s .  co m*/
        System.exit(0);
        return;
    }

    Mode mode = Mode.fromValue(modeStr);
    String fxmlFile = "";
    Object controller = null;
    switch (mode) {
    case Producer:
        fxmlFile = "PerformanceCollector.fxml";
        controller = new ProducerController();
        break;
    default:
        System.err.print(UIMessages.getMessage("STARTUP_ERROR_MODE_UNKNOWN", mode)
                + UIMessages.getMessage("STARTUP_MODE_TYPES", Mode.getAllowableValues()));
        Platform.exit();
        System.exit(0);
        return;
    }

    Platform.setImplicitExit(true);
    try {
        FXMLLoader loader = new FXMLLoader(getClass().getResource(fxmlFile));
        if (controller != null) {
            loader.setController(controller);
        }
        Parent parent = (Parent) loader.load();
        Scene scene = new Scene(parent);

        primaryStage.setOnCloseRequest(new AppCloser());
        primaryStage.setTitle(UIMessages.getMessage("UI_TITLE", mode));
        primaryStage.setScene(scene);
        primaryStage.show();
        ProducerUI.primaryStage = primaryStage;
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:com.esri.geoevent.test.performance.ui.ConsumerUI.java

@Override
public void start(Stage primaryStage) {

    String modeStr = "Consumer";
    if (StringUtils.isEmpty(modeStr)) {
        System.err.print(UIMessages.getMessage("STARTUP_ERROR_MODE_NULL")
                + UIMessages.getMessage("STARTUP_MODE_TYPES", Mode.getAllowableValues()));
        Platform.exit();//ww  w.  ja va2s .com
        System.exit(0);
        return;
    }

    Mode mode = Mode.fromValue(modeStr);
    String fxmlFile = "";
    Object controller = null;
    switch (mode) {

    case Consumer:
        fxmlFile = "PerformanceCollector.fxml";
        controller = new ConsumerController();
        break;

    default:
        System.err.print(UIMessages.getMessage("STARTUP_ERROR_MODE_UNKNOWN", mode)
                + UIMessages.getMessage("STARTUP_MODE_TYPES", Mode.getAllowableValues()));
        Platform.exit();
        System.exit(0);
        return;
    }

    Platform.setImplicitExit(true);
    try {
        FXMLLoader loader = new FXMLLoader(getClass().getResource(fxmlFile));
        if (controller != null) {
            loader.setController(controller);
        }
        Parent parent = (Parent) loader.load();
        Scene scene = new Scene(parent);

        primaryStage.setOnCloseRequest(new AppCloser());
        primaryStage.setTitle(UIMessages.getMessage("UI_TITLE", mode));
        primaryStage.setScene(scene);
        primaryStage.show();
        ConsumerUI.primaryStage = primaryStage;
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:projavafx.videoplayer3.VideoPlayer3.java

@Override
public void start(Stage primaryStage) {
    final Label message = new Label("I \u2764 Robots");
    message.setVisible(false);//ww w .  j  a  v  a2  s  . c o  m

    String workingDir = System.getProperty("user.dir");
    final File f = new File(workingDir, "../media/omgrobots.flv");

    final Media m = new Media(f.toURI().toString());
    m.getMarkers().put("Split", Duration.millis(3000));
    m.getMarkers().put("Join", Duration.millis(9000));

    final MediaPlayer mp = new MediaPlayer(m);

    final MediaView mv1 = new MediaView(mp);
    mv1.setViewport(new Rectangle2D(0, 0, 960 / 2, 540));
    StackPane.setAlignment(mv1, Pos.CENTER_LEFT);

    final MediaView mv2 = new MediaView(mp);
    mv2.setViewport(new Rectangle2D(960 / 2, 0, 960 / 2, 540));
    StackPane.setAlignment(mv2, Pos.CENTER_RIGHT);

    StackPane root = new StackPane();
    root.getChildren().addAll(message, mv1, mv2);
    root.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
            mp.seek(Duration.ZERO);
            message.setVisible(false);
        }
    });

    final Scene scene = new Scene(root, 960, 540);
    final URL stylesheet = getClass().getResource("media.css");
    scene.getStylesheets().add(stylesheet.toString());

    primaryStage.setScene(scene);
    primaryStage.setTitle("Video Player 3");
    primaryStage.show();

    mp.setOnMarker(new EventHandler<MediaMarkerEvent>() {

        @Override
        public void handle(final MediaMarkerEvent event) {
            Platform.runLater(new Runnable() {

                @Override
                public void run() {
                    if (event.getMarker().getKey().equals("Split")) {
                        message.setVisible(true);
                        buildSplitTransition(mv1, mv2).play();
                    } else {
                        buildJoinTransition(mv1, mv2).play();
                    }
                }

            });
        }
    });
    mp.play();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Circle circle = new Circle(40);
    circle.setFill(Color.RED);//from  w  ww.j av  a  2 s . c  om
    circle.setStroke(Color.BLACK);
    circle.setStrokeWidth(2.0);

    Rectangle rect = new Rectangle(120, 75);
    rect.setFill(Color.RED);

    // Create a line
    Line line = new Line(0, 0, 150, 50);
    line.setStrokeWidth(5.0);
    line.setStroke(Color.GREEN);

    // Create a parallelogram
    Polygon parallelogram = new Polygon();
    parallelogram.getPoints().addAll(30.0, 0.0, 130.0, 0.0, 120.00, 50.0, 0.0, 50.0);
    parallelogram.setFill(Color.AZURE);
    parallelogram.setStroke(Color.BLACK);

    // Create a hexagon
    Polyline hexagon = new Polyline(100.0, 0.0, 120.0, 20.0, 110.0, 140.0, 100.0, 60.0, 80.0, 40.0, 80.0, 120.0,
            100.0, 0.0);
    hexagon.setFill(Color.WHITE);
    hexagon.setStroke(Color.BLACK);

    // A CHORD arc with no fill and a stroke
    Arc arc = new Arc(0, 0, 50, 100, 0, 90);
    arc.setFill(Color.TRANSPARENT);
    arc.setStroke(Color.BLACK);
    arc.setType(ArcType.CHORD);

    // Add all shapes to an HBox
    HBox root = new HBox(circle, rect, line, parallelogram, hexagon, arc);
    root.setSpacing(10);
    root.setStyle("-fx-padding: 10;" + "-fx-border-style: solid inside;" + "-fx-border-width: 2;"
            + "-fx-border-insets: 5;" + "-fx-border-radius: 5;" + "-fx-border-color: blue;");

    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("2D Shapes");
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    TextField fName = new TextField();
    TextField lName = new TextField();
    TextField salary = new TextField();

    Button closeBtn = new Button("Close");
    closeBtn.setOnAction(e -> Platform.exit());

    fName.getProperties().put("microHelpText", "Enter the first name");
    lName.getProperties().put("microHelpText", "Enter the last name");
    salary.getProperties().put("microHelpText", "Enter a salary greater than $2000.00.");

    // The help text node is unmanaged
    helpText.setManaged(false);//www.  j  ava2  s . c om
    helpText.setTextOrigin(VPos.TOP);
    helpText.setFill(Color.RED);
    helpText.setFont(Font.font(null, 9));
    helpText.setMouseTransparent(true);

    // Add all nodes to a GridPane
    GridPane root = new GridPane();

    root.add(new Label("First Name:"), 1, 1);
    root.add(fName, 2, 1);
    root.add(new Label("Last Name:"), 1, 2);
    root.add(lName, 2, 2);

    root.add(new Label("Salary:"), 1, 3);
    root.add(salary, 2, 3);
    root.add(closeBtn, 3, 3);
    root.add(helpText, 4, 3);

    Scene scene = new Scene(root, 300, 100);

    // Add a change listener to the scene, so we know when
    // the focus owner changes and display the micro help   
    scene.focusOwnerProperty().addListener((ObservableValue<? extends Node> value, Node oldNode,
            Node newNode) -> focusChanged(value, oldNode, newNode));
    stage.setScene(scene);
    stage.setTitle("Showing Micro Help");
    stage.show();
}

From source file:be.makercafe.apps.makerbench.Main.java

@Override
public void start(Stage primaryStage) {
    setupWorkspace();//from   www .  ja va2  s.  c  om
    rootContextMenu = createViewerContextMenu();
    viewer = createViewer();

    this.stage = primaryStage;
    BorderPane p = new BorderPane();

    p.setTop(createMenuBar());

    // p.setLeft(viewer);
    tabFolder = new TabPane();
    BorderPane bodyPane = new BorderPane();
    TextArea taConsole = new TextArea();
    taConsole.setPrefSize(Double.MAX_VALUE, 200.0);
    taConsole.setEditable(false);

    Console console = new Console(taConsole);
    PrintStream ps = new PrintStream(console, true);
    System.setOut(ps);
    System.setErr(ps);

    bodyPane.setBottom(taConsole);
    bodyPane.setCenter(tabFolder);
    SplitPane splitpane = new SplitPane();
    splitpane.getItems().addAll(viewer, bodyPane);
    splitpane.setDividerPositions(0.0f, 1.0f);
    p.setCenter(splitpane);

    Scene scene = new Scene(p, 1024, 800);
    //scene.getStylesheets().add(this.getClass().getResource("/styles/java-keywords.css").toExternalForm());

    primaryStage.setResizable(true);
    primaryStage.setTitle("Makerbench");
    primaryStage.setScene(scene);
    //primaryStage.getIcons().add(new Image("/path/to/stackoverflow.jpg"));
    primaryStage.show();
}

From source file:com.thomaskuenneth.tkmactuning.TKMacTuning.java

@Override
public void start(Stage primaryStage) {
    TabPane tabPane = new TabPane();
    tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
    // Found here: http://stackoverflow.com/a/17488304/5956451
    tabPane.getStyleClass().add("floating");

    // TODO: propper error handling
    JSONTokener t = new JSONTokener(getClass().getResourceAsStream("resources/plugins.json"));
    JSONArray a = new JSONArray(t);
    a.forEach((Object anObject) -> {
        JSONObject jsonObject = (JSONObject) anObject;
        addPlugin(tabPane, jsonObject.getString("class"), jsonObject.getString("pluginName"));
    });//from   w  ww . ja  v  a  2 s.  c  o  m

    FlowPane buttonsPane = new FlowPane(Orientation.HORIZONTAL);
    buttonsPane.setPadding(LayoutConstants.PADDING_1);
    buttonsPane.setHgap(LayoutConstants.HORIZONTAL_CONTROL_GAP);
    buttonsPane.setAlignment(Pos.BASELINE_LEFT);
    final Button buttonReread = new Button(getString("reread"));
    buttonReread.setOnAction(event -> {
        PluginManager.reread(this);
    });
    buttonsPane.getChildren().add(buttonReread);
    final Button buttonApply = new Button(getString("apply"));
    buttonApply.setOnAction(event -> {
        PluginManager.save(this);
    });
    buttonsPane.getChildren().add(buttonApply);

    statusbar = new StatusBar();
    BorderPane borderPane = new BorderPane(tabPane);
    borderPane.setTop(buttonsPane);
    borderPane.setBottom(statusbar);
    primaryStage.setScene(new Scene(borderPane, 800, 600));
    primaryStage.setTitle(getString("application_name"));

    ready();
    primaryStage.show();
}

From source file:genrsa.GenRSAController.java

/**
 * Muestra por pantalla la informacin relativa a genRSA 
 * @param event /*from  ww w .  j ava  2s .com*/
 */
public void aboutGenRSA(ActionEvent event) {
    Stage stage;
    FXMLLoader fxmlLoader;
    Parent root;

    try {
        stage = new Stage();
        fxmlLoader = new FXMLLoader(getClass().getResource("/About/About.fxml"));
        root = fxmlLoader.load();

        Scene scene = new Scene(root);
        stage.initModality(Modality.APPLICATION_MODAL);
        stage.initOwner(this.unitsD.getScene().getWindow());
        stage.setResizable(false);
        stage.getIcons().add(new Image(GenRSAController.class.getResourceAsStream("/allImages/genRSA.png")));
        stage.setTitle("Acerca de genRSA v2.1");
        stage.setScene(scene);
        stage.show();

    } catch (IOException ex) {
        //no pongo mensaje de error, porque no se puede dar el caso
    }

}

From source file:de.mirkosertic.desktopsearch.DesktopSearch.java

@Override
public void start(Stage aStage) throws Exception {

    // This is our base directory
    File theBaseDirectory = new File(SystemUtils.getUserHome(), "FreeSearchIndexDir");
    theBaseDirectory.mkdirs();/* www  .j a  v a  2 s. c  o  m*/

    configurationManager = new ConfigurationManager(theBaseDirectory);

    Notifier theNotifier = new Notifier();

    stage = aStage;

    // Create the known preview processors
    PreviewProcessor thePreviewProcessor = new PreviewProcessor();

    try {
        // Boot the search backend and set it up for listening to configuration changes
        backend = new Backend(theNotifier, configurationManager.getConfiguration(), thePreviewProcessor);
        configurationManager.addChangeListener(backend);

        // Boot embedded JSP container
        embeddedWebServer = new FrontendEmbeddedWebServer(aStage, backend, thePreviewProcessor,
                configurationManager);

        embeddedWebServer.start();
    } catch (BindException | LockReleaseFailedException | LockObtainFailedException e) {
        // In this case, there is already an instance of DesktopSearch running
        // Inform the instance to bring it to front end terminate the current process.
        URL theURL = new URL(FrontendEmbeddedWebServer.getBringToFrontUrl());
        // Retrieve the content, but it can be safely ignored
        // There must only be the get request
        Object theContent = theURL.getContent();

        // Terminate the JVM. The window of the running instance is visible now.
        System.exit(0);
    }

    aStage.setTitle("Free Desktop Search");
    aStage.setWidth(800);
    aStage.setHeight(600);
    aStage.initStyle(StageStyle.TRANSPARENT);

    FXMLLoader theLoader = new FXMLLoader(getClass().getResource("/scenes/mainscreen.fxml"));
    AnchorPane theMainScene = theLoader.load();

    final DesktopSearchController theController = theLoader.getController();
    theController.configure(this, backend, FrontendEmbeddedWebServer.getSearchUrl(), stage.getOwner());

    Undecorator theUndecorator = new Undecorator(stage, theMainScene);
    theUndecorator.getStylesheets().add("/skin/undecorator.css");

    Scene theScene = new Scene(theUndecorator);

    // Hacky, but works...
    theUndecorator.setStyle("-fx-background-color: rgba(0, 0, 0, 0);");

    theScene.setFill(Color.TRANSPARENT);
    aStage.setScene(theScene);

    aStage.getIcons().add(new Image(getClass().getResourceAsStream("/fds.png")));

    if (SystemTray.isSupported()) {
        Platform.setImplicitExit(false);
        SystemTray theTray = SystemTray.getSystemTray();

        // We need to reformat the icon according to the current tray icon dimensions
        // this depends on the underlying OS
        java.awt.Image theTrayIconImage = Toolkit.getDefaultToolkit()
                .getImage(getClass().getResource("/fds_small.png"));
        int trayIconWidth = new TrayIcon(theTrayIconImage).getSize().width;
        TrayIcon theTrayIcon = new TrayIcon(
                theTrayIconImage.getScaledInstance(trayIconWidth, -1, java.awt.Image.SCALE_SMOOTH),
                "Free Desktop Search");
        theTrayIcon.setImageAutoSize(true);
        theTrayIcon.setToolTip("FXDesktopSearch");
        theTrayIcon.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 1) {
                    Platform.runLater(() -> {
                        if (stage.isIconified()) {
                            stage.setIconified(false);
                        }
                        stage.show();
                        stage.toFront();
                    });
                }
            }
        });
        theTray.add(theTrayIcon);

        aStage.setOnCloseRequest(aEvent -> stage.hide());
    } else {

        aStage.setOnCloseRequest(aEvent -> shutdown());
    }

    aStage.setMaximized(true);
    aStage.show();
}