Initial project

This commit is contained in:
Timi
2025-07-14 14:12:45 +08:00
parent c1788c7d30
commit 16e11e30ce
32 changed files with 4945 additions and 94 deletions

View File

@ -0,0 +1,165 @@
package com.imyeyu.fx.utils;
import javafx.geometry.VPos;
import javafx.scene.layout.Priority;
import javafx.scene.layout.RowConstraints;
/**
* GridPane 行属性构造
*
* @author 夜雨
* @since 2021-12-17 23:45
*/
public class Row extends RowConstraints {
/**
* 默认构造器({@link #build(VPos)} 静态构造)
*
* @param align 垂直对齐方式
*/
private Row(VPos align) {
setValignment(align);
}
/**
* 设置最小高度
*
* @param minHeight 最小高度
* @return 本实例
*/
public Row min(double minHeight) {
setMinHeight(minHeight);
return this;
}
/**
* 设置最大高度
*
* @param maxHeight 最大高度
* @return 本实例
*/
public Row max(double maxHeight) {
setMaxHeight(maxHeight);
return this;
}
/**
* 设置高度
*
* @param height 高度
* @return 本实例
*/
public Row height(double height) {
setPrefHeight(height);
return this;
}
/**
* 以百分比设置高度
*
* @param percentHeight 高度
* @return 本实例
*/
public Row percentHeight(double percentHeight) {
setPercentHeight(percentHeight);
return this;
}
/**
* 保持子组件高度填充
*
* @return 本实例
*/
public Row fill() {
setFillHeight(true);
return this;
}
/**
* 子组件高度不需填充
*
* @return 本实例
*/
public Row notFill() {
setFillHeight(false);
return this;
}
/**
* 顶部对齐
*
* @return 本实例
*/
public Row top() {
setValignment(VPos.TOP);
return this;
}
/**
* 居中对齐
*
* @return 本实例
*/
public Row center() {
setValignment(VPos.CENTER);
return this;
}
/**
* 底部对齐
*
* @return 本实例
*/
public Row bottom() {
setValignment(VPos.BOTTOM);
return this;
}
/**
* 行高总是保持跟随容器尺寸变化
*
* @return 本实例
*/
public Row alwaysPriority() {
setVgrow(Priority.ALWAYS);
return this;
}
/**
* 行高总是不保持跟随容器尺寸变化
*
* @return 本实例
*/
public Row neverPriority() {
setVgrow(Priority.NEVER);
return this;
}
/**
* 行高不受其他行影响时可跟随容器尺寸变化
*
* @return 本实例
*/
public Row sometimesPriority() {
setVgrow(Priority.SOMETIMES);
return this;
}
/**
* 静态构造行属性对象
*
* @return 行属性对象
*/
public static Row build() {
return new Row(VPos.CENTER);
}
/**
* 静态构造行属性对象
*
* @param align 垂直对齐方式
* @return 本实例
*/
public static Row build(VPos align) {
return new Row(align);
}
}