创建工具箱窗口,优化代码
This commit is contained in:
parent
fe3f0d40a4
commit
8c3bf899ae
|
@ -74,7 +74,9 @@ public class MainWindow extends Application {
|
||||||
// 设置窗口透明
|
// 设置窗口透明
|
||||||
stage.initStyle(StageStyle.TRANSPARENT);
|
stage.initStyle(StageStyle.TRANSPARENT);
|
||||||
// 将窗口显示出来
|
// 将窗口显示出来
|
||||||
stage.show();
|
// stage.show();
|
||||||
|
|
||||||
|
new ToolsWindow().show();
|
||||||
} catch (
|
} catch (
|
||||||
IOException e) {
|
IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class SettingWindow extends Application {
|
||||||
// 加载FXML文件
|
// 加载FXML文件
|
||||||
FXMLLoader fxmlLoader = new FXMLLoader(SettingWindow.class.getResource("fxml/settingWindow.fxml"));
|
FXMLLoader fxmlLoader = new FXMLLoader(SettingWindow.class.getResource("fxml/settingWindow.fxml"));
|
||||||
Scene scene = new Scene(fxmlLoader.load());
|
Scene scene = new Scene(fxmlLoader.load());
|
||||||
// 场景填充白色背景
|
// 场景填充透明背景
|
||||||
scene.setFill(Paint.valueOf("#00000000"));
|
scene.setFill(Paint.valueOf("#00000000"));
|
||||||
// 设置场景
|
// 设置场景
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package org.rococy.roomit;
|
||||||
|
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.stage.Modality;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工具箱
|
||||||
|
*
|
||||||
|
* @author Rococy
|
||||||
|
* @date 2022/10/6
|
||||||
|
*/
|
||||||
|
public class ToolsWindow extends Application {
|
||||||
|
|
||||||
|
private final Stage stage = new Stage();
|
||||||
|
|
||||||
|
{
|
||||||
|
// 设置标题
|
||||||
|
stage.setTitle("Roomit-工具箱");
|
||||||
|
// 居中
|
||||||
|
stage.centerOnScreen();
|
||||||
|
// 只有一个x的任务栏
|
||||||
|
stage.setResizable(false);
|
||||||
|
stage.initModality(Modality.APPLICATION_MODAL);
|
||||||
|
// 置顶
|
||||||
|
stage.setAlwaysOnTop(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage stage) throws IOException {
|
||||||
|
// 加载FXML文件
|
||||||
|
FXMLLoader fxmlLoader = new FXMLLoader(SettingWindow.class.getResource("fxml/toolsWindow.fxml"));
|
||||||
|
Scene scene = new Scene(fxmlLoader.load());
|
||||||
|
// 设置场景
|
||||||
|
stage.setScene(scene);
|
||||||
|
// 将窗口显示出来
|
||||||
|
stage.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void show() {
|
||||||
|
try {
|
||||||
|
start(stage);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ import javafx.scene.Parent;
|
||||||
import javafx.scene.input.MouseEvent;
|
import javafx.scene.input.MouseEvent;
|
||||||
import javafx.scene.shape.Ellipse;
|
import javafx.scene.shape.Ellipse;
|
||||||
import org.rococy.roomit.config.ConfigurationManager;
|
import org.rococy.roomit.config.ConfigurationManager;
|
||||||
|
import org.rococy.roomit.constant.GlobalConsts;
|
||||||
import org.rococy.roomit.control.base.Resizer;
|
import org.rococy.roomit.control.base.Resizer;
|
||||||
import org.rococy.roomit.domain.EllipseConfiguration;
|
import org.rococy.roomit.domain.EllipseConfiguration;
|
||||||
import org.rococy.roomit.util.ReactStyleMap;
|
import org.rococy.roomit.util.ReactStyleMap;
|
||||||
|
@ -20,7 +21,6 @@ public class ResizableEllipseWrapper extends Resizer {
|
||||||
*/
|
*/
|
||||||
private static final int BORDER_WIDTH = 3;
|
private static final int BORDER_WIDTH = 3;
|
||||||
private static final double BORDER_RADIUS = 1;
|
private static final double BORDER_RADIUS = 1;
|
||||||
private static final String BORDER_COLOR = "linear-gradient(to bottom, #f64f5988, #c471ed88, #12c2e988);";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 内部椭圆
|
* 内部椭圆
|
||||||
|
@ -47,7 +47,7 @@ public class ResizableEllipseWrapper extends Resizer {
|
||||||
// 设置样式
|
// 设置样式
|
||||||
styleMap.addStyle("-fx-border-width", BORDER_WIDTH);
|
styleMap.addStyle("-fx-border-width", BORDER_WIDTH);
|
||||||
styleMap.addStyle("-fx-border-style", "solid");
|
styleMap.addStyle("-fx-border-style", "solid");
|
||||||
styleMap.addStyle("-fx-border-color", BORDER_COLOR);
|
styleMap.addStyle("-fx-border-color", GlobalConsts.THEME_COLOR);
|
||||||
styleMap.addReactStyle("-fx-border-radius", BORDER_RADIUS);
|
styleMap.addReactStyle("-fx-border-radius", BORDER_RADIUS);
|
||||||
|
|
||||||
// 添加内椭圆
|
// 添加内椭圆
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package org.rococy.roomit.controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Rococy
|
||||||
|
* @date 2022/10/6
|
||||||
|
*/
|
||||||
|
public class ToolsWindowController {
|
||||||
|
|
||||||
|
}
|
|
@ -2,15 +2,15 @@
|
||||||
"shape": {
|
"shape": {
|
||||||
"brush": {
|
"brush": {
|
||||||
"transparent": false,
|
"transparent": false,
|
||||||
"strokeColor": "#ffffffff",
|
"strokeColor": "linear-gradient(to bottom, #f64f59, #c471ed, #12c2e9)",
|
||||||
"lineWidth": 4.0
|
"lineWidth": 4.0
|
||||||
},
|
},
|
||||||
"rectangle": {
|
"rectangle": {
|
||||||
"borderColor": "#ff0000ff",
|
"borderColor": "linear-gradient(to bottom, #f64f59, #c471ed, #12c2e9)",
|
||||||
"borderWidth": 5.0
|
"borderWidth": 5.0
|
||||||
},
|
},
|
||||||
"ellipse": {
|
"ellipse": {
|
||||||
"borderColor": "#ff0000ff",
|
"borderColor": "linear-gradient(to bottom, #f64f59, #c471ed, #12c2e9)",
|
||||||
"borderWidth": 5.0
|
"borderWidth": 5.0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
|
<AnchorPane xmlns="http://javafx.com/javafx"
|
||||||
|
xmlns:fx="http://javafx.com/fxml"
|
||||||
|
fx:controller="org.rococy.roomit.controller.ToolsWindowController">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
brush
|
||||||
|
rectangle
|
||||||
|
ellipse
|
||||||
|
tools
|
||||||
|
colorPicker
|
||||||
|
expendMouse
|
||||||
|
clear
|
||||||
|
screenshotAndCopy
|
||||||
|
openOrClose
|
||||||
|
-->
|
||||||
|
|
||||||
|
</AnchorPane>
|
Loading…
Reference in New Issue