本文整理汇总了Java中javafx.scene.control.ScrollPane.setPadding方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollPane.setPadding方法的具体用法?Java ScrollPane.setPadding怎么用?Java ScrollPane.setPadding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.ScrollPane
的用法示例。
在下文中一共展示了ScrollPane.setPadding方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
示例2: 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;
}
}
示例3: 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;
}