当前位置: 首页>>代码示例>>Java>>正文


Java ScrollPane.setFitToWidth方法代码示例

本文整理汇总了Java中javafx.scene.control.ScrollPane.setFitToWidth方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollPane.setFitToWidth方法的具体用法?Java ScrollPane.setFitToWidth怎么用?Java ScrollPane.setFitToWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.ScrollPane的用法示例。


在下文中一共展示了ScrollPane.setFitToWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTextArea

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
private Node createTextArea(boolean selectable, boolean editable) {
    textArea = new TextArea();
    textArea.setPrefRowCount(4);
    textArea.setEditable(editable);
    textArea.textProperty().addListener((observable, oldValue, newValue) -> {
        text = textArea.getText();
    });
    textArea.setText(text);
    ScrollPane scrollPane = new ScrollPane(textArea);
    scrollPane.setFitToWidth(true);
    scrollPane.setFitToHeight(true);
    scrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
    scrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
    HBox.setHgrow(scrollPane, Priority.ALWAYS);
    return scrollPane;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:17,代码来源:CheckList.java

示例2: FlowCardComposite

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
/**
 * @param nodeConverter
 */
public FlowCardComposite() {

	scrollPane = new ScrollPane();
	scrollPane.setFitToHeight(true);
	scrollPane.setFitToWidth(true);
	scrollPane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
	StackPane stackPane = new StackPane(scrollPane);
	stackPane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
	masonryPane = new JFXMasonryPane();

	scrollPane.setContent(masonryPane);

	setCenter(stackPane);

	initialize();

	masonryPane.setCache(false);
	setStyle("-fx-background-color : #292929");
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:23,代码来源:FlowCardComposite.java

示例3: homeProducts

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
public static BorderPane homeProducts(){

        VBox products = new VBox(20);
        products.getChildren().addAll(
                fetchProducts.productbyType("Discounts for You"),
                fetchProducts.productbyType("Featured Product"),
                fetchProducts.productbyType("New Arrival"),
                fetchProducts.productbyType("Trending"));

        ScrollPane proScroller = new ScrollPane(products);
        proScroller.setPrefHeight(400);
        proScroller.setFitToWidth(true);

        BorderPane home = new BorderPane(proScroller);
        return home;

    }
 
开发者ID:madHEYsia,项目名称:ClassroomFlipkart,代码行数:18,代码来源:homeProducts.java

示例4: HistoryListPopup

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
public HistoryListPopup(@Nullable String popupTitle, @NotNull HistoryListProvider provider) {
	super(ArmaDialogCreator.getPrimaryStage(), new VBox(5), popupTitle);
	this.provider = provider;

	myRootElement.setPadding(new Insets(10));
	final ScrollPane scrollPane = new ScrollPane(stackPaneWrapper);
	VBox.setVgrow(scrollPane, Priority.ALWAYS);
	scrollPane.setFitToHeight(true);
	scrollPane.setFitToWidth(true);
	scrollPane.setStyle("-fx-background-color:transparent");

	myRootElement.getChildren().addAll(scrollPane, new Separator(Orientation.HORIZONTAL), getBoundResponseFooter(false, true, false));

	gridPaneContent.setVgap(15);
	gridPaneContent.setHgap(5);
	ColumnConstraints constraints = new ColumnConstraints(-1, -1, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true);
	gridPaneContent.getColumnConstraints().addAll(constraints, constraints);

	myStage.setMinWidth(320);
	myStage.setMinHeight(320);
	myStage.setWidth(480);

	stackPaneWrapper.setPrefHeight(320);

	fillContent();
}
 
开发者ID:kayler-renslow,项目名称:arma-dialog-creator,代码行数:27,代码来源:HistoryListPopup.java

示例5: getScene

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Override
protected Scene getScene() {
    application = this;
    sp = new ScrollPane(buildContent());
    sp.setFitToWidth(true);
    sp.setBackground(Background.EMPTY);
    Scene scene = new Scene(sp, WIDTH, HEIGHT);
    Utils.addBrowser(scene);
    scene.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent t) {
            switch (t.getText().charAt(0)) {
                case '1':
                    scrollToMark(0);
                    break;
                case '2':
                    scrollToMark(1);
                    break;
                case '3':
                    scrollToMark(2);
                    break;
            };
        }
    });
    return scene;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:26,代码来源:RichTextRealWorldExampleApp.java

示例6: buildSelectedSectionBody

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
public ScrollPane buildSelectedSectionBody() {
    VBox itemBox = new VBox();

    for (int i = 0; i < items.size(); i++) {
        SettingsItem item = items.get(i);

        BorderPane itemPane = item.build();

        if (i % 2 != 0) {
            itemPane.getStyleClass()
                    .add("alternatedColor");
        } else {
            itemPane.getStyleClass()
                    .remove("alternatedColor");
        }

        itemBox.getChildren()
                .add(itemPane);
    }

    ScrollPane scrollPane = new ScrollPane(itemBox);
    scrollPane.setFitToWidth(true);
    return scrollPane;
}
 
开发者ID:Wingman,项目名称:wingman,代码行数:25,代码来源:SettingsSection.java

示例7: MemristorParametersUI

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
public MemristorParametersUI(MemristorLibrary.Memristor_Model memristorType) {
    dm = new DialogsManager();
    savedFileCount = 0;
    this.memristorType = memristorType;
    memristor = MemristorLibrary.GetNewMemristor(memristorType);
    selectedPreset = 0;
    simulationType = ResourcesMAF.MONTECARLO_SIMULATION;
    // Main GridPane
    GridPane gridPane = new GridPane();
    gridPane.setPadding(new Insets(15, 15, 15, 15));
    gridPane.setHgap(5);
    gridPane.setVgap(5);
    gridPane.setAlignment(Pos.CENTER);
    // Create UI
    RecreateParameterAndVariationsUI(gridPane, memristorType.index());
    // Set content in scroll pane
    ScrollPane sp = new ScrollPane();
    sp.setContent(gridPane);
    sp.setFitToHeight(true);
    sp.setFitToWidth(true);
    this.getChildren().add(sp);

}
 
开发者ID:fgr1986,项目名称:maf,代码行数:24,代码来源:MemristorParametersUI.java

示例8: init

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setScene(new Scene(root));
    VBox vRoot = new VBox();

    vRoot.setPadding(new Insets(8, 8, 8, 8));
    vRoot.setSpacing(5);

    htmlEditor = new HTMLEditor();
    htmlEditor.setPrefSize(500, 245);
    htmlEditor.setHtmlText(INITIAL_TEXT);
    vRoot.getChildren().add(htmlEditor);

    final Label htmlLabel = new Label();
    htmlLabel.setMaxWidth(500);
    htmlLabel.setWrapText(true);

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

    Button showHTMLButton = new Button("Show the HTML below");
    vRoot.setAlignment(Pos.CENTER);
    showHTMLButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent arg0) {
            htmlLabel.setText(htmlEditor.getHtmlText());
        }
    });

    vRoot.getChildren().addAll(showHTMLButton, scrollPane);
    root.getChildren().addAll(vRoot);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:HTMLEditorApp.java

示例9: start

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
    if (primaryStage == null) {
        return;
    }

    /* Layers */
    Group backgroundLayer = new Group();
    Group statesLayer = new Group();
    Group selectionLayer = new Group();

    Pane paintingPane = new Pane(backgroundLayer, statesLayer, selectionLayer);
    paintingPane.setStyle(BACKGROUND_STYLE);

    /* Top-level */
    Pane contentPane = new Pane(paintingPane);
    contentPane.minWidthProperty().bind(contentPane.prefWidthProperty());
    contentPane.maxWidthProperty().bind(contentPane.prefWidthProperty());

    ScrollPane scrollPane = new ScrollPane(contentPane);
    scrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
    scrollPane.setHbarPolicy(ScrollBarPolicy.ALWAYS);
    scrollPane.setFitToHeight(true);
    scrollPane.setFitToWidth(true);
    scrollPane.setPannable(true);

    BorderPane borderPane = new BorderPane(scrollPane);

    primaryStage.setScene(new Scene(borderPane));
    primaryStage.show();
    primaryStage.setHeight(500);
    primaryStage.setWidth(500);

    contentPane.setPrefHeight(200);
    contentPane.setPrefWidth(PANE_WIDTH);

    /* Bind painting pane's height to the content pane */
    paintingPane.minHeightProperty().bind(contentPane.minHeightProperty());
    paintingPane.prefHeightProperty().bind(contentPane.prefHeightProperty());
    paintingPane.maxHeightProperty().bind(contentPane.maxHeightProperty());

    /* We set painting's pane width programmatically */
    paintingPane.minWidthProperty().bind(paintingPane.prefWidthProperty());
    paintingPane.maxWidthProperty().bind(paintingPane.prefWidthProperty());

    paintingPane.setPrefWidth(2000);
    double x = PANE_WIDTH - 2000;
    System.out.println(x);
    paintingPane.relocate(x, 0);

    drawBackground(backgroundLayer, paintingPane);
    drawRectangles(statesLayer);
    drawSelection(selectionLayer, paintingPane);
}
 
开发者ID:lttng,项目名称:lttng-scope,代码行数:55,代码来源:UiModelApp2.java

示例10: start

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
    if (primaryStage == null) {
        return;
    }

    /* Layers */
    Group backgroundLayer = new Group();
    Group statesLayer = new Group();
    Group selectionLayer = new Group();

    /* Top-level */
    Pane contentPane = new Pane(backgroundLayer, statesLayer, selectionLayer);
    contentPane.minWidthProperty().bind(contentPane.prefWidthProperty());
    contentPane.maxWidthProperty().bind(contentPane.prefWidthProperty());
    contentPane.setStyle(BACKGROUND_STYLE);

    ScrollPane scrollPane = new ScrollPane(contentPane);
    scrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
    scrollPane.setHbarPolicy(ScrollBarPolicy.ALWAYS);
    scrollPane.setFitToHeight(true);
    scrollPane.setFitToWidth(true);
    scrollPane.setPannable(true);

    BorderPane borderPane = new BorderPane(scrollPane);

    primaryStage.setScene(new Scene(borderPane));
    primaryStage.show();
    primaryStage.setHeight(500);
    primaryStage.setWidth(500);

    contentPane.setPrefHeight(200);
    contentPane.setPrefWidth(PANE_WIDTH);

    drawBackground(backgroundLayer, contentPane);
    drawRectangles(statesLayer);
    drawSelection(selectionLayer, contentPane);
}
 
开发者ID:lttng,项目名称:lttng-scope,代码行数:39,代码来源:UiModelApp.java

示例11: QuickViewPanel

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
public QuickViewPanel(String isaName, List<QuickViewSection> sections)
{
	VBox vbox = new VBox();
	
	for (QuickViewSection section : sections)
	{
		Node sectionView = createSectionView(section);
		vbox.getChildren().add(sectionView);
	}
	
	ScrollPane center = new ScrollPane(vbox);
	center.setFitToWidth(true);
	center.setHbarPolicy(ScrollBarPolicy.NEVER);
	this.setCenter(center);
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:16,代码来源:QuickViewPanel.java

示例12: licencesp

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
private ScrollPane licencesp(double width, double height) {

        ScrollPane sp = new ScrollPane();

        Text text = new Text();

        text.setX(width * 0.1);
        text.setY(height * 0.1);
        text.setFont(new Font(20));

        text.setFill(new Color(1, 1, 1, 1));

        StringBuilder licence = new StringBuilder(10000);
        String line;

        try {
            BufferedReader br = new BufferedReader(new FileReader("data/common/licence.txt"));

            while ((line = br.readLine()) != null) {
                licence.append('\n');
                licence.append(line);
            }
            br.close();
        } catch (IOException e) {
            log.error("Exception", e);
        }

        text.setText(licence.toString());

        sp.setContent(text);
        sp.setFitToHeight(true);
        sp.setFitToWidth(true);
        sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
        sp.setVmax(height);
        // sp.setPrefSize(width*0.8, height*0.8);

        return sp;

    }
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:40,代码来源:License.java

示例13: productbyType

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
public static BorderPane productbyType(String type) {

        BorderPane products = new BorderPane();
        products.setPadding(new Insets(10,20,10,20));

        Connection con = null;
        PreparedStatement stmt = null;
        ResultSet rs = null;

        String query = DBUtils.prepareSelectQuery(" * ",
                " classroomflipkart.productdetail AS T ," +
                        " ( "+ DBUtils.prepareSelectQuery("productId",
                                " classroomflipkart.homeproducts ",
                                "type = '"+type+"'")+
                        " ) AS S",
                " T.productId = S.productId ");

        try {
            con = DBUtils.getConnection();
            stmt = con.prepareStatement(query);
            rs = stmt.executeQuery();

            rs.last();
            int size = rs.getRow();

            if (size>0){
                rs.beforeFirst();

                Label title = new Label(type+"");
                title.setFont(Font.font("Open Sans", FontWeight.BOLD,17));
                title.setPadding(new Insets(10));
                title.setAlignment(Pos.CENTER);

                HBox productList = new HBox(20);
                productList.setAlignment(Pos.CENTER);

                while (rs.next()) {
                    String productId = rs.getString("productId");
                    String productName = rs.getString("productName");
                    String newPrice = rs.getString("newPrice");
                    String oldPrice = rs.getString("oldPrice");
                    String category = rs.getString("category");
                    String subcategory = rs.getString("subcategory");
                    String imageName = rs.getString("imageName");
                    String productAvailability = rs.getString("productAvailability");

                    productList.getChildren().add(productDetail.productByType(productId,productName,newPrice,oldPrice,category,subcategory,imageName, productAvailability));
                }

                ScrollPane proScroller = new ScrollPane(productList);
                proScroller.setFitToHeight(true);
                proScroller.setFitToWidth(true);
                proScroller.setPannable(true);
                proScroller.setPadding(new Insets(0,0,30,0));

                StackPane titlePane = new StackPane(title);
                titlePane.setAlignment(Pos.CENTER);

                StackPane productPane = new StackPane(proScroller);
                productPane.setAlignment(Pos.CENTER);

                products.setTop(titlePane);
                products.setCenter(productPane);
            }


        } catch (Exception e) {
            products.setCenter(new Label(e.getMessage()));
            e.printStackTrace();
        } finally {
            DBUtils.closeAll(rs, stmt, con);
            return products;
        }
    }
 
开发者ID:madHEYsia,项目名称:ClassroomFlipkart,代码行数:75,代码来源:fetchProducts.java

示例14: initBoxes

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
private void initBoxes(Pane root, Scene scene) {
    VBox vBox = Nodes.TEXT_VBOX;
    HBox hBox = Nodes.TEXTBAR_HBOX;
    ScrollPane scrollPane = Nodes.SCROLL_PANE;

    vBox.setTranslateY(10);
    vBox.setTranslateX(10);
    vBox.prefWidthProperty().bind(scene.widthProperty().subtract(10));
    vBox.prefHeightProperty().bind(scene.heightProperty().subtract(20).subtract(preferences.getDouble("textbar-height")));
    vBox.setSpacing((preferences.getDouble("messages-spacing-level") - 1)*10-5);


    hBox.setPrefWidth(scene.getWidth());
    hBox.setPrefHeight(preferences.getDouble("textbar-height"));
    hBox.setTranslateY(scene.getHeight() - hBox.getPrefHeight());
    hBox.setSpacing(20);

    root.widthProperty().addListener(o -> hBox.setPrefWidth(root.getWidth()));
    root.heightProperty().addListener(o -> hBox.setTranslateY(scene.getHeight() - Nodes.TEXTBAR_HBOX.getPrefHeight()));

    scrollPane.setContent(vBox);
    scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    scrollPane.setTranslateX(vBox.getTranslateX());
    scrollPane.setTranslateY(vBox.getTranslateY());
    scrollPane.maxWidthProperty().bind(vBox.prefWidthProperty());
    scrollPane.prefWidthProperty().bind(vBox.prefWidthProperty());
    scrollPane.prefHeightProperty().bind(vBox.prefHeightProperty());
    scrollPane.setFitToWidth(true);
    scrollPane.setFitToHeight(true);
}
 
开发者ID:iAmGio,项目名称:jrfl,代码行数:32,代码来源:Jrfl.java

示例15: wrapForScroll

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
protected ScrollPane wrapForScroll(Pane rootGrid) {
	ScrollPane scrollPane = new ScrollPane(rootGrid);
	scrollPane.setPadding(new Insets(0));
	scrollPane.setFitToWidth(true);
	scrollPane.setFitToHeight(true);
	return scrollPane;
}
 
开发者ID:CedricReichenbach,项目名称:audiomerge,代码行数:8,代码来源:Page.java


注:本文中的javafx.scene.control.ScrollPane.setFitToWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。