修正resizable的bug

This commit is contained in:
yangsuiyu
2020-04-05 22:43:29 +08:00
parent 5e60991bda
commit 119436dc3b
25 changed files with 388 additions and 165 deletions

View File

@@ -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`.
```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).
![输入图片说明](README.en/moveable.gif "moveable.gif")
```java
@FXWindow(title = "demo1",resizable = true,style = StageStyle.UNDECORATED) // resizable
```
![输入图片说明](README.en/resizeAble.gif "resizeAble.gif")
@@ -388,8 +392,8 @@ private Label us;
As code shown follows, we implemented a simple exchange rate converter
```java
@FXController(path = "actionDemo/actionDemo.fxml")
@FXWindow(title = "actionDemo", mainStage = true)
@FXController(path = "bindDemo/bindDemo.fxml")
@FXWindow(title = "bindDemo", mainStage = true)
public class MainController extends FXBaseController implements Initializable {
@FXML
@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
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 MiB

BIN
README.en/draggable_en.gif Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 MiB

View File

@@ -76,13 +76,11 @@
## Maven仓库地址
```xml
<dependency>
<groupId>com.gitee.Biubiuyuyu</groupId>
<artifactId>javafx-plus</artifactId>
<version>1.0.0-RELEASE</version>
</dependency>
```
## 具体应用
可见 [下载器](https://gitee.com/Biubiuyuyu/JavaFX-Demo 'Demo')
@@ -320,18 +318,25 @@ public class Student {
### 可拔插功能
在本框架中实现了窗口可拖动和窗口可伸缩在Javafx中如果一个窗口隐藏了标题栏那么这个窗口也就没办法拖动和伸缩了在JavaFX-Plus中你就不需有这种烦恼只需要在@FXWindow中设置
在本框架中实现了窗口可拖动和窗口可伸缩在Javafx中如果一个窗口隐藏了标题栏那么这个窗口也就没办法拖动和伸缩了在JavaFX-Plus中你就不需有这种烦恼只需要在@FXWindow中设置
```java
@FXWindow(title = "demo1",dragable = true,style = StageStyle.UNDECORATED)
@FXWindow(title = "demo1",dragable = true,style = StageStyle.UNDECORATED) // 可拖动
```
就可以让这个没有标题的窗口可以被拖动而且能拉伸(默认打开,可以关闭)
![输入图片说明](README/moveable.gif "moveable.gif")
```java
@FXWindow(title = "demo1",resizable = true,style = StageStyle.UNDECORATED) // 可缩放
```
![输入图片说明](README/resizeAble.gif "resizeAble.gif")
### 数据绑定
与之相关的注解有`@FXBind`注解在JavaFX控件的字段上面标明该变量的绑定方式和绑定属性类似于Vue中的界面绑定。目前已实现Bean和View的绑定、View和View的绑定、函数表达式的绑定
@@ -351,6 +356,8 @@ public class Student {
Student student = new Student();
@FXML
private TestField usr;
@FXML
private PasswordField psw;
@FXML
@@ -380,6 +387,9 @@ public class Student {
@FXBind("text=${psw.text}")
@FXML
private Label pswMsg;//任何psw中的内容都会同步到pswMsg中
@FXML
private PasswordField psw;
```
如图所示
![输入图片说明](README/expressionV2V.gif "expressionV2V.gif")
@@ -404,8 +414,8 @@ private Label us;
如以下代码,实现简单的汇率转换器。
```java
@FXController(path = "actionDemo/actionDemo.fxml")
@FXWindow(title = "actionDemo", mainStage = true)
@FXController(path = "bindDemo/bindDemo.fxml")
@FXWindow(title = "bindDemo", mainStage = true)
public class MainController extends FXBaseController implements Initializable {
@FXML
@FXBind("text=${@toUs(time.text)}") // 将Label中的text和toUs()函数的返回值绑定

BIN
README/Resizable.gif Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 MiB

BIN
README/draggable.gif Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 MiB

View File

@@ -30,6 +30,7 @@
</distributionManagement>
<dependencies>
<!-- 第三方动态代理库-->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>

View File

@@ -7,6 +7,7 @@ import cn.edu.scau.biubiusuisui.factory.FXBuilder;
import cn.edu.scau.biubiusuisui.factory.FXControllerFactory;
import cn.edu.scau.biubiusuisui.function.FXWindowParser;
import cn.edu.scau.biubiusuisui.utils.ClassUtils;
import javafx.application.Application;
import java.lang.annotation.Annotation;
import java.util.HashSet;

View File

@@ -5,16 +5,24 @@ import javafx.beans.property.Property;
/**
* 将Controller中的JavaFX的field包装成FXFieldWrapper
*
* @Author jack
* @Date:2019/6/28 10:03
*/
public class FXFieldWrapper {
private FXField fxField;
private Class type;
private Property property;
private Class type;
public FXFieldWrapper() {
}
public FXFieldWrapper(FXField fxField, Class type) {
this.fxField = fxField;
this.type = type;
}
public Class getType() {
return type;

View File

@@ -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.config.FXPlusApplication;
@@ -9,10 +9,10 @@ import javafx.stage.Stage;
* @Author jack
* @Date:2019/7/27 1:43
*/
@FXScan(base = "cn.edu.scau.biubiusuisui.example.actionDemo")
public class Demo extends Application {
@FXScan(base = "cn.edu.scau.biubiusuisui.example.bindDemo")
public class BindDemo extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
FXPlusApplication.start(Demo.class);
FXPlusApplication.start(BindDemo.class);
}
}

View File

@@ -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.FXController;
import cn.edu.scau.biubiusuisui.annotation.FXData;
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
import javafx.beans.value.ChangeListener;
@@ -9,6 +10,7 @@ import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import java.net.URL;
@@ -18,23 +20,58 @@ import java.util.ResourceBundle;
* @Author jack
* @Date:2019/7/27 1:43
*/
@FXController(path = "actionDemo/actionDemo.fxml")
@FXWindow(title = "actionDemo", mainStage = true)
@FXController(path = "bindDemo/bindDemo.fxml")
@FXWindow(title = "bindDemo", mainStage = true)
public class MainController extends FXBaseController implements Initializable {
// View bind to View
@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;
@FXML
@FXBind("text=${@toJp(time.text)}")
@FXBind("text=${@toJp(money.text)}")
private Label jp;
@FXML
@FXBind("text=${@toUk(time.text)}")
@FXBind("text=${@toUk(money.text)}")
private Label uk;
@FXML
private TextField time;
public void clickToShowInfo() {
usernameLabel.setText(user.getName());
userPswLabel.setText(user.getPassword());
}
public String toUs(String value) {
double money = Double.valueOf(value);
@@ -56,14 +93,14 @@ public class MainController extends FXBaseController implements Initializable {
@Override
public void initialize(URL location, ResourceBundle resources) {
time.setText("0");
time.textProperty().addListener(new ChangeListener<String>() {
money.setText("0");
money.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if (null == newValue || "".equals(newValue)) {
time.setText("0");
money.setText("0");
} else if (!newValue.matches("^[0-9]*$")) {
time.setText(oldValue);
money.setText(oldValue);
}
}
});

View File

@@ -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.FXField;

View File

@@ -47,7 +47,7 @@ public class MainController extends FXBaseController implements Initializable {
@Override
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");
list.itemsProperty().bind(listProperty);
}

View File

@@ -26,7 +26,6 @@ public class LoginController extends FXBaseController {
@FXML
public void registerClick() {
System.out.println("点击注册.....");
redirectToRegister();
}
@@ -40,4 +39,11 @@ public class LoginController extends FXBaseController {
public String redirectToDialog() {
return "DialogController";
}
@FXML
@FXRedirect //登录成功
public String redirectToSuccess() {
return "SuccessController";
}
}

View File

@@ -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);
}
}

View File

@@ -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();
}
}

View File

@@ -30,7 +30,7 @@ public class FXControllerFactory {
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();
Scene scene = new Scene(fxBaseControllerProxy, preWidth, preHeight);
stage.setScene(scene);
windowAnnotationParser.parse(stage, fxBaseControllerProxy, fxWindow);
fxWindowAnnotationParser.parse(stage, fxBaseControllerProxy, fxWindow);
StageManager.getInstance().registerWindow(fxBaseControllerProxy); //注册舞台
if (fxWindow.mainStage() == true) { //当是主舞台时先show为敬
@@ -252,7 +252,7 @@ public class FXControllerFactory {
//建立代理
try {
Object fieldValue = field.get(fxControllerObject);
Object fieldValueProxy = FXEntityFactory.wrapFxBean(fieldValue);
Object fieldValueProxy = FXEntityFactory.wrapFXBean(fieldValue);
field.set(fxControllerObject, fieldValueProxy);
} catch (IllegalAccessException e) {
e.printStackTrace();

View File

@@ -23,26 +23,26 @@ public class FXEntityFactory {
private FXEntityFactory() {
}
public static Object wrapFxBean(Class clazz) {
return wrapFxBean(clazz, new FXBuilder());
public static Object wrapFXBean(Class clazz) {
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 = beanBuilder.getBean(clazz);
if (object != null) {
return wrapFxBean(object);
return wrapFXBean(object);
} else {
return null;
}
}
public static Object wrapFxBean(Object object) {
public static Object wrapFXBean(Object object) {
FXEntityProxy fxEntityProxy = new FXEntityProxy();
Object objectProxy = null;
try {
objectProxy = fxEntityProxy.getInstance(object); // 初始化代理类
processFXEntityProxy(object, objectProxy, fxEntityProxy);
processFXEntityProxyFields(object, objectProxy, fxEntityProxy); //处理FXEntity上的@FXField
FXPlusContext.setProxyByBeanObject(objectProxy, fxEntityProxy);
} catch (IllegalAccessException e) {
e.printStackTrace();
@@ -50,7 +50,7 @@ public class FXEntityFactory {
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<>();
Field[] fields = entity.getClass().getDeclaredFields();
for (Field field : fields) {
@@ -59,9 +59,7 @@ public class FXEntityFactory {
Property property = null;
field.setAccessible(true);
FXField fxField = (FXField) annotation;
FXFieldWrapper fieldWrapper = new FXFieldWrapper();
fieldWrapper.setFxField(fxField);
fieldWrapper.setType(field.getType());
FXFieldWrapper fieldWrapper = new FXFieldWrapper(fxField, field.getType());
if (field.get(entity) == null) {
property = getFieldDefaultProperty(field);
} else {
@@ -136,6 +134,4 @@ public class FXEntityFactory {
}
return property;
}
}

View File

@@ -3,7 +3,6 @@ package cn.edu.scau.biubiusuisui.function;
import javafx.event.EventHandler;
import javafx.scene.Cursor;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
@@ -25,43 +24,44 @@ public class DragWindowHandlerImpl implements EventHandler<MouseEvent> {
boolean isBottomRight;// 是否处于右下角调整窗口状态
boolean isBottom;// 是否处于下边界调整窗口状态
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.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.MIN_WIDTH = MIN_WIDTH;
this.MIN_HEIGHT = MIN_HEIGHT;
this.pane = pane;
this.fix = fix;
this.draggable = draggable;
this.resizable = resizable;
}
@Override
public void handle(MouseEvent e) {
if (e.getEventType() == MouseEvent.MOUSE_PRESSED) { //鼠标按下的事件
//鼠标按下时记录坐标
this.oldStageX = this.stage.getX();
this.oldStageY = this.stage.getY();
this.oldScreenX = e.getScreenX();
this.oldScreenY = e.getScreenY();
} else if (e.getEventType() == MouseEvent.MOUSE_DRAGGED) { //鼠标拖动的事件
//
double nextX = stage.getX();
double nextY = stage.getY();
double nextWidth = stage.getWidth();
double nextHeight = stage.getHeight();
if(!fix) {
double x = e.getSceneX();
double y = e.getSceneY();
// 保存窗口改变后的x、y坐标和宽度、高度用于预判是否会小于最小宽度、最小高度
if (isRight || isBottomRight) {// 所有右边调整窗口状态
nextWidth = x;
}
@@ -74,20 +74,22 @@ public class DragWindowHandlerImpl implements EventHandler<MouseEvent> {
if (nextHeight <= MIN_HEIGHT) {// 如果窗口改变后的高度小于最小高度,则高度调整到最小高度
nextHeight = MIN_HEIGHT;
}
}
// 最后统一改变窗口的x、y坐标和宽度、高度可以防止刷新频繁出现的屏闪情况
if (draggable) {
if (isBottom || isBottomRight || isRight) {
stage.setX(nextX);
stage.setY(nextY);
stage.setWidth(nextWidth);
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) {
if(!fix) {
}
if (resizable) {
stage.setWidth(nextWidth);
stage.setHeight(nextHeight);
}
} else if (e.getEventType() == MouseEvent.MOUSE_MOVED) { //鼠标移动
e.consume();
double x = e.getSceneX();
double y = e.getSceneY();
@@ -96,6 +98,8 @@ public class DragWindowHandlerImpl implements EventHandler<MouseEvent> {
Cursor cursorType = Cursor.DEFAULT;// 鼠标光标初始为默认类型,若未进入调整窗口状态,保持默认类型
// 先将所有调整窗口状态重置
isRight = isBottomRight = isBottom = false;
if (resizable) {
if (y >= height - RESIZE_WIDTH) {
if (x <= RESIZE_WIDTH) {// 左下角调整窗口状态
@@ -111,7 +115,6 @@ public class DragWindowHandlerImpl implements EventHandler<MouseEvent> {
cursorType = Cursor.E_RESIZE;
}
// 最后改变鼠标光标
pane.setCursor(cursorType);
}
}

View File

@@ -16,16 +16,16 @@ public class FXWindowParser {
stage.setTitle(fxWindow.title());
if (fxWindow.resizable()) {
stage.setResizable(false);
stage.setResizable(true);
}
if (fxWindow.draggable()) {
final int RESIZE_WIDTH = 5;// 判定是否为调整窗口状态的范围与边界距离
EventHandler dragWindowHandler = new DragWindowHandlerImpl(stage, fxWindow.minWidth(), fxWindow.minHeight(), fxControllerProxy, fxWindow.resizable());
if (fxWindow.draggable() || fxWindow.resizable()) {
EventHandler dragWindowHandler = new DragWindowHandlerImpl(stage, fxWindow.minWidth(), fxWindow.minHeight(), fxControllerProxy, fxWindow.draggable(), fxWindow.resizable());
fxControllerProxy.setOnMousePressed(dragWindowHandler);
fxControllerProxy.setOnMouseDragged(dragWindowHandler);
fxControllerProxy.setOnMouseMoved(dragWindowHandler);
}
stage.initStyle(fxWindow.style());
}
}

View File

@@ -1,6 +1,6 @@
<?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.layout.Pane?>

View File

@@ -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>

View 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&amp;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&amp;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>

View File

@@ -1,9 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.control.Button?>
<?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?>
<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"
fx:controller="cn.edu.scau.biubiusuisui.example.redirectDemo.LoginController">
@@ -38,11 +44,12 @@
</HBox>
<HBox alignment="CENTER_RIGHT" prefHeight="50.0" prefWidth="200.0">
<children>
<Button mnemonicParsing="false" onAction="#redirectToDialog" text="测试弹窗的按钮">
<HBox.margin>
<Insets right="20.0"/>
</HBox.margin>
</Button>
<VBox alignment="TOP_RIGHT" prefHeight="54.0" prefWidth="167.0" spacing="10.0">
<children>
<Button mnemonicParsing="false" onAction="#redirectToSuccess" text="登录"/>
<Button mnemonicParsing="false" onAction="#redirectToDialog" text="测试弹窗的按钮"/>
</children>
</VBox>
</children>
</HBox>
</children>

View 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>