支持动态修改窗口标题setWindowTitle、窗口图标setIcon、窗口可拖拽拖放setDragAndResize的接口
This commit is contained in:
@@ -70,8 +70,6 @@ The framework is not the framework for beautifying UI, but to simplify the step
|
||||
|
||||
### The Process of Developing
|
||||
|
||||
Our project has suspended update from Nov. 25, 2019, and the next release will be updated to 2.0. We try to provides more data binding operations and optimize performance.
|
||||
|
||||
- [x] Modularization
|
||||
- [x] Integration with Spring
|
||||
- [x] Signal Mechanism
|
||||
|
||||
@@ -70,8 +70,6 @@
|
||||
|
||||

|
||||
### 开发进程
|
||||
2019年11月25日起项目暂停更新,将会下次发布将会升级为2.0版本,到时候将会提供更多数据绑定操作,以及优化性能。
|
||||
|
||||
- [x] 模块化
|
||||
- [x] 与Spring的融合
|
||||
- [x] 信号机制
|
||||
@@ -1331,6 +1329,10 @@ public class Student {
|
||||
4. 完善JavaFX-Plus生命周期
|
||||
5. 新增日志log模块
|
||||
6. 新增语言国际化操作
|
||||
7. 新增测试生命周期LifeDemo示例和测试国际化的LanguageDemo示例代码
|
||||
7. 新增测试生命周期LifeDemo示例和测试国际化的LangDemo示例代码
|
||||
8. 规范化代码和更新README
|
||||
|
||||
## v1.3.0 TODO
|
||||
|
||||
1. 开放动态修改窗口标题setWindowTitles、窗口图标setIcon、窗口可拖拽缩放setDragAndResize的接口
|
||||
|
||||
|
||||
@@ -4,13 +4,19 @@ import cn.edu.scau.biubiusuisui.annotation.FXController;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXWindow;
|
||||
import cn.edu.scau.biubiusuisui.config.FXMLLoaderPlus;
|
||||
import cn.edu.scau.biubiusuisui.config.FXPlusApplication;
|
||||
import cn.edu.scau.biubiusuisui.exception.ProtocolNotSupport;
|
||||
import cn.edu.scau.biubiusuisui.function.DragWindowHandlerImpl;
|
||||
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
|
||||
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
|
||||
import cn.edu.scau.biubiusuisui.utils.FileUtil;
|
||||
import cn.edu.scau.biubiusuisui.utils.ResourceBundleUtil;
|
||||
import cn.edu.scau.biubiusuisui.utils.StringUtil;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.net.URL;
|
||||
@@ -19,7 +25,7 @@ import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* In JavaFX-Plus Framework Controller
|
||||
* We use MVC model
|
||||
* V means view which stand for fxml
|
||||
@@ -36,7 +42,7 @@ import java.util.ResourceBundle;
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
public class FXBaseController extends Pane {
|
||||
private static IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(FXBaseController.class);
|
||||
private static final IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(FXBaseController.class);
|
||||
|
||||
protected String name = "";
|
||||
private Stage stage;
|
||||
@@ -45,7 +51,8 @@ public class FXBaseController extends Pane {
|
||||
|
||||
|
||||
/**
|
||||
* @description 用于携带信息数据
|
||||
* <p>description 用于携带信息数据</p>
|
||||
*
|
||||
* @version 1.2
|
||||
*/
|
||||
private Map<String, Object> query = new HashMap<>();
|
||||
@@ -69,7 +76,7 @@ public class FXBaseController extends Pane {
|
||||
// 添加赋予是否为窗口的逻辑
|
||||
if (annotation.annotationType().equals(FXWindow.class)) {
|
||||
fxWindow = (FXWindow) annotation;
|
||||
isWindow = true;
|
||||
this.isWindow = true;
|
||||
}
|
||||
}
|
||||
//load fxml file to show panel in scene builder
|
||||
@@ -173,13 +180,16 @@ public class FXBaseController extends Pane {
|
||||
* 唤起舞台
|
||||
*/
|
||||
public void showStage() {
|
||||
if (isWindow) {
|
||||
if (this.isWindow) {
|
||||
this.stage.show();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示并等待
|
||||
*/
|
||||
public void showAndWait() {
|
||||
if (isWindow) {
|
||||
if (this.isWindow) {
|
||||
this.stage.showAndWait();
|
||||
}
|
||||
}
|
||||
@@ -188,7 +198,7 @@ public class FXBaseController extends Pane {
|
||||
* 关闭舞台
|
||||
*/
|
||||
public void closeStage() {
|
||||
if (isWindow) {
|
||||
if (this.isWindow) {
|
||||
this.stage.close();
|
||||
}
|
||||
}
|
||||
@@ -198,11 +208,75 @@ public class FXBaseController extends Pane {
|
||||
* @version 1.2
|
||||
*/
|
||||
public void hideStage() {
|
||||
if (isWindow) {
|
||||
if (this.isWindow) {
|
||||
this.stage.setIconified(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>description: 开放设置窗口标题 </p>
|
||||
*
|
||||
* @param title 标题
|
||||
* @return true--修改标题成功 false--修改失败
|
||||
* @version 1.3
|
||||
*/
|
||||
public final void setWindowTitle(String title) {
|
||||
if (this.isWindow) {
|
||||
this.stage.setTitle(title);
|
||||
logger.info("setting title of window");
|
||||
} else {
|
||||
logger.warn("the controller is not window");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>description: 开放设置窗口图标</p>
|
||||
*
|
||||
* @param icon String 图标URL地址,需要放在resources文件下或项目根目录下
|
||||
*/
|
||||
public final void setIcon(String icon) {
|
||||
if (this.isWindow) {
|
||||
if (!"".equals(icon)) {
|
||||
try {
|
||||
URL iconUrl = new FileUtil().getFilePathFromResources(icon);
|
||||
if (iconUrl != null) {
|
||||
if (new File(StringUtil.getRootPath(iconUrl)).exists()) {
|
||||
this.stage.getIcons().clear();
|
||||
this.stage.getIcons().add(new Image(icon));
|
||||
} else {
|
||||
logger.warn("the icon file has not existed");
|
||||
}
|
||||
} else {
|
||||
logger.warn("the icon file has not existed");
|
||||
}
|
||||
} catch (ProtocolNotSupport protocolNotSupport) {
|
||||
logger.error(protocolNotSupport.getMessage(), protocolNotSupport);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Description 开放是否允许窗口可拖拽和缩放的接口</p>
|
||||
*
|
||||
* @param draggable 可拖拽
|
||||
* @param resizable 可缩放
|
||||
*/
|
||||
public final void setDragAndResize(boolean draggable, boolean resizable) {
|
||||
this.stage.setResizable(resizable);
|
||||
if (draggable || resizable) {
|
||||
EventHandler dragWindowHandler = new DragWindowHandlerImpl(stage, this, draggable, resizable);
|
||||
this.setOnMousePressed(dragWindowHandler);
|
||||
this.setOnMouseDragged(dragWindowHandler);
|
||||
this.setOnMouseMoved(dragWindowHandler);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Controller名字
|
||||
*
|
||||
* @return name
|
||||
*/
|
||||
public String getName() {
|
||||
if ("".equals(name) || name == null) { // 原本无“name == null”判断条件,会出错
|
||||
return StringUtil.getBaseClassName(getClass().getSimpleName());
|
||||
@@ -224,11 +298,11 @@ public class FXBaseController extends Pane {
|
||||
}
|
||||
|
||||
public boolean isWindow() {
|
||||
return isWindow;
|
||||
return this.isWindow;
|
||||
}
|
||||
|
||||
public void setWindow(boolean window) {
|
||||
isWindow = window;
|
||||
this.isWindow = window;
|
||||
}
|
||||
|
||||
public Stage getStage() {
|
||||
|
||||
@@ -17,6 +17,9 @@ import javafx.fxml.FXML;
|
||||
@FXWindow(mainStage = true, title = "languageDemo")
|
||||
@FXController(path = "fxml/langDemo/langDemo.fxml", locale = FXPlusLocale.SIMPLIFIED_CHINESE)
|
||||
public class ChineseController extends FXBaseController {
|
||||
private String title = "languageDemo";
|
||||
private int count = 0;
|
||||
|
||||
@FXML
|
||||
public void clickToChinese() {
|
||||
redirect("ChineseController");
|
||||
@@ -32,8 +35,18 @@ public class ChineseController extends FXBaseController {
|
||||
redirect("KoreanController");
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试是否setWindowTitle接口
|
||||
*/
|
||||
@FXML
|
||||
public void changeTitleClick() {
|
||||
this.setWindowTitle(this.title + count);
|
||||
count++;
|
||||
}
|
||||
|
||||
@FXRedirect
|
||||
public String redirect(String name) {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@ import javafx.fxml.FXML;
|
||||
@FXWindow(mainStage = false, title = "languageDemo")
|
||||
@FXController(path = "fxml/langDemo/langDemo.fxml", locale = FXPlusLocale.ENGLISH)
|
||||
public class EnglishController extends FXBaseController {
|
||||
private String title = "languageDemo";
|
||||
private int count = 0;
|
||||
|
||||
@FXML
|
||||
public void clickToChinese() {
|
||||
redirect("ChineseController");
|
||||
@@ -31,6 +34,15 @@ public class EnglishController extends FXBaseController {
|
||||
redirect("KoreanController");
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试是否setWindowTitle接口
|
||||
*/
|
||||
@FXML
|
||||
public void changeTitleClick() {
|
||||
this.setWindowTitle(this.title + count);
|
||||
count++;
|
||||
}
|
||||
|
||||
@FXRedirect
|
||||
public String redirect(String name) {
|
||||
return name;
|
||||
|
||||
@@ -16,6 +16,9 @@ import javafx.fxml.FXML;
|
||||
@FXWindow(mainStage = false, title = "languageDemo")
|
||||
@FXController(path = "fxml/langDemo/langDemo.fxml", locale = FXPlusLocale.KOREAN)
|
||||
public class KoreanController extends FXBaseController {
|
||||
private String title = "languageDemo";
|
||||
private int count = 0;
|
||||
|
||||
@FXML
|
||||
public void clickToChinese() {
|
||||
redirect("ChineseController");
|
||||
@@ -31,6 +34,16 @@ public class KoreanController extends FXBaseController {
|
||||
redirect("KoreanController");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试是否setWindowTitle接口
|
||||
*/
|
||||
@FXML
|
||||
public void changeTitleClick() {
|
||||
this.setWindowTitle(this.title + count);
|
||||
count++;
|
||||
}
|
||||
|
||||
@FXRedirect
|
||||
public String redirect(String name) {
|
||||
return name;
|
||||
|
||||
@@ -17,4 +17,5 @@ public class LanguageDemo extends Application {
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
FXPlusApplication.start(getClass());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import cn.edu.scau.biubiusuisui.entity.FXPlusLocale;
|
||||
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
|
||||
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.input.Clipboard;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package cn.edu.scau.biubiusuisui.example.windowDemo;
|
||||
|
||||
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.scene.control.ToggleButton;
|
||||
import javafx.stage.StageStyle;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @description 测试Controller
|
||||
* @date 2020/8/29 09:41
|
||||
* @since JDK1.8
|
||||
*/
|
||||
@FXWindow(mainStage = true, title = "windowDemo", icon = "image/icon.png", style = StageStyle.UNDECORATED)
|
||||
@FXController(path = "fxml/windowDemo/windowDemo.fxml")
|
||||
public class DemoController extends FXBaseController {
|
||||
private String title = "windowDemo -- ";
|
||||
private int count = 0;
|
||||
private String iconStr = "image/icon2.png";
|
||||
private String iconStr2 = "image/icon3.png";
|
||||
|
||||
|
||||
@FXML
|
||||
private ToggleButton canResizableTB;
|
||||
|
||||
@Override
|
||||
public void initialize() throws Exception {
|
||||
canResizableTB.selectedProperty().addListener(e -> {
|
||||
this.setDragAndResize(true, canResizableTB.isSelected());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改标题点击事件
|
||||
*/
|
||||
@FXML
|
||||
public void changeTitleClick() {
|
||||
this.setWindowTitle(title + count);
|
||||
count++;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串修改图标
|
||||
*/
|
||||
@FXML
|
||||
public void changeIconClick() {
|
||||
this.setIcon(count % 2 == 0 ? iconStr : iconStr2);
|
||||
count++;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.edu.scau.biubiusuisui.example.windowDemo;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXScan;
|
||||
import cn.edu.scau.biubiusuisui.config.FXPlusApplication;
|
||||
import javafx.application.Application;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @description 测试开放设置部分FXWindow属性的接口
|
||||
* @date 2020/8/29 09:40
|
||||
* @since JDK1.8
|
||||
*/
|
||||
@FXScan(base = "cn.edu.scau.biubiusuisui.example.windowDemo")
|
||||
public class FXWindowDemo extends Application {
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
FXPlusApplication.start(FXWindowDemo.class);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import cn.edu.scau.biubiusuisui.expression.data.ExpressionParser;
|
||||
import cn.edu.scau.biubiusuisui.function.FXWindowParser;
|
||||
import cn.edu.scau.biubiusuisui.log.FXPlusLoggerFactory;
|
||||
import cn.edu.scau.biubiusuisui.log.IFXPlusLogger;
|
||||
import cn.edu.scau.biubiusuisui.messageQueue.MessageQueue;
|
||||
import cn.edu.scau.biubiusuisui.mq.MessageQueue;
|
||||
import cn.edu.scau.biubiusuisui.proxy.FXControllerProxy;
|
||||
import cn.edu.scau.biubiusuisui.stage.StageManager;
|
||||
import cn.edu.scau.biubiusuisui.utils.ResourceBundleUtil;
|
||||
@@ -168,7 +168,7 @@ public class FXControllerFactory {
|
||||
* @Description 为有FXWindow注解的类创建Stage
|
||||
*/
|
||||
private static Stage createWindow(FXWindow fxWindow, Class clazz, FXBaseController fxBaseControllerProxy) {
|
||||
logger.info("creating window");
|
||||
logger.info("creating window.....");
|
||||
Stage stage = new Stage();
|
||||
fxBaseControllerProxy.setStage(stage);
|
||||
double preWidth = fxWindow.preWidth() == 0 ? fxBaseControllerProxy.getPrefWidth() : fxWindow.preWidth();
|
||||
|
||||
@@ -6,6 +6,6 @@ package cn.edu.scau.biubiusuisui.function;
|
||||
* @date 2019/7/27 1:54
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
public interface Draggale {
|
||||
public interface Draggable {
|
||||
|
||||
}
|
||||
@@ -22,44 +22,28 @@ import java.net.URL;
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
public class FXWindowParser {
|
||||
private static IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(FXWindowParser.class);
|
||||
private static final IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(FXWindowParser.class);
|
||||
|
||||
public void parse(Stage stage, FXBaseController fxControllerProxy, FXWindow fxWindow) {
|
||||
logger.info("parsing @FXWindow of class: " + fxControllerProxy.getName());
|
||||
|
||||
// 处理 title
|
||||
stage.setTitle(fxWindow.title());
|
||||
fxControllerProxy.setWindowTitle(fxWindow.title());
|
||||
|
||||
// 处理 icon
|
||||
if (!"".equals(fxWindow.icon())) {
|
||||
try {
|
||||
URL iconUrl = new FileUtil().getFilePathFromResources(fxWindow.icon());
|
||||
if (iconUrl != null) {
|
||||
if (new File(StringUtil.getRootPath(iconUrl)).exists()) {
|
||||
stage.getIcons().add(new Image(fxWindow.icon()));
|
||||
} else {
|
||||
logger.warn("the icon file has not existed");
|
||||
}
|
||||
} else {
|
||||
logger.warn("the icon file has not existed");
|
||||
}
|
||||
} catch (ProtocolNotSupport protocolNotSupport) {
|
||||
logger.error(protocolNotSupport.getMessage(), protocolNotSupport);
|
||||
protocolNotSupport.printStackTrace();
|
||||
}
|
||||
fxControllerProxy.setIcon(fxWindow.icon());
|
||||
|
||||
// 处理draggable和resizable
|
||||
if (fxWindow.draggable() || fxWindow.resizable()) {
|
||||
fxControllerProxy.setDragAndResize(fxWindow.draggable(), fxWindow.resizable());
|
||||
}
|
||||
|
||||
// fxWindow的resizable默认为false
|
||||
if (fxWindow.resizable()) {
|
||||
stage.setResizable(true);
|
||||
fxControllerProxy.setDragAndResize(fxWindow.draggable(), true);
|
||||
}
|
||||
|
||||
// 处理draggable和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);
|
||||
}
|
||||
|
||||
// 处理style
|
||||
stage.initStyle(fxWindow.style());
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package cn.edu.scau.biubiusuisui.messageQueue;
|
||||
package cn.edu.scau.biubiusuisui.mq;
|
||||
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXReceiver;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
@@ -20,9 +20,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* @date 2019/6/25 12:24
|
||||
* @since JavaFX2.0 JDK1.8
|
||||
*/
|
||||
|
||||
public class MessageQueue {
|
||||
private IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(MessageQueue.class);
|
||||
private static final IFXPlusLogger logger = FXPlusLoggerFactory.getLogger(MessageQueue.class);
|
||||
|
||||
private static Map<String, List<FXMethodEntity>> receivers = new ConcurrentHashMap<>(); //Map<主题,订阅了主题的所有方法>
|
||||
|
||||
@@ -31,6 +30,11 @@ public class MessageQueue {
|
||||
private MessageQueue() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取mq单例
|
||||
*
|
||||
* @return MessageQueue
|
||||
*/
|
||||
public static synchronized MessageQueue getInstance() {
|
||||
if (messageQueue == null) {
|
||||
messageQueue = new MessageQueue();
|
||||
@@ -39,9 +43,9 @@ public class MessageQueue {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fxBaseController
|
||||
* @param fxBaseControllerProxy
|
||||
* @Description 注册消费者,即FXReceiver注解的method
|
||||
* @param fxBaseController 基础controller
|
||||
* @param fxBaseControllerProxy 基础controller代理
|
||||
* @description 注册消费者,即FXReceiver注解的method
|
||||
*/
|
||||
public void registerConsumer(FXBaseController fxBaseController, FXBaseController fxBaseControllerProxy) {
|
||||
Class clazz = fxBaseController.getClass();
|
||||
@@ -51,7 +55,6 @@ public class MessageQueue {
|
||||
for (Annotation annotation : annotations) {
|
||||
if (FXReceiver.class.equals(annotation.annotationType())) {
|
||||
logger.info("registering consumer: " + fxBaseControllerProxy.getName());
|
||||
// System.out.println("FXReceiver");
|
||||
FXReceiver receiver = (FXReceiver) annotation;
|
||||
FXMethodEntity fxMethodEntity = new FXMethodEntity(fxBaseControllerProxy, method);
|
||||
List<FXMethodEntity> fxMethodEntities = receivers.get(receiver.name());
|
||||
@@ -66,9 +69,9 @@ public class MessageQueue {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param msg
|
||||
* @Description 处理消息发送,id为topic,msg为消息
|
||||
* @param id 消息topic
|
||||
* @param msg 消息内容
|
||||
* @description 处理消息发送
|
||||
*/
|
||||
public void sendMsg(String id, Object msg) {
|
||||
List<FXMethodEntity> lists = receivers.get(id);
|
||||
@@ -80,23 +83,15 @@ public class MessageQueue {
|
||||
if (method.getParameterCount() == 0) {
|
||||
try {
|
||||
method.invoke(fxBaseController);
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
logger.error(e.getMessage());
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
logger.error(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
// obj the object the underlying method is invoked from
|
||||
// 调起FXReceiver注解的方法
|
||||
method.invoke(fxBaseController, msg);
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
logger.error(e.getMessage());
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
logger.error(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package cn.edu.scau.biubiusuisui.proxy;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXRedirect;
|
||||
import cn.edu.scau.biubiusuisui.annotation.FXSender;
|
||||
import cn.edu.scau.biubiusuisui.entity.FXBaseController;
|
||||
import cn.edu.scau.biubiusuisui.messageQueue.MessageQueue;
|
||||
import cn.edu.scau.biubiusuisui.mq.MessageQueue;
|
||||
import cn.edu.scau.biubiusuisui.stage.StageManager;
|
||||
import net.sf.cglib.proxy.Enhancer;
|
||||
import net.sf.cglib.proxy.MethodInterceptor;
|
||||
|
||||
@@ -18,7 +18,7 @@ public class FileUtil {
|
||||
|
||||
/**
|
||||
* @param filePath
|
||||
* @return
|
||||
* @return 返回URL
|
||||
* @throws ProtocolNotSupport
|
||||
* @decription 从resources文件夹中读取File
|
||||
* 输出如: file:/Users/suisui/workspace/Idea/JavaFX-Plus/target/classes/image/icon.png
|
||||
@@ -28,6 +28,7 @@ public class FileUtil {
|
||||
return FileUtil.class.getClassLoader().getResource(filePath);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param filePath
|
||||
* @return
|
||||
@@ -44,7 +45,7 @@ public class FileUtil {
|
||||
|
||||
/**
|
||||
* @param filePath 绝对路径或相对路径
|
||||
* @return
|
||||
* @return 返回文件内容
|
||||
* @description 读取文件
|
||||
*/
|
||||
public static String readFile(String filePath) {
|
||||
@@ -65,8 +66,8 @@ public class FileUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param filePath
|
||||
* @param content
|
||||
* @param filePath 写出文件的地址
|
||||
* @param content 文件内容
|
||||
* @description 写文件
|
||||
*/
|
||||
public static void writeFile(String filePath, String content) {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package cn.edu.scau.biubiusuisui.utils;
|
||||
|
||||
/**
|
||||
* @author suisui
|
||||
* @description 函数工具类
|
||||
* @date 2020/8/28 23:32
|
||||
* @since JDK1.8
|
||||
*/
|
||||
public class FunctionUtil {
|
||||
}
|
||||
@@ -58,6 +58,7 @@
|
||||
<Button mnemonicParsing="false" onAction="#clickToChinese" text="%chinese"/>
|
||||
<Button mnemonicParsing="false" onAction="#clickToEnglish" text="%english"/>
|
||||
<Button mnemonicParsing="false" onAction="#clickToKorean" text="%korean"/>
|
||||
<Button mnemonicParsing="false" onAction="#changeTitleClick" text="修改"/>
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
|
||||
19
src/main/resources/fxml/windowDemo/windowDemo.fxml
Normal file
19
src/main/resources/fxml/windowDemo/windowDemo.fxml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ToggleButton?>
|
||||
<?import javafx.scene.control.ToolBar?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
|
||||
<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>
|
||||
<ToolBar layoutY="276.0" prefHeight="124.0" prefWidth="600.0">
|
||||
<items>
|
||||
<Button mnemonicParsing="false" onAction="#changeTitleClick" text="修改标题"/>
|
||||
<Button mnemonicParsing="false" onAction="#changeIconClick" text="修改图标"/>
|
||||
<ToggleButton fx:id="canResizableTB" mnemonicParsing="false" text="是否允许窗口拖拽缩放"/>
|
||||
</items>
|
||||
</ToolBar>
|
||||
</children>
|
||||
</fx:root>
|
||||
@@ -0,0 +1 @@
|
||||
changeTitle
|
||||
BIN
src/main/resources/image/icon2.png
Normal file
BIN
src/main/resources/image/icon2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
src/main/resources/image/icon3.png
Normal file
BIN
src/main/resources/image/icon3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user