修正resizable的bug
This commit is contained in:
10
README.en.md
10
README.en.md
@@ -302,13 +302,17 @@ We directly operate on Java bean classess, modifying the interface with dynamic
|
|||||||
In our framework, windows are draggable and scalable. In JavaFX, if a window hides its title, the window can not be dragged and scaled. But in JavaFX-Plus, we have resolved this issue with an annotation of `@FXWindow`.
|
In our framework, windows are draggable and scalable. In JavaFX, if a window hides its title, the window can not be dragged and scaled. But in JavaFX-Plus, we have resolved this issue with an annotation of `@FXWindow`.
|
||||||
|
|
||||||
```java
|
```java
|
||||||
@FXWindow(title = "demo1",dragable = true,style = StageStyle.UNDECORATED)
|
@FXWindow(title = "demo1",dragable = true,style = StageStyle.UNDECORATED) //draggable
|
||||||
```
|
```
|
||||||
|
|
||||||
As described in the code above, you can make window with no title draggable and scalable( the default value is draggable).
|
As described in the code above, you can make window with no title draggable and scalable( the default value is draggable).
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
```java
|
||||||
|
@FXWindow(title = "demo1",resizable = true,style = StageStyle.UNDECORATED) // resizable
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -388,8 +392,8 @@ private Label us;
|
|||||||
As code shown follows, we implemented a simple exchange rate converter
|
As code shown follows, we implemented a simple exchange rate converter
|
||||||
|
|
||||||
```java
|
```java
|
||||||
@FXController(path = "actionDemo/actionDemo.fxml")
|
@FXController(path = "bindDemo/bindDemo.fxml")
|
||||||
@FXWindow(title = "actionDemo", mainStage = true)
|
@FXWindow(title = "bindDemo", mainStage = true)
|
||||||
public class MainController extends FXBaseController implements Initializable {
|
public class MainController extends FXBaseController implements Initializable {
|
||||||
@FXML
|
@FXML
|
||||||
@FXBind("text=${@toUs(time.text)}") // bind the text of Label to the return value of toUs() function
|
@FXBind("text=${@toUs(time.text)}") // bind the text of Label to the return value of toUs() function
|
||||||
|
|||||||
BIN
README.en/Resizable_en.gif
Normal file
BIN
README.en/Resizable_en.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.1 MiB |
BIN
README.en/draggable_en.gif
Normal file
BIN
README.en/draggable_en.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.8 MiB |
24
README.md
24
README.md
@@ -76,13 +76,11 @@
|
|||||||
|
|
||||||
## Maven仓库地址
|
## Maven仓库地址
|
||||||
```xml
|
```xml
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.gitee.Biubiuyuyu</groupId>
|
<groupId>com.gitee.Biubiuyuyu</groupId>
|
||||||
<artifactId>javafx-plus</artifactId>
|
<artifactId>javafx-plus</artifactId>
|
||||||
<version>1.0.0-RELEASE</version>
|
<version>1.0.0-RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
```
|
```
|
||||||
## 具体应用
|
## 具体应用
|
||||||
可见 [下载器](https://gitee.com/Biubiuyuyu/JavaFX-Demo 'Demo')
|
可见 [下载器](https://gitee.com/Biubiuyuyu/JavaFX-Demo 'Demo')
|
||||||
@@ -320,18 +318,25 @@ public class Student {
|
|||||||
|
|
||||||
### 可拔插功能
|
### 可拔插功能
|
||||||
|
|
||||||
在本框架中实现了窗口可拖动和窗口可伸缩,在Javafx中如果一个窗口隐藏了标题栏那么这个窗口也就没办法拖动和伸缩了,在JavaFX-Plus中你就不需有这种烦恼,只需要在@FXWindow中设置
|
在本框架中实现了窗口可拖动和窗口可伸缩,在Javafx中如果一个窗口隐藏了标题栏那么这个窗口也就没办法拖动和伸缩了,在JavaFX-Plus中你就不需有这种烦恼,只需要在@FXWindow中设置。
|
||||||
|
|
||||||
```java
|
```java
|
||||||
@FXWindow(title = "demo1",dragable = true,style = StageStyle.UNDECORATED)
|
@FXWindow(title = "demo1",dragable = true,style = StageStyle.UNDECORATED) // 可拖动
|
||||||
```
|
```
|
||||||
就可以让这个没有标题的窗口可以被拖动而且能拉伸(默认打开,可以关闭)
|
就可以让这个没有标题的窗口可以被拖动而且能拉伸(默认打开,可以关闭)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```java
|
||||||
|
@FXWindow(title = "demo1",resizable = true,style = StageStyle.UNDECORATED) // 可缩放
|
||||||
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 数据绑定
|
### 数据绑定
|
||||||
|
|
||||||
与之相关的注解有`@FXBind`,注解在JavaFX控件的字段上面,标明该变量的绑定方式和绑定属性,类似于Vue中的界面绑定。目前已实现Bean和View的绑定、View和View的绑定、函数表达式的绑定
|
与之相关的注解有`@FXBind`,注解在JavaFX控件的字段上面,标明该变量的绑定方式和绑定属性,类似于Vue中的界面绑定。目前已实现Bean和View的绑定、View和View的绑定、函数表达式的绑定
|
||||||
@@ -349,7 +354,9 @@ public class Student {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
Student student = new Student();
|
Student student = new Student();
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TestField usr;
|
||||||
@FXML
|
@FXML
|
||||||
private PasswordField psw;
|
private PasswordField psw;
|
||||||
|
|
||||||
@@ -380,6 +387,9 @@ public class Student {
|
|||||||
@FXBind("text=${psw.text}")
|
@FXBind("text=${psw.text}")
|
||||||
@FXML
|
@FXML
|
||||||
private Label pswMsg;//任何psw中的内容都会同步到pswMsg中
|
private Label pswMsg;//任何psw中的内容都会同步到pswMsg中
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private PasswordField psw;
|
||||||
```
|
```
|
||||||
如图所示
|
如图所示
|
||||||

|

|
||||||
@@ -404,8 +414,8 @@ private Label us;
|
|||||||
如以下代码,实现简单的汇率转换器。
|
如以下代码,实现简单的汇率转换器。
|
||||||
|
|
||||||
```java
|
```java
|
||||||
@FXController(path = "actionDemo/actionDemo.fxml")
|
@FXController(path = "bindDemo/bindDemo.fxml")
|
||||||
@FXWindow(title = "actionDemo", mainStage = true)
|
@FXWindow(title = "bindDemo", mainStage = true)
|
||||||
public class MainController extends FXBaseController implements Initializable {
|
public class MainController extends FXBaseController implements Initializable {
|
||||||
@FXML
|
@FXML
|
||||||
@FXBind("text=${@toUs(time.text)}") // 将Label中的text和toUs()函数的返回值绑定
|
@FXBind("text=${@toUs(time.text)}") // 将Label中的text和toUs()函数的返回值绑定
|
||||||
|
|||||||
BIN
README/Resizable.gif
Normal file
BIN
README/Resizable.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.1 MiB |
BIN
README/draggable.gif
Normal file
BIN
README/draggable.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 MiB |
101
pom.xml
101
pom.xml
@@ -30,6 +30,7 @@
|
|||||||
</distributionManagement>
|
</distributionManagement>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<!-- 第三方动态代理库-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cglib</groupId>
|
<groupId>cglib</groupId>
|
||||||
<artifactId>cglib</artifactId>
|
<artifactId>cglib</artifactId>
|
||||||
@@ -78,56 +79,56 @@
|
|||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
<profile>
|
<profile>
|
||||||
<id>release</id>
|
<id>release</id>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<!-- Source -->
|
<!-- Source -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
<version>2.2.1</version>
|
<version>2.2.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>jar-no-fork</goal>
|
<goal>jar-no-fork</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- Javadoc -->
|
<!-- Javadoc -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>2.9.1</version>
|
<version>2.9.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>jar</goal>
|
<goal>jar</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<additionalparam>-Xdoclint:none</additionalparam>
|
<additionalparam>-Xdoclint:none</additionalparam>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- GPG -->
|
<!-- GPG -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-gpg-plugin</artifactId>
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
<version>1.5</version>
|
<version>1.5</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>sign-artifacts</id>
|
<id>sign-artifacts</id>
|
||||||
<phase>verify</phase>
|
<phase>verify</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>sign</goal>
|
<goal>sign</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import cn.edu.scau.biubiusuisui.factory.FXBuilder;
|
|||||||
import cn.edu.scau.biubiusuisui.factory.FXControllerFactory;
|
import cn.edu.scau.biubiusuisui.factory.FXControllerFactory;
|
||||||
import cn.edu.scau.biubiusuisui.function.FXWindowParser;
|
import cn.edu.scau.biubiusuisui.function.FXWindowParser;
|
||||||
import cn.edu.scau.biubiusuisui.utils.ClassUtils;
|
import cn.edu.scau.biubiusuisui.utils.ClassUtils;
|
||||||
|
import javafx.application.Application;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|||||||
@@ -5,16 +5,24 @@ import javafx.beans.property.Property;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 将Controller中的JavaFX的field包装成FXFieldWrapper
|
* 将Controller中的JavaFX的field包装成FXFieldWrapper
|
||||||
|
*
|
||||||
* @Author jack
|
* @Author jack
|
||||||
* @Date:2019/6/28 10:03
|
* @Date:2019/6/28 10:03
|
||||||
*/
|
*/
|
||||||
public class FXFieldWrapper {
|
public class FXFieldWrapper {
|
||||||
|
|
||||||
private FXField fxField;
|
private FXField fxField;
|
||||||
|
private Class type;
|
||||||
|
|
||||||
private Property property;
|
private Property property;
|
||||||
|
|
||||||
private Class type;
|
public FXFieldWrapper() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public FXFieldWrapper(FXField fxField, Class type) {
|
||||||
|
this.fxField = fxField;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
public Class getType() {
|
public Class getType() {
|
||||||
return type;
|
return type;
|
||||||
@@ -36,7 +44,7 @@ public class FXFieldWrapper {
|
|||||||
return property;
|
return property;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProperty(Property property){
|
public void setProperty(Property property) {
|
||||||
this.property = property;
|
this.property = property;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package cn.edu.scau.biubiusuisui.example.actionDemo;
|
package cn.edu.scau.biubiusuisui.example.bindDemo;
|
||||||
|
|
||||||
import cn.edu.scau.biubiusuisui.annotation.FXScan;
|
import cn.edu.scau.biubiusuisui.annotation.FXScan;
|
||||||
import cn.edu.scau.biubiusuisui.config.FXPlusApplication;
|
import cn.edu.scau.biubiusuisui.config.FXPlusApplication;
|
||||||
@@ -9,10 +9,10 @@ import javafx.stage.Stage;
|
|||||||
* @Author jack
|
* @Author jack
|
||||||
* @Date:2019/7/27 1:43
|
* @Date:2019/7/27 1:43
|
||||||
*/
|
*/
|
||||||
@FXScan(base = "cn.edu.scau.biubiusuisui.example.actionDemo")
|
@FXScan(base = "cn.edu.scau.biubiusuisui.example.bindDemo")
|
||||||
public class Demo extends Application {
|
public class BindDemo extends Application {
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) throws Exception {
|
public void start(Stage primaryStage) throws Exception {
|
||||||
FXPlusApplication.start(Demo.class);
|
FXPlusApplication.start(BindDemo.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
package cn.edu.scau.biubiusuisui.example.actionDemo;
|
package cn.edu.scau.biubiusuisui.example.bindDemo;
|
||||||
|
|
||||||
import cn.edu.scau.biubiusuisui.annotation.FXBind;
|
import cn.edu.scau.biubiusuisui.annotation.FXBind;
|
||||||
import cn.edu.scau.biubiusuisui.annotation.FXController;
|
import cn.edu.scau.biubiusuisui.annotation.FXController;
|
||||||
|
import cn.edu.scau.biubiusuisui.annotation.FXData;
|
||||||
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
|
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
|
||||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||||
import javafx.beans.value.ChangeListener;
|
import javafx.beans.value.ChangeListener;
|
||||||
@@ -9,6 +10,7 @@ import javafx.beans.value.ObservableValue;
|
|||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.PasswordField;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@@ -18,23 +20,58 @@ import java.util.ResourceBundle;
|
|||||||
* @Author jack
|
* @Author jack
|
||||||
* @Date:2019/7/27 1:43
|
* @Date:2019/7/27 1:43
|
||||||
*/
|
*/
|
||||||
@FXController(path = "actionDemo/actionDemo.fxml")
|
@FXController(path = "bindDemo/bindDemo.fxml")
|
||||||
@FXWindow(title = "actionDemo", mainStage = true)
|
@FXWindow(title = "bindDemo", mainStage = true)
|
||||||
public class MainController extends FXBaseController implements Initializable {
|
public class MainController extends FXBaseController implements Initializable {
|
||||||
|
// View bind to View
|
||||||
@FXML
|
@FXML
|
||||||
@FXBind("text=${@toUs(time.text)}")
|
@FXBind("text=${inputTF.text}")
|
||||||
|
private Label inputLabel;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TextField inputTF;
|
||||||
|
|
||||||
|
// View bind to a Java Bean
|
||||||
|
@FXML
|
||||||
|
private Label usernameLabel;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Label userPswLabel;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TextField usernameTF;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private PasswordField pswPF;
|
||||||
|
|
||||||
|
@FXData
|
||||||
|
@FXBind({
|
||||||
|
"name=${usernameTF.text}",
|
||||||
|
"password=${pswPF.text}"
|
||||||
|
})
|
||||||
|
private User user = new User();
|
||||||
|
|
||||||
|
// View bind to Expression
|
||||||
|
@FXML
|
||||||
|
private TextField money;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
@FXBind("text=${@toUs(money.text)}")
|
||||||
private Label us;
|
private Label us;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
@FXBind("text=${@toJp(time.text)}")
|
@FXBind("text=${@toJp(money.text)}")
|
||||||
private Label jp;
|
private Label jp;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
@FXBind("text=${@toUk(time.text)}")
|
@FXBind("text=${@toUk(money.text)}")
|
||||||
private Label uk;
|
private Label uk;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private TextField time;
|
public void clickToShowInfo() {
|
||||||
|
usernameLabel.setText(user.getName());
|
||||||
|
userPswLabel.setText(user.getPassword());
|
||||||
|
}
|
||||||
|
|
||||||
public String toUs(String value) {
|
public String toUs(String value) {
|
||||||
double money = Double.valueOf(value);
|
double money = Double.valueOf(value);
|
||||||
@@ -56,14 +93,14 @@ public class MainController extends FXBaseController implements Initializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
time.setText("0");
|
money.setText("0");
|
||||||
time.textProperty().addListener(new ChangeListener<String>() {
|
money.textProperty().addListener(new ChangeListener<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
||||||
if (null == newValue || "".equals(newValue)) {
|
if (null == newValue || "".equals(newValue)) {
|
||||||
time.setText("0");
|
money.setText("0");
|
||||||
} else if (!newValue.matches("^[0-9]*$")) {
|
} else if (!newValue.matches("^[0-9]*$")) {
|
||||||
time.setText(oldValue);
|
money.setText(oldValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package cn.edu.scau.biubiusuisui.example.actionDemo;
|
package cn.edu.scau.biubiusuisui.example.bindDemo;
|
||||||
|
|
||||||
import cn.edu.scau.biubiusuisui.annotation.FXEntity;
|
import cn.edu.scau.biubiusuisui.annotation.FXEntity;
|
||||||
import cn.edu.scau.biubiusuisui.annotation.FXField;
|
import cn.edu.scau.biubiusuisui.annotation.FXField;
|
||||||
@@ -47,7 +47,7 @@ public class MainController extends FXBaseController implements Initializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
student = (Student) FXEntityFactory.wrapFxBean(Student.class); // 从工厂中拿到将JavaBean转换得到的JavaFXBean
|
student = (Student) FXEntityFactory.wrapFXBean(Student.class); // 从工厂中拿到将JavaBean转换得到的JavaFXBean
|
||||||
Property listProperty = FXPlusContext.getEntityPropertyByName(student, "list");
|
Property listProperty = FXPlusContext.getEntityPropertyByName(student, "list");
|
||||||
list.itemsProperty().bind(listProperty);
|
list.itemsProperty().bind(listProperty);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ public class LoginController extends FXBaseController {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void registerClick() {
|
public void registerClick() {
|
||||||
System.out.println("点击注册.....");
|
|
||||||
redirectToRegister();
|
redirectToRegister();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,4 +39,11 @@ public class LoginController extends FXBaseController {
|
|||||||
public String redirectToDialog() {
|
public String redirectToDialog() {
|
||||||
return "DialogController";
|
return "DialogController";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
@FXRedirect //登录成功
|
||||||
|
public String redirectToSuccess() {
|
||||||
|
|
||||||
|
return "SuccessController";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package cn.edu.scau.biubiusuisui.example.resizableDemo;
|
||||||
|
|
||||||
|
import cn.edu.scau.biubiusuisui.annotation.FXScan;
|
||||||
|
import cn.edu.scau.biubiusuisui.config.FXPlusApplication;
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author suiyu_yang
|
||||||
|
* @description 缩放和拖拽的示例
|
||||||
|
* @date 2020/4/5 00:04
|
||||||
|
* @email suiyu_yang@163.com
|
||||||
|
*/
|
||||||
|
@FXScan(base = "cn.edu.scau.biubiusuisui.example.resizableDemo")
|
||||||
|
public class Demo extends Application {
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage) throws Exception {
|
||||||
|
FXPlusApplication.start(Demo.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package cn.edu.scau.biubiusuisui.example.resizableDemo;
|
||||||
|
|
||||||
|
import cn.edu.scau.biubiusuisui.annotation.FXController;
|
||||||
|
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
|
||||||
|
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.stage.StageStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author suiyu_yang
|
||||||
|
* @description 主控制器
|
||||||
|
* @date 2020/4/5 00:05
|
||||||
|
* @email suiyu_yang@163.com
|
||||||
|
*/
|
||||||
|
@FXController(path = "resizableDemo/resizableDemo.fxml")
|
||||||
|
@FXWindow(mainStage = true, title = "resizableDemo", draggable = true, resizable = true, style = StageStyle.UNDECORATED)
|
||||||
|
public class MainController extends FXBaseController {
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void closeWindowClick() {
|
||||||
|
this.closeStage();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,7 +30,7 @@ public class FXControllerFactory {
|
|||||||
|
|
||||||
|
|
||||||
private static final BeanBuilder BEAN_BUILDER = new FXBuilder();
|
private static final BeanBuilder BEAN_BUILDER = new FXBuilder();
|
||||||
private static FXWindowParser windowAnnotationParser = new FXWindowParser();
|
private static FXWindowParser fxWindowAnnotationParser = new FXWindowParser();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +154,7 @@ public class FXControllerFactory {
|
|||||||
double preHeight = fxWindow.preHeight() == 0 ? fxBaseControllerProxy.getPrefHeight() : fxWindow.preHeight();
|
double preHeight = fxWindow.preHeight() == 0 ? fxBaseControllerProxy.getPrefHeight() : fxWindow.preHeight();
|
||||||
Scene scene = new Scene(fxBaseControllerProxy, preWidth, preHeight);
|
Scene scene = new Scene(fxBaseControllerProxy, preWidth, preHeight);
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
windowAnnotationParser.parse(stage, fxBaseControllerProxy, fxWindow);
|
fxWindowAnnotationParser.parse(stage, fxBaseControllerProxy, fxWindow);
|
||||||
|
|
||||||
StageManager.getInstance().registerWindow(fxBaseControllerProxy); //注册舞台
|
StageManager.getInstance().registerWindow(fxBaseControllerProxy); //注册舞台
|
||||||
if (fxWindow.mainStage() == true) { //当是主舞台时,先show为敬
|
if (fxWindow.mainStage() == true) { //当是主舞台时,先show为敬
|
||||||
@@ -252,7 +252,7 @@ public class FXControllerFactory {
|
|||||||
//建立代理
|
//建立代理
|
||||||
try {
|
try {
|
||||||
Object fieldValue = field.get(fxControllerObject);
|
Object fieldValue = field.get(fxControllerObject);
|
||||||
Object fieldValueProxy = FXEntityFactory.wrapFxBean(fieldValue);
|
Object fieldValueProxy = FXEntityFactory.wrapFXBean(fieldValue);
|
||||||
field.set(fxControllerObject, fieldValueProxy);
|
field.set(fxControllerObject, fieldValueProxy);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -23,26 +23,26 @@ public class FXEntityFactory {
|
|||||||
private FXEntityFactory() {
|
private FXEntityFactory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object wrapFxBean(Class clazz) {
|
public static Object wrapFXBean(Class clazz) {
|
||||||
return wrapFxBean(clazz, new FXBuilder());
|
return wrapFXBean(clazz, new FXBuilder());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object wrapFxBean(Class clazz, BeanBuilder beanBuilder) {
|
public static Object wrapFXBean(Class clazz, BeanBuilder beanBuilder) {
|
||||||
Object object = null;
|
Object object = null;
|
||||||
object = beanBuilder.getBean(clazz);
|
object = beanBuilder.getBean(clazz);
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
return wrapFxBean(object);
|
return wrapFXBean(object);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object wrapFxBean(Object object) {
|
public static Object wrapFXBean(Object object) {
|
||||||
FXEntityProxy fxEntityProxy = new FXEntityProxy();
|
FXEntityProxy fxEntityProxy = new FXEntityProxy();
|
||||||
Object objectProxy = null;
|
Object objectProxy = null;
|
||||||
try {
|
try {
|
||||||
objectProxy = fxEntityProxy.getInstance(object); // 初始化代理类
|
objectProxy = fxEntityProxy.getInstance(object); // 初始化代理类
|
||||||
processFXEntityProxy(object, objectProxy, fxEntityProxy);
|
processFXEntityProxyFields(object, objectProxy, fxEntityProxy); //处理FXEntity上的@FXField
|
||||||
FXPlusContext.setProxyByBeanObject(objectProxy, fxEntityProxy);
|
FXPlusContext.setProxyByBeanObject(objectProxy, fxEntityProxy);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -50,7 +50,7 @@ public class FXEntityFactory {
|
|||||||
return objectProxy;
|
return objectProxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void processFXEntityProxy(Object entity, Object proxy, FXEntityProxy fxEntityProxy) throws IllegalAccessException {
|
private static void processFXEntityProxyFields(Object entity, Object proxy, FXEntityProxy fxEntityProxy) throws IllegalAccessException {
|
||||||
Map<String, FXFieldWrapper> fxFieldWrapperMap = new HashMap<>();
|
Map<String, FXFieldWrapper> fxFieldWrapperMap = new HashMap<>();
|
||||||
Field[] fields = entity.getClass().getDeclaredFields();
|
Field[] fields = entity.getClass().getDeclaredFields();
|
||||||
for (Field field : fields) {
|
for (Field field : fields) {
|
||||||
@@ -59,9 +59,7 @@ public class FXEntityFactory {
|
|||||||
Property property = null;
|
Property property = null;
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
FXField fxField = (FXField) annotation;
|
FXField fxField = (FXField) annotation;
|
||||||
FXFieldWrapper fieldWrapper = new FXFieldWrapper();
|
FXFieldWrapper fieldWrapper = new FXFieldWrapper(fxField, field.getType());
|
||||||
fieldWrapper.setFxField(fxField);
|
|
||||||
fieldWrapper.setType(field.getType());
|
|
||||||
if (field.get(entity) == null) {
|
if (field.get(entity) == null) {
|
||||||
property = getFieldDefaultProperty(field);
|
property = getFieldDefaultProperty(field);
|
||||||
} else {
|
} else {
|
||||||
@@ -136,6 +134,4 @@ public class FXEntityFactory {
|
|||||||
}
|
}
|
||||||
return property;
|
return property;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package cn.edu.scau.biubiusuisui.function;
|
|||||||
import javafx.event.EventHandler;
|
import javafx.event.EventHandler;
|
||||||
import javafx.scene.Cursor;
|
import javafx.scene.Cursor;
|
||||||
import javafx.scene.input.MouseEvent;
|
import javafx.scene.input.MouseEvent;
|
||||||
import javafx.scene.layout.AnchorPane;
|
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
@@ -25,77 +24,82 @@ public class DragWindowHandlerImpl implements EventHandler<MouseEvent> {
|
|||||||
boolean isBottomRight;// 是否处于右下角调整窗口状态
|
boolean isBottomRight;// 是否处于右下角调整窗口状态
|
||||||
boolean isBottom;// 是否处于下边界调整窗口状态
|
boolean isBottom;// 是否处于下边界调整窗口状态
|
||||||
private Pane pane;
|
private Pane pane;
|
||||||
private boolean fix = false;
|
private boolean resizable; //是否拉伸
|
||||||
|
private boolean draggable; //是否拖拽
|
||||||
|
|
||||||
public DragWindowHandlerImpl(Stage primaryStage, Pane pane,boolean fix) { //构造器
|
|
||||||
|
public DragWindowHandlerImpl(Stage primaryStage, Pane pane, boolean draggable, boolean resizable) { //构造器
|
||||||
this.stage = primaryStage;
|
this.stage = primaryStage;
|
||||||
this.pane = pane;
|
this.pane = pane;
|
||||||
this.fix = fix;
|
this.draggable = draggable;
|
||||||
|
this.resizable = resizable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DragWindowHandlerImpl(Stage stage, double MIN_WIDTH, double MIN_HEIGHT, Pane pane, boolean fix) {
|
public DragWindowHandlerImpl(Stage stage, double MIN_WIDTH, double MIN_HEIGHT, Pane pane, boolean draggable, boolean resizable) {
|
||||||
this.stage = stage;
|
this.stage = stage;
|
||||||
this.MIN_WIDTH = MIN_WIDTH;
|
this.MIN_WIDTH = MIN_WIDTH;
|
||||||
this.MIN_HEIGHT = MIN_HEIGHT;
|
this.MIN_HEIGHT = MIN_HEIGHT;
|
||||||
this.pane = pane;
|
this.pane = pane;
|
||||||
this.fix = fix;
|
this.draggable = draggable;
|
||||||
|
this.resizable = resizable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(MouseEvent e) {
|
public void handle(MouseEvent e) {
|
||||||
|
|
||||||
if (e.getEventType() == MouseEvent.MOUSE_PRESSED) { //鼠标按下的事件
|
if (e.getEventType() == MouseEvent.MOUSE_PRESSED) { //鼠标按下的事件
|
||||||
|
//鼠标按下时记录坐标
|
||||||
this.oldStageX = this.stage.getX();
|
this.oldStageX = this.stage.getX();
|
||||||
this.oldStageY = this.stage.getY();
|
this.oldStageY = this.stage.getY();
|
||||||
this.oldScreenX = e.getScreenX();
|
this.oldScreenX = e.getScreenX();
|
||||||
this.oldScreenY = e.getScreenY();
|
this.oldScreenY = e.getScreenY();
|
||||||
|
|
||||||
} else if (e.getEventType() == MouseEvent.MOUSE_DRAGGED) { //鼠标拖动的事件
|
} else if (e.getEventType() == MouseEvent.MOUSE_DRAGGED) { //鼠标拖动的事件
|
||||||
//
|
|
||||||
double nextX = stage.getX();
|
double nextX = stage.getX();
|
||||||
double nextY = stage.getY();
|
double nextY = stage.getY();
|
||||||
double nextWidth = stage.getWidth();
|
double nextWidth = stage.getWidth();
|
||||||
double nextHeight = stage.getHeight();
|
double nextHeight = stage.getHeight();
|
||||||
if(!fix) {
|
|
||||||
double x = e.getSceneX();
|
|
||||||
double y = e.getSceneY();
|
|
||||||
// 保存窗口改变后的x、y坐标和宽度、高度,用于预判是否会小于最小宽度、最小高度
|
|
||||||
|
|
||||||
|
double x = e.getSceneX();
|
||||||
if (isRight || isBottomRight) {// 所有右边调整窗口状态
|
double y = e.getSceneY();
|
||||||
nextWidth = x;
|
// 保存窗口改变后的x、y坐标和宽度、高度,用于预判是否会小于最小宽度、最小高度
|
||||||
}
|
if (isRight || isBottomRight) {// 所有右边调整窗口状态
|
||||||
if (isBottomRight || isBottom) {// 所有下边调整窗口状态
|
nextWidth = x;
|
||||||
nextHeight = y;
|
}
|
||||||
}
|
if (isBottomRight || isBottom) {// 所有下边调整窗口状态
|
||||||
if (nextWidth <= MIN_WIDTH) {// 如果窗口改变后的宽度小于最小宽度,则宽度调整到最小宽度
|
nextHeight = y;
|
||||||
nextWidth = MIN_WIDTH;
|
}
|
||||||
}
|
if (nextWidth <= MIN_WIDTH) {// 如果窗口改变后的宽度小于最小宽度,则宽度调整到最小宽度
|
||||||
if (nextHeight <= MIN_HEIGHT) {// 如果窗口改变后的高度小于最小高度,则高度调整到最小高度
|
nextWidth = MIN_WIDTH;
|
||||||
nextHeight = MIN_HEIGHT;
|
}
|
||||||
}
|
if (nextHeight <= MIN_HEIGHT) {// 如果窗口改变后的高度小于最小高度,则高度调整到最小高度
|
||||||
|
nextHeight = MIN_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 最后统一改变窗口的x、y坐标和宽度、高度,可以防止刷新频繁出现的屏闪情况
|
// 最后统一改变窗口的x、y坐标和宽度、高度,可以防止刷新频繁出现的屏闪情况
|
||||||
if(isBottom ||isBottomRight ||isRight) {
|
if (draggable) {
|
||||||
stage.setX(nextX);
|
if (isBottom || isBottomRight || isRight) {
|
||||||
stage.setY(nextY);
|
stage.setX(nextX);
|
||||||
|
stage.setY(nextY);
|
||||||
|
} else {
|
||||||
|
this.stage.setX(e.getScreenX() - this.oldScreenX + this.oldStageX);
|
||||||
|
this.stage.setY(e.getScreenY() - this.oldScreenY + this.oldStageY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (resizable) {
|
||||||
stage.setWidth(nextWidth);
|
stage.setWidth(nextWidth);
|
||||||
stage.setHeight(nextHeight);
|
stage.setHeight(nextHeight);
|
||||||
}else {
|
|
||||||
this.stage.setX(e.getScreenX() - this.oldScreenX + this.oldStageX);
|
|
||||||
this.stage.setY(e.getScreenY() - this.oldScreenY + this.oldStageY);
|
|
||||||
}
|
}
|
||||||
} else if (e.getEventType() == MouseEvent.MOUSE_MOVED) {
|
} else if (e.getEventType() == MouseEvent.MOUSE_MOVED) { //鼠标移动
|
||||||
if(!fix) {
|
e.consume();
|
||||||
e.consume();
|
double x = e.getSceneX();
|
||||||
double x = e.getSceneX();
|
double y = e.getSceneY();
|
||||||
double y = e.getSceneY();
|
double width = stage.getWidth();
|
||||||
double width = stage.getWidth();
|
double height = stage.getHeight();
|
||||||
double height = stage.getHeight();
|
Cursor cursorType = Cursor.DEFAULT;// 鼠标光标初始为默认类型,若未进入调整窗口状态,保持默认类型
|
||||||
Cursor cursorType = Cursor.DEFAULT;// 鼠标光标初始为默认类型,若未进入调整窗口状态,保持默认类型
|
// 先将所有调整窗口状态重置
|
||||||
// 先将所有调整窗口状态重置
|
isRight = isBottomRight = isBottom = false;
|
||||||
isRight = isBottomRight = isBottom = false;
|
|
||||||
|
if (resizable) {
|
||||||
if (y >= height - RESIZE_WIDTH) {
|
if (y >= height - RESIZE_WIDTH) {
|
||||||
if (x <= RESIZE_WIDTH) {// 左下角调整窗口状态
|
if (x <= RESIZE_WIDTH) {// 左下角调整窗口状态
|
||||||
|
|
||||||
@@ -111,7 +115,6 @@ public class DragWindowHandlerImpl implements EventHandler<MouseEvent> {
|
|||||||
cursorType = Cursor.E_RESIZE;
|
cursorType = Cursor.E_RESIZE;
|
||||||
}
|
}
|
||||||
// 最后改变鼠标光标
|
// 最后改变鼠标光标
|
||||||
|
|
||||||
pane.setCursor(cursorType);
|
pane.setCursor(cursorType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,16 +16,16 @@ public class FXWindowParser {
|
|||||||
stage.setTitle(fxWindow.title());
|
stage.setTitle(fxWindow.title());
|
||||||
|
|
||||||
if (fxWindow.resizable()) {
|
if (fxWindow.resizable()) {
|
||||||
stage.setResizable(false);
|
stage.setResizable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fxWindow.draggable()) {
|
if (fxWindow.draggable() || fxWindow.resizable()) {
|
||||||
final int RESIZE_WIDTH = 5;// 判定是否为调整窗口状态的范围与边界距离
|
EventHandler dragWindowHandler = new DragWindowHandlerImpl(stage, fxWindow.minWidth(), fxWindow.minHeight(), fxControllerProxy, fxWindow.draggable(), fxWindow.resizable());
|
||||||
EventHandler dragWindowHandler = new DragWindowHandlerImpl(stage, fxWindow.minWidth(), fxWindow.minHeight(), fxControllerProxy, fxWindow.resizable());
|
|
||||||
fxControllerProxy.setOnMousePressed(dragWindowHandler);
|
fxControllerProxy.setOnMousePressed(dragWindowHandler);
|
||||||
fxControllerProxy.setOnMouseDragged(dragWindowHandler);
|
fxControllerProxy.setOnMouseDragged(dragWindowHandler);
|
||||||
fxControllerProxy.setOnMouseMoved(dragWindowHandler);
|
fxControllerProxy.setOnMouseMoved(dragWindowHandler);
|
||||||
}
|
}
|
||||||
stage.initStyle(fxWindow.style());
|
stage.initStyle(fxWindow.style());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import cn.edu.scau.biubiusuisui.example.actionDemo.MainController?>
|
<?import cn.edu.scau.biubiusuisui.example.bindDemo.MainController?>
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.layout.Pane?>
|
<?import javafx.scene.layout.Pane?>
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.*?>
|
|
||||||
<?import javafx.scene.layout.Pane?>
|
|
||||||
<fx:root prefHeight="191.0" prefWidth="607.0" type="Pane" xmlns="http://javafx.com/javafx/8.0.171"
|
|
||||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="cn.edu.scau.biubiusuisui.example.actionDemo.MainController">
|
|
||||||
<children>
|
|
||||||
<TextField fx:id="time" layoutX="108.0" layoutY="28.0" prefHeight="28.0" prefWidth="330.0"/>
|
|
||||||
<Label fx:id="us" layoutX="108.0" layoutY="75.0" prefHeight="24.0" prefWidth="330.0" text="US:"/>
|
|
||||||
<Label fx:id="jp" layoutX="108.0" layoutY="107.0" prefHeight="24.0" prefWidth="330.0" text="JP:"/>
|
|
||||||
<Label fx:id="uk" layoutX="108.0" layoutY="142.0" prefHeight="24.0" prefWidth="330.0" text="UK:"/>
|
|
||||||
<Label layoutX="67.0" layoutY="77.0" text="US"/>
|
|
||||||
<Label layoutX="69.0" layoutY="109.0" text="JP"/>
|
|
||||||
<Label layoutX="66.0" layoutY="144.0" text="UK"/>
|
|
||||||
</children>
|
|
||||||
</fx:root>
|
|
||||||
106
src/main/resources/bindDemo/bindDemo.fxml
Normal file
106
src/main/resources/bindDemo/bindDemo.fxml
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.control.Button?>
|
||||||
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.control.PasswordField?>
|
||||||
|
<?import javafx.scene.control.Tab?>
|
||||||
|
<?import javafx.scene.control.TabPane?>
|
||||||
|
<?import javafx.scene.control.TextField?>
|
||||||
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
|
<?import javafx.scene.layout.HBox?>
|
||||||
|
<?import javafx.scene.layout.Pane?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
<?import javafx.scene.text.Font?>
|
||||||
|
<?import javafx.scene.text.Text?>
|
||||||
|
|
||||||
|
<fx:root prefHeight="600.0" prefWidth="800.0" type="Pane" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cn.edu.scau.biubiusuisui.example.bindDemo.MainController">
|
||||||
|
<children>
|
||||||
|
<TabPane prefHeight="600.0" prefWidth="800.0">
|
||||||
|
<tabs>
|
||||||
|
<Tab text="View&View">
|
||||||
|
<content>
|
||||||
|
<Pane prefHeight="200.0" prefWidth="200.0">
|
||||||
|
<children>
|
||||||
|
<TextField fx:id="inputTF" layoutX="250.0" layoutY="105.0" promptText="请输入" />
|
||||||
|
<Text layoutX="204.0" layoutY="123.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Name: " />
|
||||||
|
<Label fx:id="inputLabel" layoutX="457.0" layoutY="109.0" prefHeight="150.0" prefWidth="289.0" wrapText="true">
|
||||||
|
<font>
|
||||||
|
<Font size="16.0" />
|
||||||
|
</font>
|
||||||
|
</Label>
|
||||||
|
</children>
|
||||||
|
</Pane>
|
||||||
|
</content>
|
||||||
|
</Tab>
|
||||||
|
<Tab text="VIew&Bean">
|
||||||
|
<content>
|
||||||
|
<Pane prefHeight="200.0" prefWidth="200.0">
|
||||||
|
<children>
|
||||||
|
<VBox layoutX="47.0" layoutY="154.0" prefHeight="143.0" prefWidth="353.0">
|
||||||
|
<children>
|
||||||
|
<HBox alignment="CENTER" prefHeight="60.0" prefWidth="800.0">
|
||||||
|
<children>
|
||||||
|
<Label prefWidth="40.0" text="用户名" />
|
||||||
|
<TextField fx:id="usernameTF" />
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
|
<HBox alignment="CENTER" prefHeight="60.0" prefWidth="800.0">
|
||||||
|
<children>
|
||||||
|
<Label prefWidth="40.0" text="密码" />
|
||||||
|
<PasswordField fx:id="pswPF" />
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
|
</children>
|
||||||
|
</VBox>
|
||||||
|
<VBox layoutX="381.0" layoutY="124.0" prefHeight="203.0" prefWidth="353.0">
|
||||||
|
<children>
|
||||||
|
<Label alignment="CENTER" prefHeight="26.0" prefWidth="359.0" text="输入的用户信息" textAlignment="CENTER">
|
||||||
|
<font>
|
||||||
|
<Font size="20.0" />
|
||||||
|
</font>
|
||||||
|
</Label>
|
||||||
|
<HBox alignment="CENTER_LEFT" prefHeight="60.0" prefWidth="800.0">
|
||||||
|
<children>
|
||||||
|
<Label prefWidth="60.0" text="用户名:" />
|
||||||
|
<Label fx:id="usernameLabel" />
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
|
<HBox alignment="CENTER_LEFT" prefHeight="60.0" prefWidth="800.0">
|
||||||
|
<children>
|
||||||
|
<Label prefWidth="60.0" text="密码:" />
|
||||||
|
<Label fx:id="userPswLabel" />
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
|
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||||
|
<children>
|
||||||
|
<Button mnemonicParsing="false" onAction="#clickToShowInfo" text="点击显示" />
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
|
</children>
|
||||||
|
</VBox>
|
||||||
|
</children></Pane>
|
||||||
|
</content>
|
||||||
|
</Tab>
|
||||||
|
<Tab text="Expression2View">
|
||||||
|
<content>
|
||||||
|
<AnchorPane>
|
||||||
|
<children>
|
||||||
|
<Pane layoutX="128.0" layoutY="118.0">
|
||||||
|
<children>
|
||||||
|
<TextField fx:id="money" layoutX="54.0" layoutY="29.0" prefHeight="28.0" prefWidth="330.0" />
|
||||||
|
<Label fx:id="us" layoutX="108.0" layoutY="75.0" prefHeight="24.0" prefWidth="330.0" text="US:" />
|
||||||
|
<Label fx:id="jp" layoutX="108.0" layoutY="107.0" prefHeight="24.0" prefWidth="330.0" text="JP:" />
|
||||||
|
<Label fx:id="uk" layoutX="108.0" layoutY="142.0" prefHeight="24.0" prefWidth="330.0" text="UK:" />
|
||||||
|
<Label layoutX="67.0" layoutY="77.0" text="US" />
|
||||||
|
<Label layoutX="69.0" layoutY="109.0" text="JP" />
|
||||||
|
<Label layoutX="66.0" layoutY="144.0" text="UK" />
|
||||||
|
</children>
|
||||||
|
</Pane>
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
|
</content>
|
||||||
|
</Tab>
|
||||||
|
</tabs>
|
||||||
|
</TabPane>
|
||||||
|
</children>
|
||||||
|
</fx:root>
|
||||||
@@ -1,9 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.control.PasswordField?>
|
||||||
|
<?import javafx.scene.control.TextField?>
|
||||||
|
<?import javafx.scene.layout.HBox?>
|
||||||
|
<?import javafx.scene.layout.Pane?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<fx:root maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0"
|
<fx:root maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0"
|
||||||
prefWidth="800.0" type="Pane" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1"
|
prefWidth="800.0" type="Pane" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1"
|
||||||
fx:controller="cn.edu.scau.biubiusuisui.example.redirectDemo.LoginController">
|
fx:controller="cn.edu.scau.biubiusuisui.example.redirectDemo.LoginController">
|
||||||
@@ -38,11 +44,12 @@
|
|||||||
</HBox>
|
</HBox>
|
||||||
<HBox alignment="CENTER_RIGHT" prefHeight="50.0" prefWidth="200.0">
|
<HBox alignment="CENTER_RIGHT" prefHeight="50.0" prefWidth="200.0">
|
||||||
<children>
|
<children>
|
||||||
<Button mnemonicParsing="false" onAction="#redirectToDialog" text="测试弹窗的按钮">
|
<VBox alignment="TOP_RIGHT" prefHeight="54.0" prefWidth="167.0" spacing="10.0">
|
||||||
<HBox.margin>
|
<children>
|
||||||
<Insets right="20.0"/>
|
<Button mnemonicParsing="false" onAction="#redirectToSuccess" text="登录"/>
|
||||||
</HBox.margin>
|
<Button mnemonicParsing="false" onAction="#redirectToDialog" text="测试弹窗的按钮"/>
|
||||||
</Button>
|
</children>
|
||||||
|
</VBox>
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
</children>
|
</children>
|
||||||
|
|||||||
17
src/main/resources/resizableDemo/resizableDemo.fxml
Normal file
17
src/main/resources/resizableDemo/resizableDemo.fxml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.control.Button?>
|
||||||
|
<?import javafx.scene.layout.Pane?>
|
||||||
|
<?import javafx.scene.text.Font?>
|
||||||
|
<?import javafx.scene.text.Text?>
|
||||||
|
|
||||||
|
<fx:root maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" type="Pane" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
|
||||||
|
<children>
|
||||||
|
<Text layoutX="121.0" layoutY="188.0" strokeType="OUTSIDE" strokeWidth="0.0" text="这是隐藏标题的窗口">
|
||||||
|
<font>
|
||||||
|
<Font size="40.0" />
|
||||||
|
</font>
|
||||||
|
</Text>
|
||||||
|
<Button layoutX="573.0" layoutY="1.0" onMouseClicked="#closeWindowClick" style="-fx-background-color: transparent; ">X</Button>
|
||||||
|
</children>
|
||||||
|
</fx:root>
|
||||||
Reference in New Issue
Block a user