本文整理汇总了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();
}
示例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());
}
示例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;
}
示例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);
}
示例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");
}
}
示例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;
}
示例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);
}
示例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();
}
示例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();
}
示例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);
}
示例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() ) );
}
示例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 ) ) );
}