本文整理匯總了Java中javafx.scene.control.ScrollPane.setFitToWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java ScrollPane.setFitToWidth方法的具體用法?Java ScrollPane.setFitToWidth怎麽用?Java ScrollPane.setFitToWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.ScrollPane
的用法示例。
在下文中一共展示了ScrollPane.setFitToWidth方法的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: FlowCardComposite
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
/**
* @param nodeConverter
*/
public FlowCardComposite() {
scrollPane = new ScrollPane();
scrollPane.setFitToHeight(true);
scrollPane.setFitToWidth(true);
scrollPane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
StackPane stackPane = new StackPane(scrollPane);
stackPane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
masonryPane = new JFXMasonryPane();
scrollPane.setContent(masonryPane);
setCenter(stackPane);
initialize();
masonryPane.setCache(false);
setStyle("-fx-background-color : #292929");
}
示例3: homeProducts
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
public static BorderPane homeProducts(){
VBox products = new VBox(20);
products.getChildren().addAll(
fetchProducts.productbyType("Discounts for You"),
fetchProducts.productbyType("Featured Product"),
fetchProducts.productbyType("New Arrival"),
fetchProducts.productbyType("Trending"));
ScrollPane proScroller = new ScrollPane(products);
proScroller.setPrefHeight(400);
proScroller.setFitToWidth(true);
BorderPane home = new BorderPane(proScroller);
return home;
}
示例4: 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();
}
示例5: getScene
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
@Override
protected Scene getScene() {
application = this;
sp = new ScrollPane(buildContent());
sp.setFitToWidth(true);
sp.setBackground(Background.EMPTY);
Scene scene = new Scene(sp, WIDTH, HEIGHT);
Utils.addBrowser(scene);
scene.setOnKeyPressed(new EventHandler<KeyEvent>() {
public void handle(KeyEvent t) {
switch (t.getText().charAt(0)) {
case '1':
scrollToMark(0);
break;
case '2':
scrollToMark(1);
break;
case '3':
scrollToMark(2);
break;
};
}
});
return scene;
}
示例6: buildSelectedSectionBody
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
public ScrollPane buildSelectedSectionBody() {
VBox itemBox = new VBox();
for (int i = 0; i < items.size(); i++) {
SettingsItem item = items.get(i);
BorderPane itemPane = item.build();
if (i % 2 != 0) {
itemPane.getStyleClass()
.add("alternatedColor");
} else {
itemPane.getStyleClass()
.remove("alternatedColor");
}
itemBox.getChildren()
.add(itemPane);
}
ScrollPane scrollPane = new ScrollPane(itemBox);
scrollPane.setFitToWidth(true);
return scrollPane;
}
示例7: MemristorParametersUI
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
public MemristorParametersUI(MemristorLibrary.Memristor_Model memristorType) {
dm = new DialogsManager();
savedFileCount = 0;
this.memristorType = memristorType;
memristor = MemristorLibrary.GetNewMemristor(memristorType);
selectedPreset = 0;
simulationType = ResourcesMAF.MONTECARLO_SIMULATION;
// Main GridPane
GridPane gridPane = new GridPane();
gridPane.setPadding(new Insets(15, 15, 15, 15));
gridPane.setHgap(5);
gridPane.setVgap(5);
gridPane.setAlignment(Pos.CENTER);
// Create UI
RecreateParameterAndVariationsUI(gridPane, memristorType.index());
// Set content in scroll pane
ScrollPane sp = new ScrollPane();
sp.setContent(gridPane);
sp.setFitToHeight(true);
sp.setFitToWidth(true);
this.getChildren().add(sp);
}
示例8: 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);
}
示例9: 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);
}
示例10: 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);
}
示例11: 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);
}
示例12: 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;
}
示例13: productbyType
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
public static BorderPane productbyType(String type) {
BorderPane products = new BorderPane();
products.setPadding(new Insets(10,20,10,20));
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
String query = DBUtils.prepareSelectQuery(" * ",
" classroomflipkart.productdetail AS T ," +
" ( "+ DBUtils.prepareSelectQuery("productId",
" classroomflipkart.homeproducts ",
"type = '"+type+"'")+
" ) AS S",
" T.productId = S.productId ");
try {
con = DBUtils.getConnection();
stmt = con.prepareStatement(query);
rs = stmt.executeQuery();
rs.last();
int size = rs.getRow();
if (size>0){
rs.beforeFirst();
Label title = new Label(type+"");
title.setFont(Font.font("Open Sans", FontWeight.BOLD,17));
title.setPadding(new Insets(10));
title.setAlignment(Pos.CENTER);
HBox productList = new HBox(20);
productList.setAlignment(Pos.CENTER);
while (rs.next()) {
String productId = rs.getString("productId");
String productName = rs.getString("productName");
String newPrice = rs.getString("newPrice");
String oldPrice = rs.getString("oldPrice");
String category = rs.getString("category");
String subcategory = rs.getString("subcategory");
String imageName = rs.getString("imageName");
String productAvailability = rs.getString("productAvailability");
productList.getChildren().add(productDetail.productByType(productId,productName,newPrice,oldPrice,category,subcategory,imageName, productAvailability));
}
ScrollPane proScroller = new ScrollPane(productList);
proScroller.setFitToHeight(true);
proScroller.setFitToWidth(true);
proScroller.setPannable(true);
proScroller.setPadding(new Insets(0,0,30,0));
StackPane titlePane = new StackPane(title);
titlePane.setAlignment(Pos.CENTER);
StackPane productPane = new StackPane(proScroller);
productPane.setAlignment(Pos.CENTER);
products.setTop(titlePane);
products.setCenter(productPane);
}
} catch (Exception e) {
products.setCenter(new Label(e.getMessage()));
e.printStackTrace();
} finally {
DBUtils.closeAll(rs, stmt, con);
return products;
}
}
示例14: 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);
}
示例15: wrapForScroll
import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
protected ScrollPane wrapForScroll(Pane rootGrid) {
ScrollPane scrollPane = new ScrollPane(rootGrid);
scrollPane.setPadding(new Insets(0));
scrollPane.setFitToWidth(true);
scrollPane.setFitToHeight(true);
return scrollPane;
}