public void setSize(double prefWidth, double prefHeight) { contentContainer.setPrefSize(prefWidth, prefHeight); }
private void initStyle(StackPane pane) { pane.setOpacity(1); pane.setPrefSize(30, 4); pane.setBackground(new Background(new BackgroundFill(Color.BLACK, new CornerRadii(5), Insets.EMPTY))); }
@Override public void start(final Stage stage) throws Exception { StackPane r1 = new StackPane(); r1.setPrefSize(200, 150); r1.setStyle("-fx-background-color: palegreen;"); r2.setPrefSize(200, 150); r2.setStyle("-fx-background-color: coral;");
box.setPrefSize(20, 20); box.setMaxSize(20, 20); box.setBorder(new Border(new BorderStroke(control.getUnCheckedColor(),
group.setManaged(false); arcPane = new StackPane(group); arcPane.setPrefSize(50, 50); getChildren().setAll(arcPane);
StackPane.setMargin(centeredGlyph, new Insets(10)); centeredGlyph.setPrefSize(MAX_ICON_SIZE + 10 * 2, MAX_ICON_SIZE + 10 * 2);
public void setSize(double prefWidth, double prefHeight) { contentContainer.setPrefSize(prefWidth, prefHeight); }
StackPane p = new StackPane(); p.setPrefSize(700,700); //set a default size for your stackpane Image img = new Image("test.png"); //create an image ImageView v = new ImageView(img); //create an imageView and pass the image p.getChildren().add(v); //add imageView to stackPane StackPane.setAlignment(v,Pos.CENTER_LEFT); //set it to the Center Left(by default it's on the center) stage.setScene(new Scene(p)); stage.show();
public void start(Stage primaryStage) { ... primaryStage.show(); StackPane sp=(StackPane)tree.lookup(".tree-disclosure-node"); sp.setPrefSize(80,80); sp.setAlignment(Pos.CENTER); sp.setPadding(new Insets(20)); }
@Override public void start( Stage stage ) { StackPane flow = new StackPane(); flow.setPrefSize(900, 30); Label label = new Label("Zoom 1.5"); Label labelStat = new Label("Users 7"); Label labelSec = new Label("Connected"); StackPane.setAlignment( label, Pos.CENTER_LEFT ); StackPane.setAlignment( labelStat, Pos.CENTER ); StackPane.setAlignment( labelSec, Pos.CENTER_RIGHT ); flow.getChildren().addAll(label, labelStat, labelSec); Scene scene = new Scene(flow); stage.setScene(scene); stage.show(); }
Group group = new Group(new Rectangle(100, 80)); group.setManaged(false); StackPane container = new StackPane(); container.setMinSize(StackPane.USE_PREF_SIZE, StackPane.USE_PREF_SIZE); container.setPrefSize(200, 200); container.setMaxSize(StackPane.USE_PREF_SIZE, StackPane.USE_PREF_SIZE); container.getChildren().add(group);
private StackPane sp = new StackPane(); private TextField tf = new TextField(); private ImageView iv; //Init StackPane sp.getStylesheets().add(getClass().getResource("style.css").toExternalForm()); sp.getStyleClass().add("identifiant"); sp.setPrefSize(200, 40); sp.setLayoutX(100); sp.setLayoutY(100); //Init ImageView iv = new ImageView(getClass().getResource("Img.png").toString()); StackPane.setAlignment(iv, Pos.CENTER_LEFT); StackPane.setMargin(iv, new Insets(0, 0, 0, 10)); //Init TextField StackPane.setAlignment(tf, Pos.CENTER_LEFT); StackPane.setMargin(tf, new Insets(2, 5, 0, 30)); //Add all content sp.getChildren().addAll(iv,tf);
new ChangeListener<Bounds>() { @Override public void changed(ObservableValue<? extends Bounds> observableValue, Bounds oldBounds, Bounds newBounds) { nodeContainer.setPrefSize( Math.max(node.getBoundsInParent().getMaxX(), newBounds.getWidth()), Math.max(node.getBoundsInParent().getMaxY(), newBounds.getHeight()) nodeContainer.setPrefSize( Math.max(nodeContainer.getBoundsInParent().getMaxX(), scrollPane.getViewportBounds().getWidth()), Math.max(nodeContainer.getBoundsInParent().getMaxY(), scrollPane.getViewportBounds().getHeight())
public class ShadedSphere extends Application { public void start(Stage stage) { StackPane layout = new StackPane(); layout.setPrefSize(300, 300); Scene scene = new Scene(layout); createScene(scene); stage.setScene(scene); stage.show(); } private void createScene(Scene scene) { PhongMaterial material = new PhongMaterial(); material.setDiffuseColor(Color.ORANGE); material.setSpecularColor(Color.BLACK); Sphere sphere = new Sphere(100); sphere.setMaterial(material); Pane root = (Pane) scene.getRoot(); root.getChildren().add(sphere); } public static void main(String[] args) { launch(args); } }
layout.getChildren().setAll(feedbackButton); StackPane.setAlignment(feedbackButton, Pos.TOP_RIGHT); layout.setPrefSize(225, 275); layout.setStyle("-fx-background-color: lightcyan;");
private void initStyle(StackPane pane) { pane.setOpacity(1); pane.setPrefSize(30, 4); pane.setBackground(new Background(new BackgroundFill(Color.BLACK, new CornerRadii(5), Insets.EMPTY))); }
sp.setPrefSize(100, 12);
MenuItem m=new MenuItem(text); StackPane g=new StackPane(); g.setPrefSize(24, 24); g.setId(symbol); m.setGraphic(g);
box.setPrefSize(20, 20); box.setMaxSize(20, 20); box.setBorder(new Border(new BorderStroke(control.getUnCheckedColor(),
group.setManaged(false); arcPane = new StackPane(group); arcPane.setPrefSize(50, 50); getChildren().setAll(arcPane);