當前位置: 首頁>>代碼示例>>Java>>正文


Java ScrollPane.setStyle方法代碼示例

本文整理匯總了Java中javafx.scene.control.ScrollPane.setStyle方法的典型用法代碼示例。如果您正苦於以下問題:Java ScrollPane.setStyle方法的具體用法?Java ScrollPane.setStyle怎麽用?Java ScrollPane.setStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.control.ScrollPane的用法示例。


在下文中一共展示了ScrollPane.setStyle方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

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

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

示例3: createScrollPane

import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
public static ScrollPane createScrollPane(double width, double height, String style, String styleClass, ScrollBarPolicy hPolicy, ScrollBarPolicy vPolicy, boolean pannable)
{
	ScrollPane pane = new ScrollPane();
	pane.setMinWidth(width);
	pane.setMaxWidth(width);
	pane.setMinHeight(height);
	pane.setMaxHeight(height);
	pane.setStyle(style);
	pane.getStyleClass().add(styleClass);
	pane.hbarPolicyProperty().set(hPolicy);
	pane.vbarPolicyProperty().set(vPolicy);
	pane.pannableProperty().set(pannable);
	return pane;
}
 
開發者ID:PolyphasicDevTeam,項目名稱:NoMoreOversleeps,代碼行數:15,代碼來源:JavaFxHelper.java

示例4: drawTo

import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
@Override
void drawTo(Pane paneTo) {

    TilePane tilePane = new TilePane();
    tilePane.setHgap(HGAP);
    tilePane.setVgap(VGAP);

    if (0 == getActionHolderList().size()) {
        return;
    } else {
        for (ActionHolder ah : getActionHolderList()) {
            Collection<? extends Node> childnodes = ah.draw();
            if (null != childnodes && 0 != childnodes.size()) {
                createSlot(((TestNode) ah).getName(), childnodes, tilePane);
            } else {
                //  TODO
            }
        }
    }
    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setPrefSize(getWidth(), getHeight());
    scrollPane.setMaxSize(getWidth(), getHeight());
    scrollPane.setContent(tilePane);
    scrollPane.setStyle("-fx-padding: 10;-fx-background: white;-fx-border-color: gray;");

    paneTo.getChildren().add(scrollPane);
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:28,代碼來源:ScrollablePageWithSlots.java

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

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

示例7: setLayout

import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
private void setLayout() {
    // set layout for this pane
    final RowConstraints headerRow = new RowConstraints(USE_PREF_SIZE, USE_COMPUTED_SIZE, USE_PREF_SIZE); // HEADER FOR FULL WEEK
    final RowConstraints allDayRow = new RowConstraints(USE_PREF_SIZE, USE_COMPUTED_SIZE, USE_PREF_SIZE); // SINGLE DAY HEADER AND ALL DAY APPOINTMENTS
    final RowConstraints calendarRow = new RowConstraints(
            150, 500, Double.POSITIVE_INFINITY, Priority.ALWAYS, VPos.TOP, true); // CALENDAR
    final ColumnConstraints columnConstraints = new ColumnConstraints(
            400, 600, Double.POSITIVE_INFINITY, Priority.SOMETIMES, HPos.LEFT, true); // FULL WIDTH
    this.getRowConstraints().addAll(headerRow, allDayRow, calendarRow);
    this.getColumnConstraints().add(columnConstraints);
    this.getStyleClass().add("weekview");


    // create a container for the week header
    Pane weekHeaderContainer = new StackPane();
    weekHeaderContainer.getStyleClass().add("weekview-header-container");
    this.weekHeaderContainer = weekHeaderContainer;

    // ScrollPane that contains the DayPane and the TimeAxis
    final ScrollPane scrollPane = new ScrollPane();
    scrollPane.getStyleClass().add("weekview-scrollpane");
    scrollPane.setStyle("-fx-background-color:transparent;"); // remove gray border
    scrollPane.setFitToWidth(true);
    scrollPane.setFitToHeight(true);
    scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);

    // the ScrollPane holds a GridPane with two columns: one for the TimeAxis and one for the calendar
    final GridPane scrollPaneContent = new GridPane();
    scrollPaneContent.getStyleClass().add("weekview-scrollpane-content");
    final ColumnConstraints timeColumn = new ColumnConstraints(
            USE_PREF_SIZE, USE_COMPUTED_SIZE, USE_PREF_SIZE, Priority.ALWAYS, HPos.LEFT, false); // TIME COLUMN
    final ColumnConstraints calendarColumn = new ColumnConstraints(
            USE_PREF_SIZE, USE_COMPUTED_SIZE, Double.POSITIVE_INFINITY, Priority.ALWAYS, HPos.LEFT, true); // CALENDAR COLUMN
    final RowConstraints rowConstraint = new RowConstraints(
            USE_PREF_SIZE, USE_COMPUTED_SIZE, Double.POSITIVE_INFINITY, Priority.ALWAYS, VPos.TOP, true); // FULL HEIGHT
    scrollPaneContent.getColumnConstraints().addAll(timeColumn, calendarColumn);
    scrollPaneContent.getRowConstraints().addAll(rowConstraint);
    scrollPane.setContent(scrollPaneContent);

    // create a container for the TimeAxis
    Pane timeAxisContainer = new StackPane();
    timeAxisContainer.getStyleClass().add("weekview-timeaxis-container");
    scrollPaneContent.add(timeAxisContainer, 0, 0);
    this.timeAxisContainer = timeAxisContainer;

    // set up a GridPane that holds all the DayPanes and a GridPane for the headers and full day appointments
    final GridPane dayPaneContainer = new GridPane();
    dayPaneContainer.getStyleClass().add("weekview-daypane-container");
    final GridPane dayHeaderContainer = new GridPane();
    dayHeaderContainer.getStyleClass().add("weekview-day-header-container");
    for (int i = 0; i < numberOfDays; i++) {
        final ColumnConstraints appointmentsColumn = new ColumnConstraints(
                USE_PREF_SIZE, dayPaneMinWidth, Double.POSITIVE_INFINITY, Priority.ALWAYS, HPos.CENTER, true);
        dayPaneContainer.getColumnConstraints().add(appointmentsColumn);
        dayHeaderContainer.getColumnConstraints().add(appointmentsColumn);
    }
    final RowConstraints singleDayHeaderRow = new RowConstraints(USE_PREF_SIZE, USE_COMPUTED_SIZE, USE_PREF_SIZE); // PANE FOR A DAILY HEADER
    final RowConstraints singleDayAppointmentsRow = new RowConstraints(USE_PREF_SIZE, USE_COMPUTED_SIZE, USE_PREF_SIZE); // PANE FOR ALL DAY APPOINTMENTS
    dayHeaderContainer.getRowConstraints().addAll(singleDayHeaderRow, singleDayAppointmentsRow);
    timeAxisContainer.widthProperty().addListener(observable -> {
        dayHeaderContainer.setPadding(new Insets(0, 17 /*scrollbar*/, 0, timeAxisContainer.getWidth() + 1));
    });
    final RowConstraints dayPanesRow = new RowConstraints(
            USE_PREF_SIZE, USE_COMPUTED_SIZE, Double.POSITIVE_INFINITY, Priority.ALWAYS, VPos.TOP, true); // FULL HEIGHT
    dayPaneContainer.getRowConstraints().add(dayPanesRow);
    this.dayPanesContainer = dayPaneContainer;
    this.dayHeadersContainer = dayHeaderContainer;
    scrollPaneContent.add(dayPaneContainer, 1, 0);

    // ordering is important:
    this.add(scrollPane, 0, 2);
    this.add(dayHeaderContainer, 0, 1);
    this.add(weekHeaderContainer, 0, 0);
}
 
開發者ID:Jibbow,項目名稱:FastisFX,代碼行數:75,代碼來源:WeekView.java

示例8: start

import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
@Override
public void start(Stage stage) {
	stage.setTitle("HTMLEditor Sample");
	stage.setWidth(500);
	stage.setHeight(500);
	Scene scene = new Scene(new Group());

	VBox root = new VBox();
	root.setPadding(new Insets(8, 8, 8, 8));
	root.setSpacing(5);
	root.setAlignment(Pos.BOTTOM_LEFT);

	final HTMLEditor htmlEditor = new HTMLEditor();
	htmlEditor.setPrefHeight(245);
	htmlEditor.setHtmlText(INITIAL_TEXT);

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

	ScrollPane scrollPane = new ScrollPane();
	scrollPane.getStyleClass().add("noborder-scroll-pane");
	scrollPane.setStyle("-fx-background-color: white");
	scrollPane.setContent(browser);
	scrollPane.setFitToWidth(true);
	scrollPane.setPrefHeight(180);

	Button showHTMLButton = new Button("Load Content in Browser");
	root.setAlignment(Pos.CENTER);
	showHTMLButton.setOnAction(new EventHandler<ActionEvent>() {
		@Override
		public void handle(ActionEvent arg0) {
			webEngine.loadContent(htmlEditor.getHtmlText());
		}
	});

	root.getChildren().addAll(htmlEditor, showHTMLButton, scrollPane);
	scene.setRoot(root);

	stage.setScene(scene);
	stage.show();
}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:42,代碼來源:HtmlEditorExam.java

示例9: ScreenshotsGallery

import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
public ScreenshotsGallery() throws Exception
{
    this.stage = MineIDE.primaryStage;
    
    this.stage = new Stage(StageStyle.DECORATED);
    this.stage.initStyle(StageStyle.TRANSPARENT);
    ScrollPane root = new ScrollPane();
    TilePane tile = new TilePane();
    root.setStyle("-fx-padding: 2.5; " + "-fx-background-color: gainsboro; " + "-fx-border-width:2; " + "-fx-border-color: " + "linear-gradient(" + "to bottom, " + "CornflowerBlue, " + "derive(MediumSeaGreen, 50%)" + ");");
    root.setEffect(new DropShadow());
    tile.setPadding(new Insets(15, 15, 15, 15));
    tile.setHgap(15);
    
    String path = Utils.FORGE_DIR + "/run/screenshots/";
    
    File folder = new File(path);
    File[] listOfFiles = folder.listFiles();
    
    for(final File file : listOfFiles)
    {
        ImageView imageView;
        imageView = this.createImageView(file);
        tile.getChildren().addAll(imageView);
    }
    
    root.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); // Horizontal
    root.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); // Vertical
                                                              // scroll bar
    root.setFitToWidth(true);
    root.setContent(tile);
    
    this.stage.setTitle("Minecraft Screenshots Gallery");
    this.stage.getIcons().add(new Image(Utils.IMG_DIR + "icon.png"));
    this.stage.toFront();
    this.stage.setWidth(854);
    this.stage.setHeight(480);
    Scene scene = new Scene(root);
    
    scene.setOnKeyPressed(new EventHandler<KeyEvent>()
    {
        @Override
        public void handle(KeyEvent keyEvent)
        {
            if(keyEvent.getEventType() == KeyEvent.KEY_PRESSED && keyEvent.getCode() == KeyCode.ESCAPE)
                Platform.exit();
        }
    });
    
    this.stage.setScene(scene);
    this.stage.show();
}
 
開發者ID:Leviathan-Studio,項目名稱:MineIDE-UI,代碼行數:52,代碼來源:ScreenshotsGallery.java

示例10: TagField

import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
public TagField(ArrayList<Tag> tags, ArrayList<Tag> allAvailableTags, NewPaymentController parentController)
{
	this.tags = tags;
	this.allTags = allAvailableTags;
	this.parentController = parentController;
	
	this.hboxTags = initHboxTags();	
	ScrollPane scrollPane = new ScrollPane();
	scrollPane.setContent(hboxTags);
	scrollPane.setVbarPolicy(ScrollBarPolicy.NEVER);
	scrollPane.setMinHeight(50);
	scrollPane.setStyle("-fx-background-color: #FFFFFF; -fx-background-radius: 5px; -fx-border-color: #000000; -fx-border-width: 1 1 0 1; -fx-border-radius: 5px 5px 0 0");

	this.getChildren().add(scrollPane);
	VBox.setVgrow(scrollPane, Priority.ALWAYS);
	
	textField = new TextField();
	textField.setStyle("-fx-background-color: #FFFFFF; -fx-border-color: #000000; -fx-border-width: 1; -fx-background-radius: 5px; -fx-border-radius: 0 0 5px 5px");		
	textField.setPromptText(Localization.getString(Strings.TAGFIELD_PLACEHOLDER));
	textField.setMaxWidth(Double.MAX_VALUE);
	textField.setOnKeyPressed((event)->{
           if(event.getCode().equals(KeyCode.ENTER))
           {
           	addTag(textField.getText().trim());
           }
           else if(event.getCode().equals(KeyCode.DOWN))
           {
           	textField.setText(" ");
           	textField.setText("");
           }
    });
	
	textField.setOnMousePressed((event)->{
		textField.setText(" ");
       	textField.setText("");
	});
	
	TextFields.bindAutoCompletion(textField, new Callback<AutoCompletionBinding.ISuggestionRequest, Collection<String>>()
	{
		@Override
		public Collection<String> call(org.controlsfx.control.textfield.AutoCompletionBinding.ISuggestionRequest param)
		{
			ArrayList<String> completions = getCompletions(allTags);
			ArrayList<String> remainingCompletions = new ArrayList<>();
			for(String currentCompletion : completions)
			{
				if(currentCompletion.toLowerCase().contains(param.getUserText().toLowerCase()))
				{
					remainingCompletions.add(currentCompletion);
				}
			}
			
			return remainingCompletions;
		}
	});
	this.getChildren().add(textField);		

	this.setStyle("-fx-background-color: #FFFFFF; -fx-background-radius: 5px;");
	
	refresh(false);
}
 
開發者ID:deadlocker8,項目名稱:BudgetMaster,代碼行數:62,代碼來源:TagField.java

示例11: removeScrollPaneBorder

import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
/**
 * Method to remove the {@link ScrollPane} background by making it transparent.
 * @param scrollPane the {@link ScrollPane} to configure.
 */
public void removeScrollPaneBorder( ScrollPane scrollPane ) {
   scrollPane.setStyle( formatBackgroundColourProperty( css.transparent() ) );
}
 
開發者ID:DanGrew,項目名稱:JttDesktop,代碼行數:8,代碼來源:DynamicCssOnlyProperties.java

示例12: applyBackgroundColour

import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
/**
 * Method to change the {@link ScrollPane} background.
 * @param scrollPane the {@link ScrollPane} to configure.
 * @param colour the {@link Color} to change to.
 */
public void applyBackgroundColour( ScrollPane scrollPane, Color colour ) {
   scrollPane.setStyle( formatBackgroundColourProperty( colorConverter.colorToHex( colour ) ) );
}
 
開發者ID:DanGrew,項目名稱:JttDesktop,代碼行數:9,代碼來源:DynamicCssOnlyProperties.java


注:本文中的javafx.scene.control.ScrollPane.setStyle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。