List of usage examples for javafx.scene Group Group
public Group()
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(300);//from ww w.ja v a 2 s.com stage.setHeight(150); final CheckBox cb = new CheckBox(); cb.setText("checkBox"); cb.setAllowIndeterminate(true); cb.selectedProperty().addListener(new ChangeListener<Boolean>() { public void changed(ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) { System.out.println(cb.isSelected()); System.out.println(cb.isAllowIndeterminate()); } }); ((Group) scene.getRoot()).getChildren().add(cb); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250); TextField textBox = new TextField(); textBox.setPromptText("Write here"); textBox.setOnKeyPressed(new EventHandler<KeyEvent>() { public void handle(KeyEvent ke) { System.out.println("Key Pressed: " + ke.getText()); }//from www .j a v a 2 s . c o m }); textBox.setOnKeyReleased(new EventHandler<KeyEvent>() { public void handle(KeyEvent ke) { System.out.println("Key Released: " + ke.getText()); } }); root.getChildren().add(textBox); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle(""); Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); TextField field = new TextField() { @Override/*from ww w . j a v a 2 s . com*/ public void replaceText(int start, int end, String text) { if (!text.matches("[a-z]")) { super.replaceText(start, end, text); } } @Override public void replaceSelection(String text) { if (!text.matches("[a-z]")) { super.replaceSelection(text); } } }; root.getChildren().add(field); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
License:asdf
@Override public void start(Stage stage) { stage.setTitle("HTML"); stage.setWidth(500);//from w w w . jav a 2s .co m stage.setHeight(500); Scene scene = new Scene(new Group()); FlowPane flow = new FlowPane(Orientation.VERTICAL); flow.setVgap(8); flow.setHgap(4); flow.setPrefWrapLength(300); // preferred width = 300 for (int i = 0; i < 10; i++) { flow.getChildren().add(new Button("asdf")); } scene.setRoot(flow); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 500, 260); Rectangle roundRect = new Rectangle(50, 50, 400, 130); roundRect.setArcWidth(30);/*from ww w. j a va 2 s . co m*/ roundRect.setArcHeight(60); roundRect.setFill(null); roundRect.setStroke(Color.DARKORANGE); roundRect.setStrokeWidth(2); roundRect.setStrokeLineCap(StrokeLineCap.BUTT); root.getChildren().add(roundRect); Slider slider = new Slider(30, 150, 30); slider.setLayoutX(250 - slider.getWidth() / 2); slider.setLayoutY(115 - slider.getHeight() / 2); slider.widthProperty().addListener((ov, curVal, newVal) -> { slider.setLayoutX(250 - slider.getWidth() / 2); }); slider.heightProperty() .addListener((ov, curVal, newVal) -> slider.setLayoutY(115 - slider.getHeight() / 2)); roundRect.arcWidthProperty().bind(slider.valueProperty()); root.getChildren().add(slider); Slider slider2 = new Slider(10, 120, 50); slider2.setLayoutX(50); slider2.setLayoutY(230); slider2.widthProperty().addListener((ov, curVal, newVal) -> { slider2.setLayoutX(250 - slider2.getWidth() / 2); }); roundRect.yProperty().bind(slider2.valueProperty()); root.getChildren().add(slider2); slider2.valueProperty().addListener((ov, curVal, newVal) -> slider .setLayoutY(slider.getLayoutY() + newVal.doubleValue() - curVal.doubleValue())); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
License:asdf
@Override public void start(Stage stage) { stage.setWidth(500);/* www . j a v a 2 s .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(final Stage stage) { stage.setTitle(""); stage.setWidth(500);//from ww w . java 2 s . c om stage.setHeight(500); Scene scene = new Scene(new Group()); VBox root = new VBox(); NumberAxis yAxis = new NumberAxis(0.0, 5.0, 1.0); NumberAxis xAxis = new NumberAxis(0.0, 5.0, 1.0); ScatterChart scatterChart = new ScatterChart(xAxis, yAxis); root.getChildren().addAll(scatterChart); scene.setRoot(root); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 350, 250); TitledPane titledPane = new TitledPane("My Title", new CheckBox("OK")); HBox hbox = new HBox(10); hbox.setPadding(new Insets(20, 0, 0, 20)); hbox.getChildren().setAll(titledPane); Group root = (Group) scene.getRoot(); root.getChildren().add(hbox);/*from w ww. j av a 2 s . c o m*/ stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(final Stage stage) { stage.setTitle(""); stage.setWidth(500);//from www . j ava2 s . c o m stage.setHeight(500); Scene scene = new Scene(new Group()); VBox root = new VBox(); NumberAxis lineYAxis = new NumberAxis(0, 100, 10); CategoryAxis lineXAxis = new CategoryAxis(); lineYAxis.setLabel("Sales"); lineXAxis.setLabel("Products"); root.getChildren().addAll(lineXAxis); scene.setRoot(root); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250); Button btn = new Button(); btn.setText("Hello World"); btn.setOnMouseEntered(new EventHandler<MouseEvent>() { public void handle(MouseEvent me) { System.out.println("Mouse entered"); }/* w ww . j a v a2s . c om*/ }); btn.setOnMouseExited(new EventHandler<MouseEvent>() { public void handle(MouseEvent me) { System.out.println("Mouse exited"); } }); btn.setOnMousePressed(new EventHandler<MouseEvent>() { public void handle(MouseEvent me) { System.out.println("Mouse pressed"); } }); root.getChildren().add(btn); primaryStage.setScene(scene); primaryStage.show(); }