List of usage examples for javafx.stage Stage setScene
@Override final public void setScene(Scene value)
From source file:Main.java
@Override public void start(Stage primaryStage) { WebEngine webEngine = new WebEngine(); webEngine.getLoadWorker().stateProperty().addListener((obs, oldValue, newValue) -> { if (newValue == State.SUCCEEDED) { System.out.println("finished loading"); }//from w w w. jav a 2 s .c om }); // addListener() // begin loading... webEngine.load("http://www.java2s.com"); Group root = new Group(); Scene scene = new Scene(root, 300, 250); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Label Sample"); stage.setWidth(400);/* ww w .j av a 2 s . com*/ stage.setHeight(180); HBox hbox = new HBox(); Image image = new Image(getClass().getResourceAsStream("labels.jpg")); Label label1 = new Label("Search", new ImageView(image)); hbox.setSpacing(10); hbox.getChildren().add((label1)); ((Group) scene.getRoot()).getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Arc arc = new Arc(0, 0, 50, 100, 0, 90); arc.setFill(Color.GRAY);/* w w w . j a v a 2s .c om*/ arc.setStroke(Color.BLACK); arc.setType(ArcType.ROUND); HBox box = new HBox(arc); box.setSpacing(10); box.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(box); stage.setScene(scene); stage.setTitle("Test"); stage.show(); }
From source file:com.coolchick.translatortemplater.Main.java
/** * Opens a dialog to edit details for the specified person. If the user clicks OK, the changes * are saved into the provided person object and true is returned. * * @param person the person object to be edited * @return true if the user clicked OK, false otherwise. *//*from ww w . j a v a2 s . c o m*/ public boolean showTranslatorEditDialog(Translator person) { try { // Load the fxml file and create a new stage for the popup dialog. FXMLLoader loader = new FXMLLoader(); loader.setLocation(Main.class.getResource("PersonEditDialog.fxml")); AnchorPane page = (AnchorPane) loader.load(); // Create the dialog Stage. Stage dialogStage = new Stage(); dialogStage.setTitle("Edit Person"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(primaryStage); Scene scene = new Scene(page); dialogStage.setScene(scene); // Set the person into the controller. PersonEditDialogController controller = loader.getController(); controller.setDialogStage(dialogStage); controller.setMain(this); controller.setTranslator(person); // Show the dialog and wait until the user closes it dialogStage.showAndWait(); return controller.isOkClicked(); } catch (IOException e) { e.printStackTrace(); return false; } }
From source file:Main.java
@Override public void start(Stage primaryStage) { TableView table = new TableView(); table.setEditable(true);/*from ww w. ja va2s. com*/ TableColumn firstNameCol = new TableColumn("First Name"); TableColumn lastNameCol = new TableColumn("Last Name"); TableColumn emailCol = new TableColumn("Email"); table.getColumns().addAll(firstNameCol, lastNameCol, emailCol); emailCol.setVisible(false); StackPane root = new StackPane(); root.getChildren().add(table); primaryStage.setScene(new Scene(root, 200, 250)); primaryStage.show(); }
From source file:de.micromata.mgc.javafx.ControllerService.java
public <M, W extends Parent, C extends ModelController<M>> Pair<W, C> loadControlWithModelNewScene( Class<C> controlToLoad, Class<W> widget, M model, Controller parentController) { Pair<W, C> ret = loadControlWithModel(controlToLoad, widget, model, parentController); C controller = ret.getSecond();/*from w ww .j a v a 2 s . c om*/ W wig = ret.getFirst(); Stage stage = new Stage(); // controller.setOwningStage(stage); Scene s = new Scene(wig, AbstractConfigDialog.PREF_WIDTH, AbstractConfigDialog.PREF_HEIGHT); controller.setScene(s); controller.setStage(stage); stage.setScene(s); s.getStylesheets().add(FXCssUtil.CSS); return ret; }
From source file:Main.java
@Override public void start(final Stage primaryStage) { Group root = new Group(); final TextArea textArea = TextAreaBuilder.create().prefWidth(400).wrapText(true).build(); ScrollPane scrollPane = new ScrollPane(); scrollPane.setContent(textArea);// w ww. ja v a 2 s .c o m scrollPane.setFitToWidth(true); scrollPane.setPrefWidth(400); scrollPane.setPrefHeight(180); VBox vBox = VBoxBuilder.create().children(scrollPane).build(); root.getChildren().add(vBox); primaryStage.setScene(new Scene(root, 500, 400)); primaryStage.show(); }
From source file:Main.java
License:asdf
@Override public void start(Stage stage) { stage.setWidth(500);//from w ww .j a va 2s.c o m stage.setHeight(500); Scene scene = new Scene(new Group()); VBox root = new VBox(); final WebView browser = new WebView(); final WebEngine webEngine = browser.getEngine(); ScrollPane scrollPane = new ScrollPane(); scrollPane.setContent(browser); webEngine.loadContent("<b>asdf</b>"); root.getChildren().addAll(scrollPane); scene.setRoot(root); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Hello World"); Group root = new Group(); Scene scene = new Scene(root, 300, 250); Button btn = new Button("Hello World"); btn.setLayoutX(100);/*from ww w.jav a2 s .c o m*/ btn.setLayoutY(80); btn.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent event) { System.out.println("Hello World"); } }); root.getChildren().add(btn); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(final Stage stage) { stage.setTitle("HTML"); stage.setWidth(500);//from w ww. java2 s. c o m stage.setHeight(500); Scene scene = new Scene(new Group()); VBox root = new VBox(); Path path = new Path(); path.getElements().add(new MoveTo(50.0f, 0.0f)); VLineTo vlt = new VLineTo(50.0f); path.getElements().add(vlt); System.out.println(vlt.getY()); root.getChildren().addAll(path); scene.setRoot(root); stage.setScene(scene); stage.show(); }