Java Code Examples for javafx.scene.layout.VBox#setPrefHeight()

The following examples show how to use javafx.scene.layout.VBox#setPrefHeight() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContextMenuStage.java    From oim-fx with MIT License 6 votes vote down vote up
private void init() {
	this.setCenter(rootPane);
	this.setTitle("组件测试");
	this.setWidth(380);
	this.setHeight(600);
	this.setRadius(10);
	

	VBox topBox = new VBox();
	topBox.setPrefHeight(50);
	
	HBox hBox=new HBox();
	hBox.getChildren().add(button);
	
	rootPane.setTop(topBox);
	rootPane.setBottom(hBox);
	
	button.setOnAction(a->{
		menu.show(button, Side.TOP, button.getLayoutX(), button.getLayoutY());
	});
}
 
Example 2
Source File: ImageCropperStage.java    From oim-fx with MIT License 6 votes vote down vote up
private void init() {
	this.setCenter(rootPane);
	this.setTitle("组件测试");
	this.setWidth(380);
	this.setHeight(600);
	this.setRadius(10);

	VBox topBox = new VBox();
	topBox.setPrefHeight(50);
	rootPane.setTop(topBox);
	rootPane.setCenter(imageCropperPane);
	
	rootPane.setRight(slider);
	
	slider.setValue(50);
	slider.setOrientation(Orientation.VERTICAL);
	
	imageCropperPane.setMaxWidth(350);
}
 
Example 3
Source File: ScreenShotFrameShowFrame.java    From oim-fx with MIT License 6 votes vote down vote up
private void init() {
	this.setCenter(rootPane);
	this.setTitle("组件测试");
	this.setWidth(380);
	this.setHeight(600);
	this.setRadius(10);

	VBox topBox = new VBox();
	topBox.setPrefHeight(50);
	rootPane.setTop(topBox);
	rootPane.setCenter(componentBox);

	Button b=new Button("截屏");
	componentBox.getChildren().add(b);
	
	b.setOnAction(a->{
		ss.setVisible(true);
	});
}
 
Example 4
Source File: IconButtonFrameTest.java    From oim-fx with MIT License 6 votes vote down vote up
@Override
  public void start(Stage primaryStage) {
  	stage.show();
  	
  	stage.setCenter(rootPane);
  	stage.setTitle("组件测试");
  	stage.setWidth(380);
  	stage.setHeight(600);
  	stage.setRadius(10);

VBox topBox = new VBox();
topBox.setPrefHeight(50);
rootPane.setTop(topBox);

rootPane.setCenter(componentBox);

Image image = ImageBox.getImageClassPath("/images/head/101_100.gif");
IconButton themeIconButton = new IconButton(image);
themeIconButton.setPrefSize(130, 130);
Platform.runLater(new Runnable() {
	@Override
	public void run() {
		componentBox.getChildren().add(themeIconButton);
	}
});
  }
 
Example 5
Source File: BoxFrame.java    From oim-fx with MIT License 5 votes vote down vote up
private void init() {
	this.setCenter(rootPane);
	this.setTitle("组件测试");
	this.setWidth(380);
	this.setHeight(600);
	this.setRadius(10);

	VBox topBox = new VBox();
	topBox.setPrefHeight(50);
	rootPane.setTop(topBox);
	rootPane.setCenter(vBox);

	Button b1=new Button("1");
	Button b2=new Button("2");
	
	HBox h1=new HBox();
	HBox h2=new HBox();
	
	h1.getChildren().add(b1);
	h2.getChildren().add(b2);
	
	HBox.setHgrow(b1, Priority.ALWAYS);
	HBox.setHgrow(b2, Priority.ALWAYS);

	vBox.getChildren().add(h1);
	vBox.getChildren().add(h2);
	
}
 
Example 6
Source File: VBoxFrame.java    From oim-fx with MIT License 5 votes vote down vote up
private void init() {
	this.setCenter(rootPane);
	this.setTitle("组件测试");
	this.setWidth(380);
	this.setHeight(600);
	this.setRadius(10);

	VBox rootVBox = new VBox();
	rootVBox.setPrefHeight(30);
	rootVBox.setStyle("-fx-background-color:#26292e");
	
	rootPane.setPadding(new Insets(30, 0, 0, 0));
	rootPane.setTop(rootVBox);

	Button button1=new Button("1");
	StackPane stackPane1 = new StackPane();
	stackPane1.getChildren().add(button1);
	
	Button button2=new Button("2");
	StackPane stackPane2 = new StackPane();
	stackPane2.getChildren().add(button2);
	
	Button button3=new Button("3");
	StackPane stackPane3 = new StackPane();
	stackPane3.getChildren().add(button3);
	
	HBox topHBox = new HBox();
	topHBox.setStyle("-fx-background-color:rgba(194, 194, 173, 1)");
	topHBox.getChildren().add(stackPane1);
	topHBox.getChildren().add(stackPane2);
	topHBox.getChildren().add(stackPane3);
	
	BorderPane borderPane = new BorderPane();
	borderPane.setTop(topHBox);
	
	StackPane stackPane = new StackPane();
	stackPane.getChildren().add(borderPane);
	
	rootPane.setCenter(stackPane);
}
 
Example 7
Source File: HeadImageFrame.java    From oim-fx with MIT License 5 votes vote down vote up
private void init() {
	this.setCenter(rootPane);
	this.setTitle("组件测试");
	this.setWidth(380);
	this.setHeight(600);
	this.setRadius(10);

	VBox topBox = new VBox();
	topBox.setPrefHeight(50);
	rootPane.setTop(topBox);

	Image image = ImageBox.getImageClassPath("/images/head/101_100.gif");

	ImageNode imageButton = new ImageNode();

	imageButton.setImage(image);
	imageButton.setImageSize(80);
	imageButton.setImageRadius(20);
	imageButton.setGray(true);
	imageButton.setEffect(new DropShadow(20, Color.BLACK));

	ImageView imageView = new ImageView();
	imageView.setImage(image);

	StackPane stackPane = new StackPane();
	stackPane.getChildren().add(imageButton);
	stackPane.setStyle("-fx-background-color:rgba(150,120,210,1)");

	rootPane.setCenter(stackPane);
}
 
Example 8
Source File: MenuFrame.java    From oim-fx with MIT License 5 votes vote down vote up
private void init() {
	this.getScene().getStylesheets().add(this.getClass().getResource("/classics/css/base.css").toString());
	this.getRootPane().getStylesheets().add(this.getClass().getResource("/classics/css/base.css").toString());
	
	
	this.setCenter(rootPane);
	this.setTitle("组件测试");
	this.setWidth(380);
	this.setHeight(600);
	this.setRadius(10);

	VBox topBox = new VBox();
	topBox.setPrefHeight(50);
	rootPane.setTop(topBox);
	BorderPane borderPane = new BorderPane();

	rootPane.setCenter(borderPane);

	HBox hBox = new HBox();

	borderPane.setTop(hBox);
	borderPane.setCenter(componentBox);

	componentBox.setOnContextMenuRequested(a -> {
		///menu.show(MenuFrame.this, a.getX(), a.getY());
	});
}
 
Example 9
Source File: ChatPaneFrame.java    From oim-fx with MIT License 5 votes vote down vote up
private void init() {
	this.setBackground("Resources/Images/Wallpaper/18.jpg");
	this.setTitle("登录");
	this.setWidth(340);
	this.setHeight(560);
	this.setCenter(rootPane);

	VBox b = new VBox();
	b.setPrefHeight(40);

	
	rootPane.setTop(b);
	rootPane.setCenter(nodeChatPane);
	rootPane.setStyle("-fx-background-color:rgba(255, 255, 255, 0.2)");
}
 
Example 10
Source File: ImageTextPaneFrame.java    From oim-fx with MIT License 5 votes vote down vote up
private void init() {
	this.setBackground("Resources/Images/Wallpaper/18.jpg");
	this.setTitle("登录");
	this.setWidth(340);
	this.setHeight(560);
	this.setCenter(rootPane);

	VBox b = new VBox();
	b.setPrefHeight(40);

	
	rootPane.setTop(b);
	rootPane.setCenter(nodeChatPane);
	rootPane.setStyle("-fx-background-color:rgba(255, 255, 255, 0.2)");
}
 
Example 11
Source File: NotificationPanel.java    From trex-stateless-gui with Apache License 2.0 5 votes vote down vote up
/**
 * Build component UI
 */
private void buildUI() {

    this.setSpacing(5);
    
    // add notification message
    notificationContainer = new Pane();
    notificationContainer.setPrefSize(184, 64);
    notificationContainer.getStyleClass().add("notificationContainer");
    notificationLabel = new Label();
    notificationLabel.setPrefSize(155, 60);
    notificationLabel.setWrapText(true);
    notificationLabel.getStyleClass().add("notificationMsg");
    notificationContainer.getChildren().add(notificationLabel);
    getChildren().add(notificationContainer);

    // add notification icon
    VBox iconHolder = new VBox();
    iconHolder.setPrefHeight(68);
    iconHolder.setAlignment(Pos.CENTER);
    ImageView notificationIcon = new ImageView(new Image("/icons/info_icon.png"));
    notificationIcon.getStyleClass().add("notificationIcon");
    notificationIcon.setOnMouseClicked((MouseEvent event) -> {
        notificationContainer.setVisible(!notificationContainer.isVisible());
    });
    iconHolder.getChildren().add(notificationIcon);
    getChildren().add(iconHolder);

}
 
Example 12
Source File: RepositoryPickerDialog.java    From HubTurbo with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void createSuggestedRepositoriesList() {
    suggestedRepositoryList = new VBox();
    suggestedRepositoryList.setPadding(DEFAULT_PADDING);
    suggestedRepositoryList.setId(IdGenerator.getRepositoryPickerSuggestedRepoListId());
    suggestedRepositoryList.setStyle("-fx-background-color: white; -fx-border-color:black;");
    suggestedRepositoryList.setPrefHeight(DEFAULT_SUGGESTED_REPO_LIST_HEIGHT);
    suggestedRepositoryList.setPrefWidth(DEFAULT_SUGGESTED_REPO_LIST_WIDTH);
}
 
Example 13
Source File: MainPane.java    From oim-fx with MIT License 4 votes vote down vote up
private void initComponent() {
	Label titleLabel = new Label("", logoImageView);
	titleLabel.setStyle("-fx-text-fill: white;");

	titleHBox.setPadding(new Insets(5, 0, 0, 10));
	titleHBox.setPrefHeight(30);
	titleHBox.getChildren().add(titleLabel);

	topVBox.getChildren().add(titleHBox);
	topVBox.getChildren().add(userDataPane);

	listBaseStackPane.getChildren().add(tabPane);
	listBaseStackPane.getChildren().add(findListPane);

	centerBorderPane.setTop(searchBox);
	centerBorderPane.setCenter(listBaseStackPane);

	findTextField.setPromptText("搜索:联系人、多人聊天、群");
	findTextField.getStyleClass().remove("text-field");
	findTextField.setBackground(Background.EMPTY);
	findTextField.setMinHeight(30);
	findTextField.setStyle("-fx-prompt-text-fill:#ffffff;");

	Image image = ImageBox.getImageClassPath("/classics/images/main/search/search_icon.png");
	ImageView searchImageView = new ImageView();
	searchImageView.setImage(image);

	searchBox.getChildren().add(findTextField);
	searchBox.getChildren().add(searchImageView);
	HBox.setHgrow(findTextField, Priority.ALWAYS);

	searchBox.setAlignment(Pos.CENTER_RIGHT);
	searchBox.setStyle("-fx-background-color:rgba(0, 0, 0, 0.3)");

	tabPane.setStyle("-fx-background-color:rgba(230, 230, 230, 0.8)");

	functionBox.setBackground(Background.EMPTY);
	functionBox.setPadding(new Insets(0, 5, 5, 0));

	VBox separator = new VBox();
	separator.setPrefHeight(1);
	separator.setMinHeight(1);
	separator.setBackground(Background.EMPTY);
	// separator.setStyle("-fx-background-color:rgba(230, 230, 230, 1)");

	BorderPane bottomBorderPane = new BorderPane();
	bottomBorderPane.setCenter(functionBox);
	bottomBorderPane.setRight(rightFunctionBox);

	bottomBox.setPadding(new Insets(5, 2, 1, 2));
	bottomBox.setStyle("-fx-background-color:rgba(230, 230, 230, 0.7)");

	bottomBox.getChildren().add(separator);
	bottomBox.getChildren().add(bottomBorderPane);

	borderPane.setTop(topVBox);
	borderPane.setCenter(centerBorderPane);
	borderPane.setBottom(bottomBox);

	this.setCenter(borderPane);
	tabPane.setVisible(true);
	findListPane.setVisible(false);

	functionBox.setOnMouseEntered(m -> {
		functionBox.setCursor(Cursor.DEFAULT);
	});
}
 
Example 14
Source File: HeadItemPaneFrame.java    From oim-fx with MIT License 4 votes vote down vote up
private void init() {

		this.getRootPane().getStylesheets().add(this.getClass().getResource("/multiple/css/main.css").toString());

		this.setCenter(rootPane);
		this.setTitle("组件测试");
		this.setWidth(380);
		this.setHeight(600);
		this.setRadius(10);

		VBox topBox = new VBox();
		topBox.setPrefHeight(50);
		rootPane.setTop(topBox);

		rootPane.setCenter(componentBox);

		Image image = ImageBox.getImageClassPath("/images/head/101_100.gif");
		ChooseGroup chooseGroup = new ChooseGroup();
		for (int i = 0; i < 5; i++) {
			String text = "好傻水水水水?【】[图片]";

			String name = "(恢复大师)";

			HeadItem head = new HeadItem();
			head.setHeadImage(image);
			
			head.setRemark("张思");
			head.setNickname(name);
			head.setShowText(text);
			head.setTime("12:20");

			head.setChooseGroup(chooseGroup);

			head.setOnMouseClicked(m -> {
				boolean pulse = !head.isPulse();
				head.setPulse(pulse);
				chooseGroup.selectedChoose(head);
			});
			Platform.runLater(new Runnable() {
				@Override
				public void run() {
					componentBox.getChildren().add(head);
				}
			});
		}
	}
 
Example 15
Source File: LastItemPaneFrame.java    From oim-fx with MIT License 4 votes vote down vote up
private void init() {

		this.getRootPane().getStylesheets().add(this.getClass().getResource("/multiple/css/main.css").toString());

		this.setCenter(rootPane);
		this.setTitle("组件测试");
		this.setWidth(380);
		this.setHeight(600);
		this.setRadius(10);

		VBox topBox = new VBox();
		topBox.setPrefHeight(50);
		rootPane.setTop(topBox);

		rootPane.setCenter(componentBox);

		Image image = ImageBox.getImageClassPath("/images/head/101_100.gif");
		ChooseGroup chooseGroup = new ChooseGroup();
		for (int i = 0; i < 5; i++) {
			String text = "好傻水水水水?【】[图片]";

			String name = "恢复大师";

			LastItem head = new LastItem();
			head.setHeadImage(image);
			head.setName(name);
			head.setText(text);
			head.setTime("12:20");

			head.setChooseGroup(chooseGroup);

			head.setOnMouseClicked(m -> {

				boolean red = !head.isRed();
				String redText = red ? "5" : "";
				head.setRed(red);
				head.setRedText(redText);

				chooseGroup.selectedChoose(head);
			});
			Platform.runLater(new Runnable() {
				@Override
				public void run() {
					componentBox.getChildren().add(head);
				}
			});
		}
	}
 
Example 16
Source File: MilestonePickerDialog.java    From HubTurbo with GNU Lesser General Public License v3.0 4 votes vote down vote up
private VBox createMatchingMilestonesBox() {
    VBox milestoneGroup = new VBox();
    milestoneGroup.setPrefHeight(DETAILED_MILESTONE_HEIGHT * MilestonePickerState.BEST_MATCHING_LIMIT);
    milestoneGroup.setStyle("-fx-border-radius: 3;-fx-background-color: white;-fx-border-color: black;");
    return milestoneGroup;
}