本文整理汇总了Java中javafx.scene.control.ScrollPane.setVbarPolicy方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollPane.setVbarPolicy方法的具体用法?Java ScrollPane.setVbarPolicy怎么用?Java ScrollPane.setVbarPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.ScrollPane
的用法示例。
在下文中一共展示了ScrollPane.setVbarPolicy方法的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;
}
示例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: showOutput
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
/**
* Prints the content of the tracking log into a new Stage.
*/
public void showOutput() {
Text show = new Text(output());
ScrollPane window = new ScrollPane();
window.setContent(show);
window.setHbarPolicy(ScrollBarPolicy.AS_NEEDED);
window.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
Scene scene = new Scene(window, 400, 600);
Stage stage = new Stage();
stage.setTitle("Tracking history");
stage.setScene(scene);
stage.show();
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-nimmdochirgendeinennamen,代码行数:19,代码来源:Tracker.java
示例4: 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);
}
示例5: 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);
}
示例6: initComponents
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
private void initComponents() {
createLeftPane();
createRightPane();
scrollPane = new ScrollPane(anchorPane);
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
getItems().addAll(scrollPane, annotationTable);
setDividerPositions(0.7);
}
示例7: initComponents
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
private void initComponents() {
mainSplitPane.setDividerPositions(0.35);
mainSplitPane.getItems().addAll(createTree(), functionSplitPane);
expandAllBtn.setOnAction((e) -> expandAll());
collapseAllBtn.setOnAction((e) -> collapseAll());
refreshButton.setOnAction((e) -> refresh());
topButtonBar.setId("topButtonBar");
topButtonBar.setButtonMinWidth(Region.USE_PREF_SIZE);
topButtonBar.getButtons().addAll(expandAllBtn, collapseAllBtn, refreshButton);
functionSplitPane.setDividerPositions(0.4);
functionSplitPane.setOrientation(Orientation.VERTICAL);
documentArea = functionInfo.getEditorProvider().get(false, 0, IEditorProvider.EditorType.OTHER, false);
Platform.runLater(() -> {
documentArea.setEditable(false);
documentArea.setMode("ruby");
});
argumentPane = new VBox();
ScrollPane scrollPane = new ScrollPane(argumentPane);
scrollPane.setHbarPolicy(ScrollBarPolicy.AS_NEEDED);
scrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
functionSplitPane.getItems().addAll(documentArea.getNode(), scrollPane);
okButton.setOnAction(new OkHandler());
okButton.setDisable(true);
cancelButton.setOnAction((e) -> dispose());
buttonBar.getButtons().addAll(okButton, cancelButton);
buttonBar.setButtonMinWidth(Region.USE_PREF_SIZE);
}
示例8: 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;
}
示例9: 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);
}
示例10: TaskViewer
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
public TaskViewer() {
super(370, 235, 0, 0, "Task Manager");
getStylesheets().add("css/taskViewer.css");
this.getStyleClass().add("task-viewer");
macrosDropdown = macroDropdownSetup();
ScrollPane scroll = new ScrollPane();
scroll.getStyleClass().add("scroll");
scroll.setPrefSize(235, 300);
scroll.setVbarPolicy(ScrollBarPolicy.ALWAYS);
taskViewerBox = new VBox(8);
taskViewerBox.getStyleClass().add("task-viewer-inner");
taskPanes = new ArrayList<TaskPane>();
scroll.setContent(taskViewerBox);
BorderPane taskViewerRootPane = new BorderPane();
taskViewerRootPane.setCenter(scroll);
HBox buttonSection = new HBox(5);
buttonSection.setPrefSize(235, 30);
buttonSection.getStyleClass().add("button-section");
buttonSection.setPadding(new Insets(2));
buttonSection.setAlignment(Pos.CENTER);
addDeleteButton(buttonSection);
addMoveButtons(buttonSection);
addMacroButtons(buttonSection);
Platform.runLater(() -> {
Tooltip.install(macrosDropdown, new Tooltip("Macros"));
});
buttonSection.getChildren().add(macrosDropdown);
taskViewerRootPane.setBottom(buttonSection);
this.setContent(taskViewerRootPane);
}
示例11: constructContainer
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Override
public Parent constructContainer() {
webContent.loadContent("<html><body><b>Missing a manual</b></body></html>");
try {
// To avoid strange chars like "", the html -Tag is added here separately:
webContent.loadContent("<html>"+Functions.fileToString(new File(
"src/views/txt/troubleshoot.htm"))+"</html>");
} catch (Exception e) {
e.printStackTrace();
}
double pageWidth = this.getFXController().getMyFXStage().getOPTIMAL_WIDTH();
double pageHeight = this.getFXController().getMyFXStage().getOPTIMAL_HEIGHT();
debug.Debugger.out("ManualView sizes: w:"+pageWidth+" h:"+pageHeight);
//webPage.setPrefHeight(pageHeight);
webPage.setPrefWidth(pageWidth*.93);
//webContent.setJavaScriptEnabled(true);
webPage.applyCss();
Label labelTitel = new Label("Fehlerbehandlung");
labelTitel.setId("anleitungstitel");
BackButton backBtn = new BackButton(this.getFXController());
BorderPane headLayout = new BorderPane(labelTitel);
headLayout.setPadding(new Insets(20));
ScrollPane scroller = new ScrollPane();
scroller.setMaxWidth(pageWidth);
scroller.setContent(webPage);
scroller.setHbarPolicy(ScrollBarPolicy.NEVER);
scroller.setVbarPolicy(ScrollBarPolicy.ALWAYS);
scroller.setId("anleitung");
HBox controlLayout = new HBox(20);
controlLayout.setAlignment(Pos.BOTTOM_CENTER);
controlLayout.getChildren().addAll(backBtn);
controlLayout.setPadding(new Insets(10));
BorderPane mainLayout = new BorderPane();
mainLayout.setPadding(new Insets(15));
mainLayout.setTop(headLayout);
mainLayout.setCenter(scroller);
mainLayout.setBottom(controlLayout);
return mainLayout;
}
示例12: 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);
}
示例13: start
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage)
{
this.stage = primaryStage;
primaryStage.setTitle(APPLICATION_NAME + " V" + VERSION + "." + REVISION);
ApplicationSettings.initialize();
ApplicationSettings.loadFromFile("settings/plp-tool.settings");
EventRegistry.getGlobalRegistry().register(new ApplicationEventBusEventHandler());
applicationThemeManager = new ApplicationThemeManager();
this.assemblyDetails = new HashMap<>();
this.openFileTabs = new DualHashBidiMap<>();
this.openProjectsPanel = new TabPane();
this.projectExplorer = createProjectTree();
outlineView = createOutlineView();
console = createConsole();
console.println(">> Console Initialized.");
openProjectsPanel.getSelectionModel().selectedItemProperty()
.addListener(this::onTabActivation);
ScrollPane scrollableProjectExplorer = new ScrollPane(projectExplorer);
scrollableProjectExplorer.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
scrollableProjectExplorer.setHbarPolicy(ScrollBarPolicy.AS_NEEDED);
scrollableProjectExplorer.setFitToHeight(true);
scrollableProjectExplorer.setFitToWidth(true);
// Left side holds the project tree and outline view
SplitPane leftSplitPane = new SplitPane();
leftSplitPane.orientationProperty().set(Orientation.VERTICAL);
leftSplitPane.getItems().addAll(scrollableProjectExplorer, outlineView);
leftSplitPane.setDividerPositions(0.5, 1.0);
leftSplitPane.setMinSize(0, 0);
// Right side holds the source editor and the output console
SplitPane rightSplitPane = new SplitPane();
rightSplitPane.orientationProperty().set(Orientation.VERTICAL);
rightSplitPane.getItems().addAll(Components.wrap(openProjectsPanel),
Components.wrap(console));
rightSplitPane.setDividerPositions(0.75, 1.0);
rightSplitPane.setMinSize(0, 0);
// Container for the whole view (everything under the toolbar)
SplitPane explorerEditorSplitPane = new SplitPane();
explorerEditorSplitPane.getItems().addAll(Components.wrap(leftSplitPane),
Components.wrap(rightSplitPane));
explorerEditorSplitPane.setDividerPositions(0.225, 1.0);
explorerEditorSplitPane.setMinSize(0, 0);
SplitPane.setResizableWithParent(leftSplitPane, Boolean.FALSE);
//loadOpenProjects();
Parent menuBar = createMenuBar();
Parent toolbar = createToolbar();
BorderPane mainPanel = new BorderPane();
VBox topContainer = new VBox();
topContainer.getChildren().add(menuBar);
topContainer.getChildren().add(toolbar);
mainPanel.setTop(topContainer);
mainPanel.setCenter(explorerEditorSplitPane);
int width = DEFAULT_WINDOW_WIDTH;
int height = DEFAULT_WINDOW_HEIGHT;
Scene scene = new Scene(Components.wrap(mainPanel), width, height);
primaryStage.setScene(scene);
String themeName = ApplicationSettings.getSetting(
ApplicationSetting.APPLICATION_THEME).get();
EventRegistry.getGlobalRegistry().post(new ThemeRequestEvent(themeName));
primaryStage.show();
}
示例14: constructContainer
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Override
public Parent constructContainer() {
webContent.loadContent("<html><body><b>Missing a manual</b></body></html>");
try {
// To avoid strange chars like "", the html -Tag is added here separately:
webContent.loadContent("<html>"+Functions.fileToString(new File(
"src/views/txt/troubleshoot.htm"))+"</html>");
} catch (Exception e) {
e.printStackTrace();
}
double pageWidth = this.getFXController().getMyFXStage().getOPTIMAL_WIDTH();
double pageHeight = this.getFXController().getMyFXStage().getOPTIMAL_HEIGHT();
debug.Debugger.out("ManualView sizes: w:"+pageWidth+" h:"+pageHeight);
//webPage.setPrefHeight(pageHeight);
webPage.setPrefWidth(pageWidth*.93);
//webContent.setJavaScriptEnabled(true);
webPage.applyCss();
Label labelTitel = new Label("Fehlerbehandlung");
labelTitel.setId("anleitungstitel");
BackButton backBtn = new BackButton(this.getFXController());
BorderPane headLayout = new BorderPane(labelTitel);
headLayout.setPadding(new Insets(20));
ScrollPane scroller = new ScrollPane();
scroller.setMaxWidth(pageWidth);
scroller.setContent(webPage);
scroller.setHbarPolicy(ScrollBarPolicy.NEVER);
scroller.setVbarPolicy(ScrollBarPolicy.ALWAYS);
scroller.setId("anleitung");
HBox controlLayout = new HBox(20);
controlLayout.setAlignment(Pos.BOTTOM_CENTER);
controlLayout.getChildren().addAll(backBtn);
controlLayout.setPadding(new Insets(10));
BorderPane mainLayout = new BorderPane();
mainLayout.setPadding(new Insets(15));
mainLayout.setTop(headLayout);
mainLayout.setCenter(scroller);
mainLayout.setBottom(controlLayout);
return mainLayout;
}
示例15: 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();
}