javafx.scene.Group Java Examples
The following examples show how to use
javafx.scene.Group.
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: AnchorPaneSample.java From marathonv5 with Apache License 2.0 | 8 votes |
public static Node createIconContent() { StackPane sp = new StackPane(); AnchorPane anchorPane = new AnchorPane(); Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY); rectangle.setStroke(Color.BLACK); anchorPane.setPrefSize(rectangle.getWidth(), rectangle.getHeight()); Rectangle r1 = new Rectangle(14, 14, Color.web("#1c89f4")); Rectangle r2 = new Rectangle(45, 10, Color.web("#349b00")); Rectangle r3 = new Rectangle(35, 14, Color.web("#349b00")); anchorPane.getChildren().addAll(r1, r2, r3); AnchorPane.setTopAnchor(r1, Double.valueOf(1)); AnchorPane.setLeftAnchor(r1, Double.valueOf(1)); AnchorPane.setTopAnchor(r2, Double.valueOf(20)); AnchorPane.setLeftAnchor(r2, Double.valueOf(1)); AnchorPane.setBottomAnchor(r3, Double.valueOf(1)); AnchorPane.setRightAnchor(r3, Double.valueOf(5)); sp.getChildren().addAll(rectangle, anchorPane); return new Group(sp); }
Example #2
Source File: ComponentsTest.java From netbeans with Apache License 2.0 | 7 votes |
@Test(timeOut = 9000) public void loadFX() throws Exception { final CountDownLatch cdl = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); final JFXPanel p = new JFXPanel(); Platform.runLater(new Runnable() { @Override public void run() { Node wv = TestPages.getFX(10, cdl); Scene s = new Scene(new Group(wv)); p.setScene(s); done.countDown(); } }); done.await(); JFrame f = new JFrame(); f.getContentPane().add(p); f.pack(); f.setVisible(true); cdl.await(); }
Example #3
Source File: TargetView.java From ShootOFF with GNU General Public License v3.0 | 6 votes |
public TargetView(Group target, Map<String, String> targetTags, List<Target> targets) { targetFile = null; targetGroup = target; this.targetTags = targetTags; config = Optional.empty(); parent = Optional.empty(); this.targets = Optional.of(targets); userDeletable = false; cameraName = null; origWidth = targetGroup.getBoundsInParent().getWidth(); origHeight = targetGroup.getBoundsInParent().getHeight(); mousePressed(); mouseDragged(); mouseMoved(); mouseReleased(); keyPressed(); }
Example #4
Source File: StopWatch.java From netbeans with Apache License 2.0 | 6 votes |
private void configureDigits() { for (int i : numbers) { digits[i] = new Text("0"); digits[i].setFont(FONT); digits[i].setTextOrigin(VPos.TOP); digits[i].setLayoutX(2.3); digits[i].setLayoutY(-1); Rectangle background; if (i < 6) { background = createBackground(Color.web("#a39f91"), Color.web("#FFFFFF")); digits[i].setFill(Color.web("#000000")); } else { background = createBackground(Color.web("#bdbeb3"), Color.web("#FF0000")); digits[i].setFill(Color.web("#FFFFFF")); } digitsGroup[i] = new Group(background, digits[i]); } }
Example #5
Source File: HTMLEditorSample.java From marathonv5 with Apache License 2.0 | 6 votes |
public static Node createIconContent() { Text htmlStart = new Text("<html>"); Text htmlEnd = new Text("</html>"); htmlStart.setFont(Font.font(null, FontWeight.BOLD, 20)); htmlStart.setStyle("-fx-font-size: 20px;"); htmlStart.setTextOrigin(VPos.TOP); htmlStart.setLayoutY(11); htmlStart.setLayoutX(20); htmlEnd.setFont(Font.font(null, FontWeight.BOLD, 20)); htmlEnd.setStyle("-fx-font-size: 20px;"); htmlEnd.setTextOrigin(VPos.TOP); htmlEnd.setLayoutY(31); htmlEnd.setLayoutX(20); return new Group(htmlStart, htmlEnd); }
Example #6
Source File: EnvironmentView.java From narjillos with MIT License | 6 votes |
public Node toNode() { if (viewState.getLight() == Light.OFF) return darkness; boolean isInfrared = viewState.getLight() == Light.INFRARED; boolean effectsOn = viewState.getEffects() == Effects.ON; Group result = new Group(); Node backgroundFill = isInfrared ? infraredEmptySpace : emptySpace; darkenWithDistance(backgroundFill, viewport.getZoomLevel()); result.getChildren().add(backgroundFill); Node speckles = specklesView.toNode(isInfrared); if (speckles != null) { darkenWithDistance(speckles, viewport.getZoomLevel()); result.getChildren().add(speckles); } result.getChildren().add(getThingsGroup(isInfrared, effectsOn)); if (effectsOn) setZoomLevelEffects(result); return result; }
Example #7
Source File: ImageScaling.java From phoebus with Eclipse Public License 1.0 | 6 votes |
@Override public void start(final Stage stage) { // Image with red border final WritableImage image = new WritableImage(WIDTH, HEIGHT); final PixelWriter writer = image.getPixelWriter(); for (int x=0; x<WIDTH; ++x) { writer.setColor(x, 0, Color.RED); writer.setColor(x, HEIGHT-1, Color.RED); } for (int y=0; y<HEIGHT; ++y) { writer.setColor(0, y, Color.RED); writer.setColor(WIDTH-1, y, Color.RED); } // Draw into canvas, scaling 'up' final Canvas canvas = new Canvas(800, 600); canvas.getGraphicsContext2D().drawImage(image, 0, 0, canvas.getWidth(), canvas.getHeight()); final Scene scene = new Scene(new Group(canvas), canvas.getWidth(), canvas.getHeight()); stage.setScene(scene); stage.show(); }
Example #8
Source File: UiUtil.java From Recaf with MIT License | 6 votes |
/** * @param access * Field modifiers. * * @return Graphic representing fields's attributes. */ public static Node createFieldGraphic(int access) { Group g = new Group(); // Root icon String base = null; if(AccessFlag.isPublic(access)) base = "icons/modifier/field_public.png"; else if(AccessFlag.isProtected(access)) base = "icons/modifier/field_protected.png"; else if(AccessFlag.isPrivate(access)) base = "icons/modifier/field_private.png"; else base = "icons/modifier/field_default.png"; g.getChildren().add(new IconView(base)); // Add modifiers if(AccessFlag.isStatic(access)) g.getChildren().add(new IconView("icons/modifier/static.png")); if(AccessFlag.isFinal(access)) g.getChildren().add(new IconView("icons/modifier/final.png")); if(AccessFlag.isBridge(access) || AccessFlag.isSynthetic(access)) g.getChildren().add(new IconView("icons/modifier/synthetic.png")); return g; }
Example #9
Source File: KStarTreeNode.java From OSPREY3 with GNU General Public License v2.0 | 6 votes |
public KStarTreeNode(int level, String[] assignments, int[] confAssignments, BigDecimal lowerBound, BigDecimal upperBound, double confLowerBound, double confUpperBound, double epsilon) { this.level = level; this.assignments = assignments; this.confAssignments = confAssignments; this.upperBound = upperBound; this.lowerBound = lowerBound; this.epsilon = new BigDecimal(epsilon); this.bandGroup = new Group(); this.confLowerBound = confLowerBound; this.confUpperBound = confUpperBound; this.colorSeeds = new Random[assignments.length]; if(isRoot()) { this.overallUpperBound = upperBound; } }
Example #10
Source File: DotNodeLabelPart.java From gef with Eclipse Public License 2.0 | 6 votes |
/** * The implementation of this class is mainly taken from the * org.eclipse.gef.zest.fx.parts.NodeLabelPart java class. * * Modification added: applying the external label css style on the Text * widget instead of its parent Group. */ @Override protected void doRefreshVisual(Group visual) { Node node = getContent().getKey(); Map<String, Object> attrs = node.attributesProperty(); if (attrs.containsKey(ZestProperties.EXTERNAL_LABEL_CSS_STYLE__NE)) { String textCssStyle = ZestProperties.getExternalLabelCssStyle(node); getText().setStyle(textCssStyle); } String label = ZestProperties.getExternalLabel(node); if (label != null) { getText().setText(label); } IVisualPart<? extends javafx.scene.Node> firstAnchorage = getFirstAnchorage(); if (firstAnchorage == null) { return; } refreshPosition(getVisual(), getLabelPosition()); }
Example #11
Source File: TimelineInterpolator.java From netbeans with Apache License 2.0 | 6 votes |
private void init(Stage primaryStage) { Group root = new Group(); primaryStage.setResizable(false); primaryStage.setScene(new Scene(root, 250, 90)); //create circles by method createMovingCircle listed below Circle circle1 = createMovingCircle(Interpolator.LINEAR); //default interpolator circle1.setOpacity(0.7); Circle circle2 = createMovingCircle(Interpolator.EASE_BOTH); //circle slows down when reached both ends of trajectory circle2.setOpacity(0.45); Circle circle3 = createMovingCircle(Interpolator.EASE_IN); Circle circle4 = createMovingCircle(Interpolator.EASE_OUT); Circle circle5 = createMovingCircle(Interpolator.SPLINE(0.5, 0.1, 0.1, 0.5)); //one can define own behaviour of interpolator by spline method root.getChildren().addAll( circle1, circle2, circle3, circle4, circle5 ); }
Example #12
Source File: CircleSample.java From marathonv5 with Apache License 2.0 | 6 votes |
public CircleSample() { super(180,90); // Simple red filled circle Circle circle1 = new Circle(45,45,40, Color.RED); // Blue stroked circle Circle circle2 = new Circle(135,45,40); circle2.setStroke(Color.DODGERBLUE); circle2.setFill(null); // Create a group to show all the circles); getChildren().add(new Group(circle1,circle2)); // REMOVE ME setControls( new SimplePropertySheet.PropDesc("Circle 1 Fill", circle1.fillProperty()), new SimplePropertySheet.PropDesc("Circle 1 Radius", circle1.radiusProperty(), 10d, 40d), new SimplePropertySheet.PropDesc("Circle 2 Stroke", circle2.strokeProperty()), new SimplePropertySheet.PropDesc("Circle 2 Stroke Width", circle2.strokeWidthProperty(), 1d, 5d), new SimplePropertySheet.PropDesc("Circle 2 Radius", circle2.radiusProperty(), 10d, 40d) ); // END REMOVE ME }
Example #13
Source File: PointsEditor.java From phoebus with Eclipse Public License 1.0 | 6 votes |
/** Create points editor * @param root Parent group where editor can host its UI elements * @param constrain Point constrain * @param points Points to edit * @param listener Listener to notify */ public PointsEditor(final Group root, final PointConstraint constrain, final Points points, final PointsEditorListener listener) { init(); this.constrain = constrain; this.points = points; this.listener = listener; handle_group = new Group(); root.getChildren().add(handle_group); line.getStyleClass().add("points_edit_line"); startMode(points.size() <= 0 ? Mode.APPEND // No points, first append some : Mode.EDIT); // Start by editing existing points handle_group.getScene().addEventFilter(KeyEvent.KEY_PRESSED, key_filter); }
Example #14
Source File: ACEEditorSample.java From marathonv5 with Apache License 2.0 | 6 votes |
@Override public void start(Stage stage) throws IOException { INITIAL_TEXT = new String(IOUtils.toByteArray(ACEEditorSample.class.getResourceAsStream("/aceeditor.js"))); stage.setTitle("HTMLEditor Sample"); stage.setWidth(650); stage.setHeight(500); Scene scene = new Scene(new Group()); VBox root = new VBox(); root.setPadding(new Insets(8, 8, 8, 8)); root.setSpacing(5); root.setAlignment(Pos.BOTTOM_LEFT); final ACEEditor htmlEditor = new ACEEditor(true, 1, true); htmlEditor.setText(INITIAL_TEXT); htmlEditor.setMode("javascript"); root.getChildren().addAll(htmlEditor.getNode()); scene.setRoot(root); stage.setScene(scene); stage.show(); }
Example #15
Source File: CSSFXTesterApp.java From cssfx with Apache License 2.0 | 6 votes |
private Group buildCirclePane(int prefWidth, int prefHeight) { Group freePlacePane = new Group(); int defaultShapeSize = 50; int shapeNumber = 10; Random r = new Random(); for (int i = 0; i < shapeNumber; i++) { Circle c = new Circle(Math.max(10, defaultShapeSize * r.nextInt(100) / 100)); c.getStyleClass().add("circle"); if (i % 2 == 0) { c.getStyleClass().add("even"); } else { c.getStyleClass().add("odd"); } c.setCenterX(r.nextInt(prefWidth)); c.setCenterY(r.nextInt(prefHeight)); c.setFill(Color.BLUE); freePlacePane.getChildren().add(c); } freePlacePane.getStyleClass().add("circles"); freePlacePane.prefWidth(250); freePlacePane.prefWidth(200); return freePlacePane; }
Example #16
Source File: SpaceInvadersFactory.java From FXGLGames with MIT License | 5 votes |
@Spawns("Stars") public Entity newStars(SpawnData data) { Group group = new Group(); for (int i = 0; i < NUM_STARS; i++) { group.getChildren().addAll(new Rectangle()); } return entityBuilder() .view(group) .zIndex(-450) .with(new StarsComponent()) .build(); }
Example #17
Source File: BlendEffect.java From Learn-Java-12-Programming with MIT License | 5 votes |
AllBlendEffectsThread(Text txt1, Text txt2, Text txt3, Group g1, Group g2){ setDaemon(true); this.txt1 = txt1; this.txt2 = txt2; this.txt3 = txt3; this.g1 = g1; this.g2 = g2; }
Example #18
Source File: ScrollBarSample.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void start(Stage stage) { Group root = new Group(); Scene scene = new Scene(root, 180, 180); scene.setFill(Color.BLACK); stage.setScene(scene); stage.setTitle("Scrollbar"); root.getChildren().addAll(vb, sc); shadow.setColor(Color.GREY); shadow.setOffsetX(2); shadow.setOffsetY(2); vb.setLayoutX(5); vb.setSpacing(10); sc.setLayoutX(scene.getWidth() - sc.getWidth()); sc.setMin(0); sc.setOrientation(Orientation.VERTICAL); sc.setPrefHeight(180); sc.setMax(360); for (int i = 0; i < 5; i++) { final Image image = images[i] = new Image(getClass().getResourceAsStream("fw" + (i + 1) + ".jpg")); final ImageView pic = pics[i] = new ImageView(images[i]); pic.setEffect(shadow); vb.getChildren().add(pics[i]); } sc.valueProperty().addListener((ObservableValue<? extends Number> ov, Number old_val, Number new_val) -> { vb.setLayoutY(-new_val.doubleValue()); }); stage.show(); }
Example #19
Source File: SliderDemo.java From JFoenix with Apache License 2.0 | 5 votes |
@Override public void start(Stage stage) { JFXSlider horLeftSlider = new JFXSlider(); horLeftSlider.setMinWidth(500); JFXSlider horRightSlider = new JFXSlider(); horRightSlider.setMinWidth(500); horRightSlider.setIndicatorPosition(IndicatorPosition.RIGHT); JFXSlider verLeftSlider = new JFXSlider(); verLeftSlider.setMinHeight(500); verLeftSlider.setOrientation(Orientation.VERTICAL); JFXSlider verRightSlider = new JFXSlider(); verRightSlider.setMinHeight(500); verRightSlider.setOrientation(Orientation.VERTICAL); verRightSlider.setIndicatorPosition(IndicatorPosition.RIGHT); HBox hbox = new HBox(); hbox.setSpacing(450); hbox.getChildren().addAll(verRightSlider, verLeftSlider); VBox vbox = new VBox(); vbox.getChildren().addAll(horRightSlider, horLeftSlider, hbox); vbox.setSpacing(100); vbox.setPadding(new Insets(100, 50, 50, 150)); Scene scene = new Scene(new Group()); ((Group) scene.getRoot()).getChildren().add(vbox); scene.getStylesheets().add(SliderDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); stage.setScene(scene); stage.setWidth(900); stage.setHeight(900); stage.show(); stage.setTitle("JFX Slider Demo"); }
Example #20
Source File: BlendEffect.java From Learn-Java-12-Programming with MIT License | 5 votes |
static Node[] setModeOnGroup(BlendMode bm1, BlendMode bm2){ Node txt1 = new Text(bm1.name()); Node txt2 = new Text(bm2.name()); Node c1 = createCircle(); Node s1 = createSquare(); Node g1 = new Group(s1, c1); g1.setBlendMode(bm1); Node c2 = createCircle(); Node s2 = createSquare(); Node g2 = new Group(c2, s2); g2.setBlendMode(bm1); Node c3 = createCircle(); Node s3 = createSquare(); Node g3 = new Group(s3, c3); g3.setBlendMode(bm2); Node c4 = createCircle(); Node s4 = createSquare(); Node g4 = new Group(c4, s4); g4.setBlendMode(bm2); Node[] arr = {txt1, g1, g2, txt2, g3, g4 }; return arr; }
Example #21
Source File: Main.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void start(Stage stage) { Config.initialize(); Group root = new Group(); mainFrame = new MainFrame(root); stage.setTitle("Brick Breaker"); stage.setResizable(false); stage.setWidth(Config.SCREEN_WIDTH + 2*Config.WINDOW_BORDER); stage.setHeight(Config.SCREEN_HEIGHT+ 2*Config.WINDOW_BORDER + Config.TITLE_BAR_HEIGHT); Scene scene = new Scene(root); scene.setFill(Color.BLACK); stage.setScene(scene); mainFrame.changeState(MainFrame.SPLASH); stage.show(); }
Example #22
Source File: Viewer3d.java From phoebus with Eclipse Public License 1.0 | 5 votes |
/** @param disabled Disable mouse interaction? * @throws Exception on error */ public Viewer3d (final boolean disabled) throws Exception { axes = buildAxes(); view.getChildren().add(axes); root = new Group(view); root.setDepthTest(DepthTest.ENABLE); scene = new SubScene(root, 1024, 768, true, SceneAntialiasing.BALANCED); scene.setManaged(false); scene.setFill(Color.GRAY); scene.heightProperty().bind(heightProperty()); scene.widthProperty().bind(widthProperty()); buildCamera(); scene.setCamera(camera); // Legend, placed on top of 3D scene final HBox legend = new HBox(10, createAxisLabel("X Axis", Color.RED), createAxisLabel("Y Axis", Color.GREEN), createAxisLabel("Z Axis", Color.BLUE)); legend.setPadding(new Insets(10)); getChildren().setAll(scene, legend); if (! disabled) handleMouse(this); }
Example #23
Source File: PaginationDemo.java From netbeans with Apache License 2.0 | 5 votes |
private void init(Stage primaryStage) { Group root = new Group(); primaryStage.setScene(new Scene(root)); VBox outerBox = new VBox(); outerBox.setAlignment(Pos.CENTER); //Images for our pages for (int i = 0; i < 7; i++) { images[i] = new Image(PaginationDemo.class.getResource("animal" + (i + 1) + ".jpg").toExternalForm(), false); } pagination = PaginationBuilder.create().pageCount(7).pageFactory(new Callback<Integer, Node>() { @Override public Node call(Integer pageIndex) { return createAnimalPage(pageIndex); } }).build(); //Style can be numeric page indicators or bullet indicators Button styleButton = ButtonBuilder.create().text("Toggle pagination style").onAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent me) { if (!pagination.getStyleClass().contains(Pagination.STYLE_CLASS_BULLET)) { pagination.getStyleClass().add(Pagination.STYLE_CLASS_BULLET); } else { pagination.getStyleClass().remove(Pagination.STYLE_CLASS_BULLET); } } }).build(); outerBox.getChildren().addAll(pagination, styleButton); root.getChildren().add(outerBox); }
Example #24
Source File: LabelSourceState.java From paintera with GNU General Public License v2.0 | 5 votes |
public static <D extends IntegerType<D> & NativeType<D>, T extends Volatile<D> & IntegerType<T>> LabelSourceState<D, T> simpleSourceFromSingleRAI( final RandomAccessibleInterval<D> data, final double[] resolution, final double[] offset, final Invalidate<Long> invalidate, final long maxId, final String name, final Group meshesGroup, final ObjectProperty<ViewFrustum> viewFrustumProperty, final ObjectProperty<AffineTransform3D> eyeToWorldTransformProperty, final ExecutorService meshManagerExecutors, final HashPriorityQueueBasedTaskExecutor<MeshWorkerPriority> meshWorkersExecutors) { return simpleSourceFromSingleRAI( data, resolution, offset, invalidate, maxId, name, new LabelBlockLookupNoBlocks(), meshesGroup, viewFrustumProperty, eyeToWorldTransformProperty, meshManagerExecutors, meshWorkersExecutors); }
Example #25
Source File: CreatureLab3dController.java From BowlerStudio with GNU General Public License v3.0 | 5 votes |
public void setOverlayBottomRight(Group content) { Platform.runLater(() -> { TempControlsAnchor.getChildren().clear(); TempControlsAnchor.getChildren().add(content); AnchorPane.setTopAnchor(content, 0.0); AnchorPane.setRightAnchor(content, 0.0); AnchorPane.setLeftAnchor(content, 0.0); AnchorPane.setBottomAnchor(content, 0.0); TempControlsAnchor.setVisible(true); }); }
Example #26
Source File: PathSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public PathSample() { super(180,90); // Create path shape - square Path path1 = new Path(); path1.getElements().addAll( new MoveTo(25, 25), new HLineTo(65), new VLineTo(65), new LineTo(25, 65), new ClosePath() ); path1.setFill(null); path1.setStroke(Color.RED); path1.setStrokeWidth(2); // Create path shape - curves Path path2 = new Path(); path2.getElements().addAll( new MoveTo(100, 45), new CubicCurveTo(120, 20, 130, 80, 140, 45), new QuadCurveTo(150, 0, 160, 45), new ArcTo(20, 40, 0, 180, 45, true, true) ); path2.setFill(null); path2.setStroke(Color.DODGERBLUE); path2.setStrokeWidth(2); // show the path shapes; getChildren().add(new Group(path1, path2)); // REMOVE ME setControls( new SimplePropertySheet.PropDesc("Path 1 Stroke", path1.strokeProperty()), new SimplePropertySheet.PropDesc("Path 2 Stroke", path2.strokeProperty()) ); // END REMOVE ME }
Example #27
Source File: HighDpiIconsApp.java From gef with Eclipse Public License 2.0 | 5 votes |
@Override public Scene createScene() { Group root = new Group(); Button button = new Button(); button.relocate(100, 100); button.getStyleClass().add("icon"); root.getChildren().add(button); root.getStylesheets().add(HighDpiIconsApp.class .getResource("styles.css").toExternalForm()); Scene scene = new Scene(root, 400, 400); return scene; }
Example #28
Source File: ProgressSample.java From mars-sim with GNU General Public License v3.0 | 5 votes |
@Override public void start(Stage stage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250); stage.setScene(scene); stage.setTitle("Progress Controls"); for (int i = 0; i < values.length; i++) { final Label label = labels[i] = new Label(); label.setText("progress:" + values[i]); final ProgressBar pb = pbs[i] = new ProgressBar(); pb.setProgress(values[i]); final ProgressIndicator pin = pins[i] = new ProgressIndicator(); pin.setProgress(values[i]); final HBox hb = hbs[i] = new HBox(); hb.setSpacing(5); hb.setAlignment(Pos.CENTER); //hb.getChildren().addAll(label, pb, pin); hb.getChildren().addAll(pin); } final VBox vb = new VBox(); vb.setSpacing(5); vb.getChildren().addAll(hbs); scene.setRoot(vb); stage.show(); }
Example #29
Source File: ProjectorArenaPane.java From ShootOFF with GNU General Public License v3.0 | 5 votes |
public ProjectorArenaPane(Configuration config, CanvasManager canvasManager) { this.config = config; this.canvasManager = canvasManager; shootOffStage = null; trainingExerciseContainer = null; arenaCanvasGroup = new Group(); calibrationLabel = null; }
Example #30
Source File: SwingFXWebView.java From mars-sim with GNU General Public License v3.0 | 5 votes |
/** * createScene * * Note: Key is that Scene needs to be created and run on "FX user thread" * NOT on the AWT-EventQueue Thread * */ @SuppressWarnings("restriction") private void createScene() { // Platform.startup(new Runnable() { Platform.runLater(new Runnable() { @Override public void run() { stage = new Stage(); stage.setTitle("Hello Java FX"); stage.setResizable(true); Group root = new Group(); Scene scene = new Scene(root,80,20); stage.setScene(scene); // Set up the embedded browser: browser = new WebView(); webEngine = browser.getEngine(); webEngine.load("https://github.com/travis-ci/travis-ci");//https://sourceforge.net/p/mars-sim/discussion/");//"http://www.google.com"); ObservableList<Node> children = root.getChildren(); children.add(browser); jfxPanel.setScene(scene); } }); }