本文整理匯總了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;
}