@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"); }
StackPane.setAlignment(selectionCircle, Pos.CENTER_LEFT); Group pointerGroup = new Group(); pointerGroup.getChildren().add(hoursPointer); pointerGroup.setTranslateX((-contentCircleRadius + shift) / 2); hoursPointerRotate = new Rotate(0, contentCircleRadius - shift, selectionCircle.getRadius()); pointerRotate.set(hoursPointerRotate); pointerGroup.getTransforms().add(hoursPointerRotate); pointerGroup.setVisible(!is24HourView); StackPane.setAlignment(_24HourSelectionCircle, Pos.CENTER_LEFT); Group pointer24HourGroup = new Group(); pointer24HourGroup.getChildren().add(_24HoursPointer); pointer24HourGroup.setTranslateX(((-contentCircleRadius + shift) / 2) + (_24HourShift / 2)); _24HourHoursPointerRotate = new Rotate(0, contentCircleRadius - shift - _24HourShift, selectionCircle.getRadius()); _24HourPointerRotate.set(_24HourHoursPointerRotate); pointer24HourGroup.getTransforms().add(_24HourHoursPointerRotate); pointer24HourGroup.setVisible(is24HourView);
text = new Text(); text.getStyleClass().setAll("text", "percentage"); final Group group = new Group(fillRect, track, arc, text); group.setManaged(false); arcPane = new StackPane(group); arcPane.setPrefSize(50, 50);
private Group createSubTitle() { Group g = new Group(); g.setManaged(false); String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.CityProductionConsumptionDialog.weekly", new Object[]{}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>()); StackPane titlePane = new StackPane(); titlePane.getChildren().addAll(new PlaceHolder(WIDTH, 1), text); g.getChildren().add(titlePane); return g; }
public void refreshBadge() { badge.getChildren().clear(); if (enabled) { Label labelControl = new Label(text.getValue()); StackPane badgePane = new StackPane(); badgePane.getStyleClass().add("badge-pane"); badgePane.getChildren().add(labelControl); //Adding a clip would avoid overlap but this does not work as intended //badgePane.setClip(clip); badge.getChildren().add(badgePane); StackPane.setAlignment(badge, getPosition()); FadeTransition ft = new FadeTransition(Duration.millis(666), badge); ft.setFromValue(0); ft.setToValue(1.0); ft.setCycleCount(1); ft.setAutoReverse(true); ft.play(); } }
@Override protected void doScaleInstruction(Graphics3DScaleInstruction graphics3DScale) { Vector3D scale = graphics3DScale.getScaleFactor(); Scale outputScale = new Scale(scale.getX(), scale.getY(), scale.getZ()); Group scaleGroup = new Group(); scaleGroup.getTransforms().add(outputScale); currentGroup.getChildren().add(scaleGroup); currentGroup = scaleGroup; }
/** * Create a 3D Scene * * @param w the value of w * @param h the value of h * @return new Scene */ public Scene create3DScene(int w, int h) { Group root = new Group(); root.setDepthTest(DepthTest.ENABLE); Scene scene3D = new Scene(root, w, h, true); camera = new PerspectiveCamera(); scene3D.setCamera(camera); getCenterWinTranslate().setX(w / 3); getCenterWinTranslate().setY((2 * h) / 3); root.getTransforms().addAll(getCenterWinTranslate(), new Rotate(180, Rotate.X_AXIS)); setContentGroup(this.create3dContent()); root.getChildren().addAll(getContentGroup()); scene3D.setOnMouseDragged(this::handleFxRootMouseEvent); scene3D.setOnMouseReleased(this::handlePanelMouseReleasExitedEvent); scene3D.setOnMouseExited(this::handlePanelMouseReleasExitedEvent); scene3D.setOnKeyPressed(this::handleKeyEvent); scene3D.setOnKeyTyped(this::handleKeyEvent); Platform.runLater(() -> { xNegView(); }); return scene3D; }
@Override public Node build() { leftButton = new JFXButton("Alert"); leftButton.setLayoutX(50); leftButton.setLayoutY(50); return new Group(leftButton); }
group = new Group(); group.setManaged(false); group.setAutoSizeChildren(false); locationsGroup = new Group(); locationsGroup.setManaged(false); locationsGroup.visibleProperty().bind(view.showLocationsProperty()); locationsGroup.setAutoSizeChildren(false); locationsGroup.getChildren().remove(change.getValueRemoved()); double deltaX = evt.getX() - dragX; double deltaY = evt.getY() - dragY; group.setTranslateX(group.getTranslateX() + deltaX); group.setTranslateY(group.getTranslateY() + deltaY); dragX = evt.getX(); dragY = evt.getY(); if (evt.getClickCount() == 2) { view.setZoomFactor(1); group.setTranslateX(0); group.setTranslateY(0); } else if (evt.getButton().equals(MouseButton.PRIMARY)) { EventTarget target = evt.getTarget();
public static Group convertTo3D(Node node, int depth) { Group root = new Group(); root.setTranslateX(node.getLayoutX()); root.setTranslateY(node.getLayoutY()); root.setTranslateZ(-20); System.out.println("Layer " + depth + " - Node Type: " + node.getClass()); Box box = new Box(node.getBoundsInParent().getWidth(), node.getBoundsInParent().getHeight(), 0.1); box.setTranslateX(node.getLayoutX()); box.setTranslateY(node.getLayoutY()); SnapshotParameters snapshotParameters = new SnapshotParameters(); snapshotParameters.setFill(Color.TRANSPARENT); box.setMaterial(new PhongMaterial(Color.WHITE, node.snapshot(snapshotParameters, new WritableImage((int) node.getBoundsInParent().getWidth(), (int) node.getBoundsInParent().getHeight())), null, null, null)); root.getChildren().add(box); if (node instanceof Parent) { for (Node child : ((Parent) node).getChildrenUnmodifiable()) { root.getChildren().add(convertTo3D(child, depth + 1)); } } return root; }
/** Initialize the pane content. * * @param content the content. */ protected void initializePane(Node content) { final Group contentGroup = new Group(); this.zoomGroup = new Group(); contentGroup.getChildren().add(this.zoomGroup); this.zoomGroup.getChildren().add(content); setContent(contentGroup); this.scaleTransform = new Scale(this.scaleValue, this.scaleValue, 0, 0); this.zoomGroup.getTransforms().add(this.scaleTransform); this.zoomGroup.setOnScroll(new ZoomHandler()); setContent(contentGroup); setFitToWidth(true); setFitToHeight(true); }
@Override protected Group createFooterText() { int costs = calculateRepairCosts(); Group g = new Group(); String t = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.ShipyardConstructionDialogV2.totalSum", new Object[]{}, locale.getCurrentLocal()); HashMap<String, Object> parameters = new HashMap<>(); parameters.put("price", costs); DecoratedText dt = decoratedTextFactory.createDecoratedText(t, parameters); dt.setId("totalPrice"); g.getChildren().add(dt); g.setId("footerText"); return g; }
int gsz = trackGroup.getChildren().size(); final int cur_tg_index = track.cur_time_index * 2 - 1; if (cur_tg_index >= 0 && cur_tg_index < (gsz - 1)) { trackGroup.getChildren().remove(cur_tg_index, gsz - 1); int start_index = trackGroup.getChildren().size() / 2; if (start_index < 1) { start_index = 1; lineMaterial.setDiffuseColor(lineColor); if (null != track.currentPoint) { if (curPosGroup.getChildren().size() < 2) { Sphere sphere = new Sphere(curPosPointSize); sphere.setMaterial(ptMaterial); txt.setRotate(180.0); txt.setRotationAxis(Rotate.X_AXIS); curPosGroup.getChildren().addAll(sphere, txt); curPosGroup.setTranslateX(track.currentPoint.x * getDistScale()); curPosGroup.setTranslateY(track.currentPoint.y * getDistScale()); curPosGroup.setTranslateZ(track.currentPoint.z * getDistScale()); sphere.setTranslateZ(tp.z * getDistScale()); sphere.setMaterial(ptMaterial); trackGroup.getChildren().addAll(sphere, cyl); if (null != tp.getRpy() && isShowRotationFrames()) { Group axisGroup = createAxis(15.0); PmRpy rpy = tp.getRpy();
/** * Create an element that will layout the <code>childNode</code> * horizontally centered within a Dialog. * @param childNode that should be centered * @return wrapping Pane */ public Group center(Pane childNode) { final int width = IDialog.WRAPPING_WIDTH - 24; Group g = new Group(childNode); childNode.widthProperty().addListener((observable, oldValue, newValue) -> { double inset = (width - childNode.getWidth())/2; g.setLayoutX(inset); }); if (childNode instanceof FlowPane) { ((FlowPane) childNode).setAlignment(Pos.CENTER); } return g; }
public ClusterMeshViewer(Messager messager, ExecutorService executorService) { this.messager = messager; isExecutorServiceProvided = executorService == null; if (isExecutorServiceProvided) this.executorService = Executors.newSingleThreadExecutor(ThreadTools.getNamedThreadFactory(getClass().getSimpleName())); else this.executorService = executorService; root.setMouseTransparent(true); root.getChildren().addAll(rawPointsGroup, navigableExtrusionsGroup, nonNavigableExtrusionsGroup); }
Group group = new Group(overAllLayout); group.setManaged(false); group.setLayoutX(control.paddingLocalProperty().getValue().getLeft());
public void setLabelVisible(boolean b) { if (!b) { getChildren().remove(label); barGroup.translateXProperty().unbind(); barGroup.translateYProperty().unbind(); barGroup.setTranslateX(0); barGroup.setTranslateY(0); } else if (!getChildren().contains(label)) { getChildren().add(label); setLabelPosition(labelPosition); } }
Group background = new Group(radioButtonView, slabView, label, selectedLabel); background.setOnMouseReleased(arg0 -> { boolean oldValue = radioButton.selectedProperty().get(); if (!oldValue) { background.setManaged(false);
@Override protected void layoutChildren(double contentX, double contentY, double contentWidth, double contentHeight) { super.layoutChildren(contentX, contentY, contentWidth, contentHeight); double prefWidth = group.prefWidth(-1); double prefHeight = group.prefHeight(-1); double scaleX = contentWidth / prefWidth; double scaleY = contentHeight / prefHeight; double scale = Math.min(scaleX, scaleY) * getSkinnable().getZoomFactor(); group.setTranslateX(-group.getLayoutBounds().getMinX()); group.setTranslateY(-group.getLayoutBounds().getMinY()); group.setScaleX(scale); group.setScaleY(scale); group.setLayoutX((contentWidth - prefWidth) / 2); group.setLayoutY((contentHeight - prefHeight) / 2); }