Java 类javafx.scene.layout.VBoxBuilder 实例源码

项目:marathonv5    文件:ColorPickerSample.java   
public ColorPickerSample() {
    final ColorPicker colorPicker = new ColorPicker(Color.GRAY);
    ToolBar standardToolbar = ToolBarBuilder.create().items(colorPicker).build();

    final Text coloredText = new Text("Colors");
    Font font = new Font(53);
    coloredText.setFont(font);
    final Button coloredButton = new Button("Colored Control");
    Color c = colorPicker.getValue();
    coloredText.setFill(c);
    coloredButton.setStyle(createRGBString(c));

    colorPicker.setOnAction(new EventHandler() {

        public void handle(Event t) {
            Color newColor = colorPicker.getValue();
            coloredText.setFill(newColor);                          
            coloredButton.setStyle(createRGBString(newColor));
        }
    });

    VBox coloredObjectsVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(20).children(coloredText, coloredButton).build();        
    VBox outerVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(150).padding(new Insets(0, 0, 120, 0)).children(standardToolbar, coloredObjectsVBox).build();
    getChildren().add(outerVBox);
}
项目:marathonv5    文件:ColorPickerSample.java   
public ColorPickerSample() {
    final ColorPicker colorPicker = new ColorPicker(Color.GRAY);
    ToolBar standardToolbar = ToolBarBuilder.create().items(colorPicker).build();

    final Text coloredText = new Text("Colors");
    Font font = new Font(53);
    coloredText.setFont(font);
    final Button coloredButton = new Button("Colored Control");
    Color c = colorPicker.getValue();
    coloredText.setFill(c);
    coloredButton.setStyle(createRGBString(c));

    colorPicker.setOnAction(new EventHandler() {

        public void handle(Event t) {
            Color newColor = colorPicker.getValue();
            coloredText.setFill(newColor);                          
            coloredButton.setStyle(createRGBString(newColor));
        }
    });

    VBox coloredObjectsVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(20).children(coloredText, coloredButton).build();        
    VBox outerVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(150).padding(new Insets(0, 0, 120, 0)).children(standardToolbar, coloredObjectsVBox).build();
    getChildren().add(outerVBox);
}
项目:openjfx-8u-dev-tests    文件:StylesheetApp.java   
@Override
public void start(Stage stage) throws Exception {
    StackPane  pane = new StackPane();
    Pane golden = new Pane();
    golden.setId(EXAMPLE_ID);
    golden.setMinSize(WIDTH, 120);
    Text button  = new Text("Change CSS");
    final Scene scene = new Scene(pane, HEIGHT, WIDTH);
    button.setOnMouseClicked(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent t) {
            styleIndex = styleIndex == 0 ? 1 : 0;
            scene.getStylesheets().set(0, styles[styleIndex]);
        }
    });
    scene.getStylesheets().add(styles[styleIndex]);
    pane.getChildren().add(VBoxBuilder.create().alignment(Pos.CENTER).spacing(50).children(golden, button).build());
    stage.setScene(scene);
    stage.setTitle("Test for RT-17348." + VersionInfo.getRuntimeVersion());
    stage.show();
}
项目:javafx-demos    文件:ProgressBarDemo.java   
@Override
public void start(Stage stage) throws Exception {
    this.stage = stage;
    configureScene();
    configureStage();

    VBox vb = VBoxBuilder.create().spacing(15).padding(new Insets(15)).build();
    root.getChildren().add(vb);

    ProgressBar defaultProgressBar = new ProgressBar();

    ProgressBar progress1 = getProgress();
    progress1.setProgress(.2F);

    ProgressBar progress2 = getProgress();
    progress2.setProgress(.6F);

    ProgressBar progress3 = getProgress();
    progress3.setProgress(.9F);

    vb.getChildren().addAll(defaultProgressBar, progress1, progress2, progress3);

    Label lbl = new Label();
    lbl.setWrapText(true);

}
项目:kotlinfx-ensemble    文件:ColorPickerSample.java   
public ColorPickerSample() {
    final ColorPicker colorPicker = new ColorPicker(Color.GRAY);
    ToolBar standardToolbar = ToolBarBuilder.create().items(colorPicker).build();

    final Text coloredText = new Text("Colors");
    Font font = new Font(53);
    coloredText.setFont(font);
    final Button coloredButton = new Button("Colored Control");
    Color c = colorPicker.getValue();
    coloredText.setFill(c);
    coloredButton.setStyle(createRGBString(c));

    colorPicker.setOnAction(new EventHandler() {

        public void handle(Event t) {
            Color newColor = colorPicker.getValue();
            coloredText.setFill(newColor);                          
            coloredButton.setStyle(createRGBString(newColor));
        }
    });

    VBox coloredObjectsVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(20).children(coloredText, coloredButton).build();        
    VBox outerVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(150).padding(new Insets(0, 0, 120, 0)).children(standardToolbar, coloredObjectsVBox).build();
    getChildren().add(outerVBox);
}
项目:lawless-legends    文件:UIAction.java   
public static void choose(String message, Choice... choices) {
    final Stage dialogStage = new Stage();

    HBoxBuilder options = HBoxBuilder.create().alignment(Pos.CENTER).spacing(10.0).padding(new Insets(5));
    List<Button> buttons = new ArrayList<>();
    for (final Choice c : choices) {
        Button b = new Button(c.text);
        b.setOnAction((ActionEvent t) -> {
            if (c.handler != null) {
                c.handler.run();
            }
            dialogStage.close();
        });
        buttons.add(b);
    }
    options.children(buttons);
    dialogStage.initModality(Modality.WINDOW_MODAL);
    dialogStage.setScene(new Scene(VBoxBuilder.create().
            children(new Text(message), options.build()).
            alignment(Pos.CENTER).padding(new Insets(5)).build()));
    dialogStage.show();
}
项目:incubator-netbeans    文件:ColorPickerDemo.java   
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setScene(new Scene(root));
    final ColorPicker colorPicker = new ColorPicker(Color.GRAY);
    ToolBar standardToolbar = ToolBarBuilder.create().items(colorPicker).build();

    final Text coloredText = new Text("Colors");
    Font font = new Font(53);
    coloredText.setFont(font);
    final Button coloredButton = new Button("Colored Control");
    Color c = colorPicker.getValue();
    coloredText.setFill(c);
    coloredButton.setStyle(createRGBString(c));

    colorPicker.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent t) {
            Color newColor = colorPicker.getValue();
            coloredText.setFill(newColor);                          
            coloredButton.setStyle(createRGBString(newColor));
        }
    });

    VBox coloredObjectsVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(20).children(coloredText, coloredButton).build();        
    VBox outerVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(150).padding(new Insets(0, 0, 120, 0)).children(standardToolbar, coloredObjectsVBox).build();
    root.getChildren().add(outerVBox);
}
项目:marathonv5    文件:SearchBoxSample.java   
public SearchBoxSample() {
    String searchBoxCss = SearchBoxSample.class.getResource("SearchBox.css").toExternalForm();
    VBox vbox = VBoxBuilder.create().build();
    vbox.getStylesheets().add(searchBoxCss);
    vbox.setPrefWidth(200);
    vbox.setMaxWidth(Control.USE_PREF_SIZE);
    vbox.getChildren().add(new SearchBox());
    getChildren().add(vbox);
}
项目:marathonv5    文件:InsetTextButtonSample.java   
public InsetTextButtonSample() {

        String insetTextCss = InsetTextButtonSample.class.getResource("InsetTextButton.css").toExternalForm();
        VBox vbox = VBoxBuilder.create().id("insettextvbox").spacing(10).padding(new Insets(10)).children(
                ButtonBuilder.create().text("Inset Text Button").id("button1").build(),
                ButtonBuilder.create().text("Plain Text Button").id("button2").build()).build();

        vbox.getStylesheets().add(insetTextCss);
        getChildren().add(vbox);
    }
项目:marathonv5    文件:SearchBoxSample.java   
public SearchBoxSample() {
    String searchBoxCss = SearchBoxSample.class.getResource("SearchBox.css").toExternalForm();
    VBox vbox = VBoxBuilder.create().build();
    vbox.getStylesheets().add(searchBoxCss);
    vbox.setPrefWidth(200);
    vbox.setMaxWidth(Control.USE_PREF_SIZE);
    vbox.getChildren().add(new SearchBox());
    getChildren().add(vbox);
}
项目:marathonv5    文件:InsetTextButtonSample.java   
public InsetTextButtonSample() {

        String insetTextCss = InsetTextButtonSample.class.getResource("InsetTextButton.css").toExternalForm();
        VBox vbox = VBoxBuilder.create().id("insettextvbox").spacing(10).padding(new Insets(10)).children(
                ButtonBuilder.create().text("Inset Text Button").id("button1").build(),
                ButtonBuilder.create().text("Plain Text Button").id("button2").build()).build();

        vbox.getStylesheets().add(insetTextCss);
        getChildren().add(vbox);
    }
项目:xpanderfx    文件:Completion.java   
/**
 * 
 * @return root-node
 */
@SuppressWarnings("deprecation")
private BorderPane getBody() {
    return BorderPaneBuilder.create().minHeight(200).minWidth(440).center(
            VBoxBuilder.create().alignment(Pos.CENTER).children(
                    LabelBuilder.create()
                            .minHeight(10).build(),
                    LabelBuilder.create().text("Congratulation !! You won the game.")
                        .font(Font.font("", FontWeight.BOLD, FontPosture.ITALIC, 20))
                            .textFill(Color.WHITE).build(),
                    LabelBuilder.create()
                            .minHeight(30).build(),
                    HBoxBuilder.create().alignment(Pos.CENTER).spacing(20).children(
                            ButtonBuilder.create().text("Continue").font(Font.font("", FontWeight.SEMI_BOLD, FontPosture.REGULAR, 18))
                                    .minWidth(140).textFill(Color.WHITE).style("-fx-base:darkslategrey")
                                    .onAction(e -> this.close()).build(),
                            ButtonBuilder.create().text("Try Again").font(Font.font("", FontWeight.SEMI_BOLD, FontPosture.REGULAR, 18))
                                    .minWidth(140).textFill(Color.WHITE).style("-fx-base:darkslategrey")
                                    .onAction(e -> {
                                        controller.restart();   
                                        this.close();
                                    }).build()
                    ).build()
            )
            .build()
    ).style("-fx-background-color: linear-gradient(#000000cc, darkslategrey); -fx-background-radius: 15; -fx-border-radius:15;"
            + "-fx-border-width:1; -fx-border-color:lightgrey").build();
}
项目:openjfx-8u-dev-tests    文件:ControlChooserApp.java   
private Parent getContent() {
    spaceForNode = new VBox(10);
    spaceForNode.setAlignment(Pos.CENTER);
    spaceForNode.setMinWidth(300);
    spaceForNode.setPrefWidth(300);
    spaceForNode.setMaxWidth(300);
    spaceForNode.setMinHeight(300);
    spaceForNode.setPrefHeight(300);
    spaceForNode.setMaxHeight(300);
    spaceForNode.setStyle("-fx-border-color:RED");

    VBox controls = new VBox(10);
    controls.setAlignment(Pos.CENTER);
    controls.getChildren().add(createNodeChooser());
    controls.setStyle("-fx-border-color:GREEN");

    VBox vBox = VBoxBuilder.create()
            .children(spaceForNode, controls)
            .spacing(10d)
            .build();

    HBox hBox = new HBox(10);
    hBox.setAlignment(Pos.TOP_LEFT);
    hBox.getChildren().addAll(
            vBox,
            propertiesPane);
    return hBox;
}
项目:openjfx-8u-dev-tests    文件:LcdAPITestApp.java   
@Override
protected Scene getScene() {
    VBox root = VBoxBuilder.create()
            .padding(new Insets(10))
            .spacing(10)
            .children(
                TextBuilder.create()
                    .id("GrayGray")
                    .text("Text")
                    .fontSmoothingType(FontSmoothingType.GRAY)
                    .style("-fx-font-size: 16;-fx-font-smoothing-type: gray; ")
                    .build(),
                TextBuilder.create()
                    .id("LCDGray")
                    .text("Text")
                    .fontSmoothingType(FontSmoothingType.LCD)
                    .style("-fx-font-size: 16;-fx-font-smoothing-type: gray; ")
                    .build(),
                TextBuilder.create()
                    .id("GrayLCD")
                    .text("Text")
                    .fontSmoothingType(FontSmoothingType.GRAY)
                    .style("-fx-font-size: 16;-fx-font-smoothing-type: lcd; ")
                    .build(),
                TextBuilder.create()
                    .id("LCDLCD")
                    .text("Text")
                    .fontSmoothingType(FontSmoothingType.LCD)
                    .style("-fx-font-size: 16;-fx-font-smoothing-type: lcd;")
                    .build()
                )
            .build();

    return new Scene(root, 200, 200);
}
项目:javafx-demos    文件:TableViewCheckBoxColumnDemo.java   
private void init(Stage primaryStage) {
    StackPane root = new StackPane();
    Scene s = new Scene(root);
    primaryStage.setScene(s);

    VBox vb = VBoxBuilder.create().padding(new Insets(15)).spacing(15).build();
    vb.getChildren().addAll(getEmployeeTable(), getExportButton());

    root.getChildren().addAll(vb);
    ScenicView.show(s);
}
项目:javafx-demos    文件:DynamicTextAreaDemo.java   
@Override
public void start(Stage stage) throws Exception {
    this.stage = stage;
    configureScene();
    configureStage();
    // Logic starts
    VBox vb = new VBox();
    vb.setSpacing(10);

    final VBox layout = VBoxBuilder.create().build();
    layout.getChildren().add(new DynamicTextArea());

    Button btn = ButtonBuilder.create().text("Add").onAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent arg0) {
            layout.getChildren().add(new DynamicTextArea());
        }
    }).build();

    final GridPane gridPane = GridPaneBuilder.create()
            .styleClass("contact-details-gridpane")
            // [ARE] Further modification for CAEMR-2098. Setting minimum width to show labels even if application width is changed.
            .columnConstraints(ColumnConstraintsBuilder.create().hgrow(Priority.NEVER).minWidth(80).build(),
                    ColumnConstraintsBuilder.create().hgrow(Priority.ALWAYS).build(),
                    ColumnConstraintsBuilder.create().hgrow(Priority.NEVER).minWidth(100).build()).build();

    gridPane.addRow(0, new Label("hi"), layout, btn);

    root.getChildren().add(ScrollPaneBuilder.create().styleClass("contact-details-pane").hbarPolicy(ScrollBarPolicy.NEVER)
            .fitToWidth(true).content(gridPane).build());
}
项目:javafx-demos    文件:FreeTextFieldDemo.java   
@Override
public void start(Stage stage) throws Exception {
    this.stage = stage;
    configureScene();
    configureStage();
    VBox vb = VBoxBuilder.create().spacing(15).build();

    FreeTextField ff = new FreeTextField();
    vb.getChildren().add(HBoxBuilder.create().children(ff).build());
    root.getChildren().add(vb);
}
项目:javafx-MultipleScreens-framework    文件:Screen2Controller.java   
@FXML
private void openNewStageWindow(ActionEvent event) {
    Stage myDialog = new Stage();
    myDialog.initModality(Modality.APPLICATION_MODAL);
    myDialog.setWidth(300);
    myDialog.setHeight(200);
    Scene myDialogScene = new Scene(VBoxBuilder.create()
            .children(new Label(paramsFromFirstScreen))
            .alignment(Pos.CENTER).padding(new Insets(10)).build());

    myDialog.setScene(myDialogScene);
    myDialog.show();
}
项目:apc40-mode-win-linux    文件:Main.java   
private void showMessage(String message) {
    Stage dialogStage = new Stage();
    dialogStage.initModality(Modality.WINDOW_MODAL);
    dialogStage.setScene(new Scene(VBoxBuilder.create().
            children(new Text(message)).
            alignment(Pos.CENTER).padding(new Insets(5)).build()));
    dialogStage.show();
}
项目:kotlinfx-ensemble    文件:SearchBoxSample.java   
public SearchBoxSample() {
    String searchBoxCss = SearchBoxSample.class.getResource("SearchBox.css").toExternalForm();
    VBox vbox = VBoxBuilder.create().build();
    vbox.getStylesheets().add(searchBoxCss);
    vbox.setPrefWidth(200);
    vbox.setMaxWidth(Control.USE_PREF_SIZE);
    vbox.getChildren().add(new SearchBox());
    getChildren().add(vbox);
}
项目:kotlinfx-ensemble    文件:InsetTextButtonSample.java   
public InsetTextButtonSample() {

        String insetTextCss = InsetTextButtonSample.class.getResource("InsetTextButton.css").toExternalForm();
        VBox vbox = VBoxBuilder.create().id("insettextvbox").spacing(10).padding(new Insets(10)).children(
                ButtonBuilder.create().text("Inset Text Button").id("button1").build(),
                ButtonBuilder.create().text("Plain Text Button").id("button2").build()).build();

        vbox.getStylesheets().add(insetTextCss);
        getChildren().add(vbox);
    }
项目:CrocodileNote    文件:Popups.java   
public void create(String msg, ReturnListener rl, int focusid, String... buttons){
    setReturnListener(rl);

    myDialog = new Stage();
    myDialog.initModality(Modality.APPLICATION_MODAL);
    myDialog.setResizable(false);
    myDialog.setTitle(/*Base.appname*/ "Warning");
    myDialog.getIcons().add(ico);

    ImageView iv = new ImageView(warn);

    Button[] bs = createButtons(buttons);

    HBox hb = HBoxBuilder.create().children(iv, t(msg))
            .spacing(10)
            .padding(new Insets(10))
            .build();
    hb.setAlignment(Pos.TOP_LEFT);

    TilePane tileButtons = new TilePane(Orientation.HORIZONTAL);
    tileButtons.setPadding(new Insets(0, 0, 5, 0));
    tileButtons.setHgap(20);
    tileButtons.setAlignment(Pos.CENTER);
    tileButtons.getChildren().addAll(bs);
    tileButtons.setPrefColumns(bs.length);

    VBox vb = VBoxBuilder.create().children(hb, tileButtons).build();

    myDialog.setScene(new Scene(vb, Color.WHITESMOKE));
    myDialog.sizeToScene();
    myDialog.show();

    if(focusid > 0 && focusid < bs.length)
        bs[focusid].requestFocus();
}
项目:openjfx-8u-dev-tests    文件:AnimationLCDTextTestApp.java   
@Override
public void start(Stage primaryStage) {


    final TextArea testText = TextAreaBuilder.create()
            .text("Test")
            .prefHeight(50)
            .prefWidth(500)
            .build();

    final ChoiceBox<Interpolator> interpolatorChoiceBox = new ChoiceBox<Interpolator>();
    interpolatorChoiceBox.getItems().addAll(FXCollections.observableArrayList(
                Interpolator.LINEAR,
                Interpolator.DISCRETE,
                Interpolator.EASE_BOTH,
                Interpolator.EASE_IN,
                Interpolator.EASE_OUT
                ));
    interpolatorChoiceBox.setPrefHeight(25);
    interpolatorChoiceBox.setPrefWidth(500);

    interpolatorChoiceBox.getSelectionModel().selectFirst();


    final Text lcdText = TextBuilder.create()
            .x(100)
            .y(100)
            .fontSmoothingType(FontSmoothingType.LCD)
            .build();

    lcdText.textProperty().bind(testText.textProperty());

    final Circle point = CircleBuilder.create()
            .centerX(100)
            .centerY(100)
            .radius(2)
            .fill(Color.RED)
            .build();

    Pane root = VBoxBuilder.create()
            .children(
                PaneBuilder.create()
                .minWidth(500)
                .minHeight(500)
                .children(
                    lcdText,
                    point)
                .onMouseClicked(new EventHandler<MouseEvent>() {

                    @Override
                    public void handle(MouseEvent event) {
                        point.setCenterX(event.getX());
                        point.setCenterY(event.getY());

                        TimelineBuilder.create()
                            .keyFrames(
                                new KeyFrame(Duration.seconds(5),
                                    new KeyValue(lcdText.xProperty(), event.getX(),
                                        interpolatorChoiceBox.getSelectionModel().getSelectedItem())),
                                new KeyFrame(Duration.seconds(5),
                                    new KeyValue(lcdText.yProperty(), event.getY(),
                                        interpolatorChoiceBox.getSelectionModel().getSelectedItem()))
                                )
                            .build()
                            .play();
                    }
                })
                .build(),
                testText,
                interpolatorChoiceBox)
            .build();



    Scene scene = new Scene(root, 500, 575);

    primaryStage.setTitle("Test Animnation LCD Text");
    primaryStage.setResizable(false);
    primaryStage.setScene(scene);
    primaryStage.show();
}
项目:javafx-download-jdk    文件:FXBrowser.java   
@Override
public void start(Stage stage) throws Exception {
    try {
        final SimpleBrowser browser = SimpleBrowser.newBuilder()
            .useFirebug(false)
            .useJQuery(true)
            .build();

        final TextField location = new TextField(FXBrowser.class.getResource("/app/bear.html").toExternalForm());

        Button go = new Button("Go");

        EventHandler<ActionEvent> goAction = new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent arg0) {
                browser.load(location.getText(), new Runnable() {
                    @Override
                    public void run() {
                        System.out.println(browser.getEngine().executeScript("jQuery('#sso_username')[0]"));
                    }
                });
            }
        };

        go.setOnAction(goAction);

        MenuItem menuItem = new MenuItem("Go!");
        menuItem.setAccelerator(new KeyCodeCombination(KeyCode.G, KeyCombination.CONTROL_DOWN));
        menuItem.setOnAction(goAction);

        browser.getEngine().locationProperty().addListener(new ChangeListener<String>() {
            @Override
            public void changed(ObservableValue<? extends String> observableValue, String s, String newLoc) {
                System.out.println("location changed to: " + newLoc);
            }
        });

        HBox toolbar = new HBox();
        toolbar.getChildren().addAll(location, go);

        toolbar.setFillHeight(true);

        Menu menu = new Menu("File");

        menu.getItems().addAll(menuItem);

        MenuBar menuBar = new MenuBar();
        menuBar.getMenus().add(menu);

        VBox vBox = VBoxBuilder.create().children(
            menuBar,
            toolbar, browser)
            .fillWidth(true)
            .build();

        Scene scene = new Scene(vBox);

        stage.setScene(scene);
        stage.setWidth(1024);
        stage.setHeight(768);
        stage.show();

        VBox.setVgrow(browser, Priority.ALWAYS);

        browser.load(FXBrowser.class.getResource("/app/bear.html").toExternalForm());
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:javafx-demos    文件:SnapShotDemo.java   
private void clipImageAndOpenStage(Image image) {

    /*int w = (int) (cont.getWidth() * sFactor);
    int h = (int) (cont.getHeight() * sFactor);
    System.out.println("Ws : " + w + " Hs : " + h);

    PixelReader reader = image.getPixelReader();
    WritablePixelFormat<IntBuffer> format = WritablePixelFormat.getIntArgbInstance();
    //int kernalWidth = (int) (radius * 2);
    int[] buffer = new int[(int) (150 * 150)];
    reader.getPixels(0, 0, 150, 150, format, buffer, 0, 150);

    WritableImage dest = new WritableImage(150, 150);
    PixelWriter writer = dest.getPixelWriter();
    int k = 0;
    for (int x = 0; x < 150; x++) {
        for (int y = 0; y < 150; y++) {
            k++;
            System.out.println(reader.getColor(x, y));
            //writer.setColor(x, y, reader.getColor(x, y));
        }
    }*/

    //System.out.println("Tota : " + k);

    ImageView imageView = new ImageView(image);
    VBox pane = VBoxBuilder.create().spacing(15).build();
    pane.setStyle("-fx-border-color:red;-fx-border-width:1px;");
    ClippedNode clipped = new ClippedNode(imageView, 100, 100);
    pane.getChildren().add(clipped);

    Slider s1 = new Slider(0, 500, 100);
    clipped.transXProperty().bind(s1.valueProperty());
    pane.getChildren().add(s1);

    Slider s2 = new Slider(0, 500, 100);
    clipped.transYProperty().bind(s2.valueProperty());
    pane.getChildren().add(s2);

    StackPane sp = new StackPane();
    sp.setStyle("-fx-border-color:green;-fx-border-width:1px;");
    sp.getChildren().add(pane);
    Stage stg = new Stage();
    stg.setWidth(440);
    stg.setHeight(470);
    stg.setScene(new Scene(sp));
    stg.show();
    //ScenicView.show(sp);


}
项目:javafx-demos    文件:ScrollFreeTextAreaDemo.java   
@Override
public void start(Stage stage) throws Exception {
    this.stage = stage;
    configureScene();
    configureStage();
    VBox vb = VBoxBuilder.create().spacing(15).build();

    ScrollFreeTextArea ta = new ScrollFreeTextArea();

    TextArea textArea =new TextArea(){
        protected void layoutChildren() {
            super.layoutChildren();
            if(content==null){
                content = (Region)lookup(".content");
                contentHeight.bind(content.heightProperty());
                content.heightProperty().addListener(new ChangeListener<Number>() {
                    @Override
                    public void changed(ObservableValue<? extends Number> paramObservableValue, Number paramT1, Number paramT2) {
                        System.out.println("Content View Height :"+paramT2.doubleValue());
                        System.out.println("Height :"+getHeight());
                        //setPrefHeight(paramT2.doubleValue()+4);
                    }
                });
            }

            if(group ==null){
                Text text = (Text)lookup(".text");
                group = (Group) text.getParent();
                group.layoutBoundsProperty().addListener(new ChangeListener<Bounds>() {
                    @Override
                    public void changed(ObservableValue<? extends Bounds> arg0, Bounds arg1, Bounds arg2) {
                        System.out.println("Bounds changed....."+arg2.getHeight());
                        setPrefHeight(arg2.getHeight()+11);
                    }
                });
            }
        };
    };
    textArea.setWrapText(true);
    DynamicTextArea dd = new DynamicTextArea();
    dd.setMaxRows(5);
    vb.getChildren().addAll(dd);
    root.getChildren().add(vb);

    //ScenicView.show(scene);
}
项目:Pruebas    文件:JavaFX_SaveText.java   
@Override
public void start(final Stage primaryStage) {
    primaryStage.setTitle("java-buddy.blogspot.com");
    Group root = new Group();

    final String Santa_Claus_Is_Coming_To_Town =
            "You better watch out\n"
            + "You better not cry\n"
            + "Better not pout\n"
            + "I'm telling you why\n"
            + "Santa Claus is coming to town\n"
            + "\n"
            + "He's making a list\n"
            + "And checking it twice;\n"
            + "Gonna find out Who's naughty and nice\n"
            + "Santa Claus is coming to town\n"
            + "\n"
            + "He sees you when you're sleeping\n"
            + "He knows when you're awake\n"
            + "He knows if you've been bad or good\n"
            + "So be good for goodness sake!\n"
            + "\n"
            + "O! You better watch out!\n"
            + "You better not cry\n"
            + "Better not pout\n"
            + "I'm telling you why\n"
            + "Santa Claus is coming to town\n"
            + "Santa Claus is coming to town\n";

    Text textSong = TextBuilder.create()
            .text(Santa_Claus_Is_Coming_To_Town)
            .build();               

    Button buttonSave = ButtonBuilder.create()
            .text("Save")
            .build();

    buttonSave.setOnAction(new EventHandler<ActionEvent>() {

      @Override
      public void handle(ActionEvent event) {
          FileChooser fileChooser = new FileChooser();

          //Set extension filter
          FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("TXT files (*.txt)", "*.txt");
          fileChooser.getExtensionFilters().add(extFilter);

          //Show save file dialog
          File file = fileChooser.showSaveDialog(primaryStage);

          if(file != null){
              SaveFile(Santa_Claus_Is_Coming_To_Town, file);
          }
      }
  });

    VBox vBox = VBoxBuilder.create()
            .children(textSong, buttonSave)
            .build();

    root.getChildren().add(vBox);

    primaryStage.setScene(new Scene(root, 500, 400));
    primaryStage.show();

}
项目:Pruebas    文件:JavaFX_OpenFile.java   
@Override
public void start(final Stage primaryStage) {
    primaryStage.setTitle("java-buddy.blogspot.com");
    Group root = new Group();



    final TextArea textArea = TextAreaBuilder.create()
            .prefWidth(400)
            .wrapText(true)
            .build();

    ScrollPane scrollPane = new ScrollPane();
    scrollPane.getStyleClass().add("noborder-scroll-pane");
    scrollPane.setContent(textArea);
    scrollPane.setFitToWidth(true);
    scrollPane.setPrefWidth(400);
    scrollPane.setPrefHeight(180);

    Button buttonLoad = new Button("Load");
    buttonLoad.setOnAction(new EventHandler<ActionEvent>(){

        @Override
        public void handle(ActionEvent arg0) {
            FileChooser fileChooser = new FileChooser();

            //Set extension filter
            FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("TXT files (*.txt)", "*.txt");
            fileChooser.getExtensionFilters().add(extFilter);

            //Show save file dialog
            File file = fileChooser.showOpenDialog(primaryStage);
            if(file != null){
                textArea.setText(readFile(file));
            }
        }

    });

    VBox vBox = VBoxBuilder.create()
            .children(buttonLoad, scrollPane)
            .build();

    root.getChildren().add(vBox);
    primaryStage.setScene(new Scene(root, 500, 400));
    primaryStage.show();
}
项目:simplejavayoutubeuploader    文件:AccountListCellRenderer.java   
@Override
protected void updateItem(final Account item, final boolean empty) {
    super.updateItem(item, empty);
    if (null == item) {
        return;
    }

    //Load data from database and construct checkboxes
    final ArrayList<CheckBox> children = new ArrayList<>(item.getPlaylists().size());
    for (final Playlist playlist : item.getPlaylists()) {
        children.add(CheckBoxBuilder.create()
                .text(playlist.getTitle())
                .selected(playlist.isHidden())
                .styleClass("accountCellCheckbox")
                .onAction(new AccountCellCheckboxHandler(playlist))
                .build());
    }

    //Create our main view elements
    final TextField nameTextField = TextFieldBuilder.create().text(item.getName()).prefWidth(300).build();
    final Button removeAccountButton = ButtonBuilder.create()
            .text(resources.getString("button.remove"))
            .styleClass("accountCellRemoveButton")
            .onAction(new AccountCellRemoveButtonHandler(item))
            .build();
    final Label playlistLabel = LabelBuilder.create()
            .text(resources.getString("label.hiddenplaylists"))
            .styleClass("accountCellHiddenPlaylistsLabel")
            .build();
    final VBox playlistContainer = VBoxBuilder.create()
            .children(children)
            .styleClass("accountCellHiddenPlaylistsContainer")
            .build();
    final Pane container = PaneBuilder.create()
            .children(nameTextField, removeAccountButton, playlistLabel, playlistContainer)
            .styleClass("accountCellContainer")
            .build();

    nameTextField.focusedProperty().addListener(new ChangeListener<Boolean>() {
        @Override
        public void changed(final ObservableValue<? extends Boolean> observableValue, final Boolean oldFocusState, final Boolean newFocusState) {
            if (null != newFocusState && !newFocusState && !item.getName().equals(nameTextField.getText())) {
                item.setName(nameTextField.getText());
                accountService.update(item);
            }
        }
    });

    //Position our elements
    removeAccountButton.layoutXProperty()
            .bind(nameTextField.layoutXProperty().add(nameTextField.widthProperty()).add(10));
    playlistLabel.layoutXProperty()
            .bind(removeAccountButton.layoutXProperty().add(removeAccountButton.widthProperty()).add(10));
    playlistContainer.layoutXProperty()
            .bind(playlistLabel.layoutXProperty().add(playlistLabel.widthProperty()).add(10));
    setGraphic(container);
}
项目:marathonv5    文件:StyledToolBarSample.java   
public StyledToolBarSample() {
    ToolBar standardToolbar = createToolBar("standard");

    String styledToolBarCss = StyledToolBarSample.class.getResource("StyledToolBar.css").toExternalForm();

    ToolBar darkToolbar = createToolBar("dark");        
    darkToolbar.getStylesheets().add(styledToolBarCss);

    ToolBar blueToolbar = createToolBar("blue");
    blueToolbar.getStylesheets().add(styledToolBarCss);

    getChildren().add(VBoxBuilder.create().spacing(10).padding(new Insets(10)).children(standardToolbar, darkToolbar, blueToolbar).build());
}
项目:marathonv5    文件:StyledToolBarSample.java   
public StyledToolBarSample() {
    ToolBar standardToolbar = createToolBar("standard");

    String styledToolBarCss = StyledToolBarSample.class.getResource("StyledToolBar.css").toExternalForm();

    ToolBar darkToolbar = createToolBar("dark");        
    darkToolbar.getStylesheets().add(styledToolBarCss);

    ToolBar blueToolbar = createToolBar("blue");
    blueToolbar.getStylesheets().add(styledToolBarCss);

    getChildren().add(VBoxBuilder.create().spacing(10).padding(new Insets(10)).children(standardToolbar, darkToolbar, blueToolbar).build());
}
项目:kotlinfx-ensemble    文件:StyledToolBarSample.java   
public StyledToolBarSample() {
    ToolBar standardToolbar = createToolBar("standard");

    String styledToolBarCss = StyledToolBarSample.class.getResource("StyledToolBar.css").toExternalForm();

    ToolBar darkToolbar = createToolBar("dark");        
    darkToolbar.getStylesheets().add(styledToolBarCss);

    ToolBar blueToolbar = createToolBar("blue");
    blueToolbar.getStylesheets().add(styledToolBarCss);

    getChildren().add(VBoxBuilder.create().spacing(10).padding(new Insets(10)).children(standardToolbar, darkToolbar, blueToolbar).build());
}
项目:org.openwms.dbrowser.fx    文件:CustomerDataScreen.java   
/**
 * Create a new CustomerDataScreen.
 * 
 * @param controller
 */
public CustomerDataScreen(CustomerDataScreenController controller) {
    this.controller = controller;
    getChildren().add(VBoxBuilder.create().children(createHeader(), createToolbar(), createDataTable()).build());
}