本文整理汇总了Java中javafx.scene.control.ScrollPane.setHbarPolicy方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollPane.setHbarPolicy方法的具体用法?Java ScrollPane.setHbarPolicy怎么用?Java ScrollPane.setHbarPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.ScrollPane
的用法示例。
在下文中一共展示了ScrollPane.setHbarPolicy方法的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: 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);
}
示例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: 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);
}
示例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: wrapInScroller
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
/**
* Method to wrap the content in a {@link ScrollPane}.
* @param css the {@link DynamicCssOnlyProperties} for configuring the {@link ScrollPane}.
* @param content the {@link Node} to wrap.
* @return the {@link ScrollPane} wrapping.
*/
private static Node wrapInScroller( DynamicCssOnlyProperties css, Node content ){
ScrollPane scroller = new ScrollPane( content );
scroller.setHbarPolicy( ScrollBarPolicy.NEVER );
scroller.setFitToWidth( true );
css.removeScrollPaneBorder( scroller );
return scroller;
}
示例11: start
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("main.fxml"));
AnchorPane page = loader.load();
UiController uiController = loader.getController();
uiController.setStageAndSetupListeners(primaryStage);
ScrollPane toolPane = (ScrollPane) page.lookup("#mToolPane");
toolPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
double width = toolPane.getPrefWidth();
double height = toolPane.getPrefHeight();
MenuBar menuBar = (MenuBar) page.lookup("#mMenuBar");
menuBar.prefWidthProperty().bind(primaryStage.widthProperty());
double menuHeight = 25;
toolPane.setPrefHeight(1000 > height ? 1000:height);
Scene scene = new Scene(page, width + 1000, 1000 > height ? 1000 + menuHeight : height + menuHeight);
primaryStage.setScene(scene);
primaryStage.setTitle(TITLE);
primaryStage.show();
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
Platform.exit();
System.exit(0);
}
});
} catch (IOException ioe) {
Logger.getLogger(TAG).log(Level.SEVERE, null, ioe);
}
}
示例12: 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;
}
示例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();
}