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


Java ScrollPane.setContent方法代码示例

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


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

示例1: listCreatureContents

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
private void listCreatureContents(Player current, ScrollPane scroll) {
    HBox content = new HBox();
    scroll.setContent(content);
    content.setSpacing(20);
    for (Card c : current.getPlayerCreature()) {
        Rectangle rectangle = new Rectangle(100, 120);
        Image img = new Image("images/Spellmonger_" + c.getName() + ".png");
        rectangle.setFill(new ImagePattern(img));
        rectangle.setLayoutY(10);
        rectangle.getStyleClass().add("cartes_ombre");
        content.getChildren().add(rectangle);
        if (!player1.isDead() && !player2.isDead()) {
            Rectangle newRectangle = new Rectangle(250, 300);
            eventEnter(rectangle, newRectangle, img);
            eventExit(rectangle, newRectangle);
        }
    }
}
 
开发者ID:PBZ-InsightR,项目名称:Spellmonger3,代码行数:19,代码来源:ControllerPlay.java

示例2: hands

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
private void hands(Player current, Player oppenent, ScrollPane hand) {
    HBox content = new HBox();
    hand.setContent(content);
    content.setSpacing(20);
    int index = 0;
    for (Card c : current.getHand()) {
        Rectangle rectangle = new Rectangle(100, 120);
        String imageOfCard = "Spellmonger_" + c.getName();
        if (turnPlayer.equals(oppenent)) imageOfCard = "dosCartes_ocre";
        if (isIA && current == player2) imageOfCard = "dosCartes_ocre";
        Image img = new Image("images/" + imageOfCard + ".png");
        rectangle.setFill(new ImagePattern(img));
        rectangle.setLayoutY(10);
        rectangle.getStyleClass().add("cartes_ombre");
        content.getChildren().add(rectangle);
        if (turnPlayer.equals(current) && !player1.isDead() && !player2.isDead()) {
            Rectangle newRectangle = new Rectangle(250, 300);
            eventEnter(rectangle, newRectangle, img);
            eventExit(rectangle, newRectangle);
            eventClick(rectangle, current, oppenent, index);
        }
        index++;
    }
}
 
开发者ID:PBZ-InsightR,项目名称:Spellmonger3,代码行数:25,代码来源:ControllerPlay.java

示例3: getScene

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Override
protected Scene getScene() {
    scene = new Scene(root, 320, 200, Color.WHITE);

    VBox vb = new VBox();

    vb.setPrefSize(250, 150);

    TextArea textArea = new TextArea();
    ScrollPane scrollPane = new ScrollPane();

    for (int i = 0; i < 100; ++i) {
        textArea.setText(textArea.getText() +
                "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\n");
    }

    root.getChildren().add(vb);
    vb.getChildren().add(textArea);
    vb.getChildren().add(scrollPane);
    scrollPane.setContent(new Rectangle(1000,1000,Color.RED));

    //Utils.addBrowser(scene);
    return scene;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:25,代码来源:TouchScrollPaneAndTextApp.java

示例4: addPropertiesTable

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
public void addPropertiesTable(String domainName, Node content) {
    try {
        final Tab newTab = new Tab(domainName);
        final ScrollPane sp = new ScrollPane();

        sp.setPannable(true);

        sp.setContent(content);
        sp.setPrefSize(content.getBoundsInLocal().getWidth(), content.getBoundsInLocal().getHeight());
        sp.setMaxSize(1000, 1000);
        content.boundsInLocalProperty().addListener(new ChangeListener<Bounds>() {
            public void changed(ObservableValue<? extends Bounds> ov, Bounds t, Bounds t1) {
                sp.setPrefSize(t1.getWidth(), t1.getHeight());
            }
        });

        content.setId(domainName.toUpperCase() + PropertiesTable.PROPERTIES_TABLE_SUFFIX_ID);

        newTab.setContent(sp);
        sp.setId(domainName + TAB_CONTENT_ID);
        this.getTabs().add(newTab);
    } catch (Throwable ex) {
        log(ex);
    }
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:26,代码来源:TabPaneWithControl.java

示例5: MonthBarChart

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
public MonthBarChart(ArrayList<MonthInOutSum> monthInOutSums, String currency)
{
	if(monthInOutSums == null)
	{
		this.monthInOutSums = new ArrayList<>();
	}
	else
	{
		this.monthInOutSums = monthInOutSums;
	}
	this.currency = currency;	
	
	ScrollPane scrollPane = new ScrollPane();
       scrollPane.setVbarPolicy(ScrollBarPolicy.NEVER);
       scrollPane.setFocusTraversable(false);
       scrollPane.setStyle("-fx-background-color: transparent; -fx-background-insets: 0; -fx-border-color: transparent; -fx-border-width: 0; -fx-border-insets: 0;");
       scrollPane.setPadding(new Insets(0, 0, 10, 0));
      
       HBox generatedChart = generate();              
       scrollPane.setContent(generatedChart);
       generatedChart.prefHeightProperty().bind(scrollPane.heightProperty().subtract(30));
       this.getChildren().add(scrollPane);
       VBox.setVgrow(scrollPane, Priority.ALWAYS);
       
       this.getChildren().add(generateLegend());
}
 
开发者ID:deadlocker8,项目名称:BudgetMaster,代码行数:27,代码来源:MonthBarChart.java

示例6: buildUI

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
private void buildUI() {
    contentWrapper = new ScrollPane();
    contentWrapper.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);

    getChildren().add(contentWrapper);

    setTopAnchor(contentWrapper, 0d);
    setLeftAnchor(contentWrapper, 0d);
    setBottomAnchor(contentWrapper, 0d);
    setRightAnchor(contentWrapper, 0d);

    logsContent = new VBox();
    logsContent.heightProperty().addListener(new ChangeListener() {
        @Override
        public void changed(ObservableValue observable, Object oldValue, Object newValue) {
            contentWrapper.setVvalue((Double) newValue);
        }
    });

    logsContent.setSpacing(5);

    contentWrapper.setContent(logsContent);
}
 
开发者ID:exalt-tech,项目名称:trex-stateless-gui,代码行数:24,代码来源:LogsView.java

示例7: 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

示例8: _resize

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
void _resize( final double width, final double height ) {
    if( !(container.getScene().getRoot() instanceof ScrollPane) ) {
        ScrollPane scroll = new ScrollPane();
        scroll.setContent( browser );
        container.getScene().setRoot( scroll );
    }
    browser.setMaxWidth( width );
    browser.setMaxHeight( height );
    browser.setMinWidth( width );
    browser.setMinHeight( height );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:WebBrowserImpl.java

示例9: 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

示例10: 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

示例11: getTestNod

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
Node getTestNod() {
	/* [시작] 분석하고자하는 UI구조 */
	BorderPane borderPane = new BorderPane();
	ScrollPane scrollPane2 = new ScrollPane();
	scrollPane2.setContent(new TextArea());
	borderPane.setTop(new HBox(new Button(), new Button(), new HTMLEditor()));
	borderPane.setCenter(new BorderPane(scrollPane2));
	/* [끝] 분석하고자하는 UI구조 */
	return borderPane;
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:11,代码来源:FxControlsTreeViewExam.java

示例12: GoogleLoginDialog

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
public GoogleLoginDialog(LoginDialog parent) {
       super();
	this.setTitle(Configuration.getBundle().getString("ui.dialog.auth.google.title"));

       final WebView browser = new WebView();
       final WebEngine webEngine = browser.getEngine();

       ScrollPane scrollPane = new ScrollPane();
       scrollPane.setContent(browser);
       CookieManager manager = new CookieManager();
       CookieHandler.setDefault(manager);
       webEngine.setJavaScriptEnabled(false);

       this.getDialogPane().setContent(scrollPane);
       this.getDialogPane().getButtonTypes().addAll(ButtonType.CANCEL);

       webEngine.getLoadWorker().stateProperty().addListener((ov, oldState, newState) -> {
           if(newState == State.RUNNING) {
               if(webEngine.getLocation().contains("accounts.google.com/ServiceLoginAuth")) {
                   scrollPane.setVisible(false);
               }
           }
           if(newState == State.SUCCEEDED) {
               if("https://zestedesavoir.com/".equals(webEngine.getLocation())) {
                   Element elementary = webEngine.getDocument().getDocumentElement();
                   Element logbox = getLogBox(elementary);
                   String pseudo = getPseudo(logbox);
                   String id = getId(logbox);
                   MainApp.getZdsutils().authToGoogle(manager.getCookieStore().getCookies(), pseudo, id);
                   getThis().close();
                   parent.close();
               } else {
                   if(webEngine.getLocation().contains("accounts.google.com/ServiceLoginAuth")) {
                       scrollPane.setVisible(true);
                   }
               }
           }
       });
       webEngine.load("https://zestedesavoir.com/login/google-oauth2/");
}
 
开发者ID:firm1,项目名称:zest-writer,代码行数:41,代码来源:GoogleLoginDialog.java

示例13: createUIList

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
/**
 * Function to create UI element that will hold a list of songs in it based on the collection passed in.
 *
 * @param listOfSongs   The list of songs to displays.
 * @param rowCreation   The row creation action.
 * @param style         The styling to style the list.
 * @return              A scrollable UI element that contains all the songs in the collection.
 */
public static ScrollPane createUIList(Collection<Song> listOfSongs, ILabelAction rowCreation, String style) {
    ScrollPane wrapper = new ScrollPane();

    wrapper.setStyle(style);
    wrapper.setFitToHeight(true);
    wrapper.setFitToWidth(true);

    VBox allSongs = new VBox();
    allSongs.setStyle(style);
    allSongs.setSpacing(VERTICAL_SPACING);

    int songNumber = 1;
    for (Song song : listOfSongs) {
        HBox row = rowCreation.createRow(song, songNumber);
        String baseStyle = row.getStyle();

        row.setOnMouseEntered(event -> row.setStyle("-fx-background-color: lightgray"));
        row.setOnMouseExited(event -> row.setStyle(baseStyle));

        HBox.setHgrow(row, Priority.ALWAYS);
        row.setFillHeight(true);
        row.setMaxWidth(Double.MAX_VALUE);
        row.setSpacing(HORIZONTAL_ELEMENT_SPACING);
        allSongs.getChildren().add(row);

        songNumber++;
    }
    allSongs.setPrefHeight(PREF_HEIGHT);
    allSongs.setMaxHeight(MAX_HEIGHT);
    allSongs.setFillWidth(true);

    wrapper.setContent(allSongs);
    return wrapper;
}
 
开发者ID:ijh165,项目名称:Gamma-Music-Manager,代码行数:43,代码来源:UserInterfaceUtils.java

示例14: Options

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

	folders = new TreeView<>();
	GridPane.setVgrow(folders, Priority.ALWAYS);
	GridPane.setHgrow(folders, Priority.NEVER);
	folders.getStyleClass().add("tree");
	folders.setCursor(Cursor.DEFAULT);
	folders.minWidth(400);
	pane.setLeft(folders);

	values = new VBox(5);
	values.setCursor(Cursor.DEFAULT);
	values.getStyleClass().add("options");
	values.setPadding(new Insets(5, 10, 15, 10));
	values.setMinWidth(400);

	ScrollPane scroll = new ScrollPane();
	scroll.setContent(values);
	scroll.setFitToWidth(true);

	GridPane.setVgrow(scroll, Priority.ALWAYS);
	GridPane.setHgrow(scroll, Priority.SOMETIMES);
	GridPane.setFillWidth(scroll, true);
	pane.setCenter(scroll);

	getContentPane().getChildren().add(pane);
}
 
开发者ID:mbway,项目名称:Simulizer,代码行数:29,代码来源:Options.java

示例15: getImagePane

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
/**
 * Get a Pane show otherImage, in center
 */
public static Node getImagePane(InputStream in, BodyType type) {
    if (type == BodyType.jpeg || type == BodyType.png || type == BodyType.gif
            || type == BodyType.bmp || type == BodyType.icon) {
        Image image;
        if (type == BodyType.icon) {
            try {
                image = getIconImage(in);
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        } else {
            image = new Image(in);
        }

        ImageView imageView = new ImageView();
        imageView.setImage(image);

        ScrollPane scrollPane = new ScrollPane();
        StackPane stackPane = new StackPane(imageView);
        stackPane.minWidthProperty().bind(Bindings.createDoubleBinding(() ->
                scrollPane.getViewportBounds().getWidth(), scrollPane.viewportBoundsProperty()));
        stackPane.minHeightProperty().bind(Bindings.createDoubleBinding(() ->
                scrollPane.getViewportBounds().getHeight(), scrollPane.viewportBoundsProperty()));

        scrollPane.setContent(stackPane);
        scrollPane.setStyle("-fx-background-color:transparent");
        return scrollPane;
    } else {
        return new Text("Unsupported image format");
    }
}
 
开发者ID:hsiafan,项目名称:byproxy,代码行数:35,代码来源:UIUtils.java


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