本文整理匯總了Java中javafx.scene.layout.BorderPane.setMaxWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java BorderPane.setMaxWidth方法的具體用法?Java BorderPane.setMaxWidth怎麽用?Java BorderPane.setMaxWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.layout.BorderPane
的用法示例。
在下文中一共展示了BorderPane.setMaxWidth方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createBorderPane
import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
public static BorderPane createBorderPane(double width, double height)
{
BorderPane pane = new BorderPane();
pane.setMinWidth(width);
pane.setMaxWidth(width);
pane.setMinHeight(height);
pane.setMaxHeight(height);
return pane;
}
示例2: homeView
import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
public static Scene homeView(){
BorderPane view = new BorderPane();
Label title = new Label("Classroom Flipkart");
title.setFont(new Font("Open Sans", 60));
title.setTextFill(Color.web("#ededed"));
HBox header = new HBox(25);
header.setMinHeight(30);
header.setAlignment(Pos.TOP_CENTER);
Label login = new Label("Login");
login.setPadding(new Insets(5));
login.setFont(new Font("Open Sans", 20));
login.setTextFill(Color.web("#ededed"));
login.setCursor(Cursor.HAND);
login.setStyle(" -fx-border-color: red; -fx-border-width: 0 0 3 0; -fx-border-insets: 0 0 1 0; ");
Label register = new Label("Register");
register.setPadding(new Insets(5));
register.setFont(new Font("Open Sans", 20));
register.setTextFill(Color.web("#ededed"));
register.setCursor(Cursor.HAND);
header.getChildren().addAll(login, register);
userLogin loginObject = new userLogin();
userSignUp signUpObject = new userSignUp();
BorderPane credential = new BorderPane(loginObject.userLogin(), header, null, null, null);
credential.setMaxWidth(350);
credential.setStyle("-fx-background-color: rgba(0, 100, 100, 0.5); -fx-border-color: grey; -fx-border-width: 1 1 1 1;");
login.setOnMouseClicked(e->{
credential.setCenter(loginObject.userLogin());
login.setStyle(" -fx-border-color: red; -fx-border-width: 0 0 3 0; -fx-border-insets: 0 0 1 0; ");
register.setStyle("");
});
register.setOnMouseClicked(e->{
credential.setCenter(signUpObject.userSignUp());
login.setStyle("");
register.setStyle(" -fx-border-color: red; -fx-border-width: 0 0 3 0; -fx-border-insets: 0 0 1 0; ");
});
VBox centerVB = new VBox(30);
centerVB.setAlignment(Pos.CENTER);
centerVB.getChildren().addAll(title, credential);
view.setCenter(centerVB);
Scene scene = new Scene(view,800,500);
scene.getStylesheets().add(loginHome.class.getResource("../../resources/css/main.css").toExternalForm());
image = loginHome.class.getResource("../../resources/images/splash.jpg").toExternalForm();
view.setStyle("-fx-background-image: url('" + image + "'); " +
"-fx-background-position: center center; " +
"-fx-background-size: cover, auto; " +
"-fx-background-repeat: stretch;");
return scene;
}
示例3: formatcomment
import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
public static BorderPane formatcomment(String timestamp, String comment){
BorderPane notice = new BorderPane();
notice.setPadding(new Insets(0,-20,0,10));
notice.setMaxWidth(340);
VBox noticeVB = new VBox(5);
noticeVB.setStyle("-fx-background-color: transparent; -fx-border-color: #333; -fx-border-width: 1,1,1,1; -fx-border-radius: 10; -fx-text-color: #333;");
Label commentLabel = new Label(comment);
commentLabel.setPadding(new Insets(5));
commentLabel.setFont(new Font("Cambria", 16));
commentLabel.setTextFill(Color.web("#191919"));
commentLabel.setWrapText(true);
commentLabel.setMaxWidth(320);
commentLabel.setAlignment(Pos.BOTTOM_LEFT);
Label time = new Label(timeStampChangeFormat.timeStampChangeFormat(timestamp));
time.setFont(new Font("Cambria", 12));
time.setTextFill(Color.web("#4c4c4c"));
time.setPadding(new Insets(5));
time.setMaxWidth(320);
time.setAlignment(Pos.BOTTOM_LEFT);
noticeVB.getChildren().addAll(commentLabel,time);
notice.setLeft(noticeVB);
noticeVB.setStyle("-fx-background-color: #fff");
return notice;
}