[FEUTURE] Сделал консоль в одном окне

This commit is contained in:
Alex Dev Sm 2019-06-17 16:04:28 +03:00
parent 5231939302
commit f0c6c75b14
3 changed files with 27 additions and 37 deletions

View file

@ -121,16 +121,10 @@ function initConsoleScene() {
if(movePoint === null) { if(movePoint === null) {
return; return;
} }
consoleStage.setX(event.getScreenX() - movePoint.getX());
consoleStage.setY(event.getScreenY() - movePoint.getY());
}); });
var pane = consoleMenu.lookup("#bar"); var pane = consoleMenu.lookup("#bar");
consoleBar = pane; consoleBar = pane;
pane.lookup("#close").setOnAction(function(){
consoleStage.hide();
});
var text = consoleMenu.lookup("#textField"); var text = consoleMenu.lookup("#textField");
var output = consoleMenu.lookup("#output"); var output = consoleMenu.lookup("#output");
var appendFunction = function(line) javafx.application.Platform.runLater(function() output.appendText(line)); var appendFunction = function(line) javafx.application.Platform.runLater(function() output.appendText(line));
@ -141,7 +135,11 @@ function initConsoleScene() {
FunctionalBridge.addPlainOutput(function(string) { FunctionalBridge.addPlainOutput(function(string) {
appendFunction(string+"\n"); appendFunction(string+"\n");
}) })
pane.lookup("#hide").setOnAction(function(event) { consoleStage.setIconified(true) }); pane.lookup("#close").setOnAction(function(event){ javafx.application.Platform.exit()});
pane.lookup("#hide").setOnAction(function(event){ stage.setIconified(true)});
pane.lookup("#back").setOnAction(function(){
setCurrentScene(menuScene);
});
var pane = consoleMenu.lookup("#consolePane"); var pane = consoleMenu.lookup("#consolePane");
consolePane = pane; consolePane = pane;
@ -223,7 +221,7 @@ function goAuth(event) {
/* ======== Console ======== */ /* ======== Console ======== */
function goConsole(event) { function goConsole(event) {
setConsoleCurrentScene(consoleScene); setCurrentScene(consoleScene);
} }
/* ======== Settings ======== */ /* ======== Settings ======== */

View file

@ -11,24 +11,27 @@
<!-- DrLeonardo Design --> <!-- DrLeonardo Design -->
<Pane fx:id="background" prefWidth="738.0" xmlns="http://javafx.com/javafx/8.0.201" xmlns:fx="http://javafx.com/fxml/1"> <Pane prefHeight="450.0" prefWidth="740.0" xmlns="http://javafx.com/javafx/8.0.201" xmlns:fx="http://javafx.com/fxml/1">
<children> <children>
<Pane fx:id="bar" layoutX="692.0" prefHeight="425.0" prefWidth="43.0" styleClass="bar"> <Pane fx:id="bar" layoutX="694.0" prefHeight="425.0" prefWidth="43.0" styleClass="bar">
<children> <children>
<JFXButton id="hide" alignment="CENTER" contentDisplay="CENTER" layoutY="45.0" ripplerFill="#646464" <JFXButton id="hide" alignment="CENTER" contentDisplay="CENTER" layoutY="45.0" ripplerFill="#646464" text="" textAlignment="CENTER">
text="" textAlignment="CENTER"> <graphic>
<graphic> <MaterialDesignIconView fill="WHITE" glyphName="MINUS" size="30" textAlignment="CENTER" />
<MaterialDesignIconView fill="WHITE" glyphName="MINUS" size="30" textAlignment="CENTER"/> </graphic>
</graphic> </JFXButton>
</JFXButton> <JFXButton id="close" alignment="CENTER" contentDisplay="CENTER" ripplerFill="#fb8c8c" text="" textAlignment="CENTER">
<JFXButton id="close" alignment="CENTER" contentDisplay="CENTER" ripplerFill="#fb8c8c" text="" <graphic>
textAlignment="CENTER"> <MaterialDesignIconView fill="WHITE" glyphName="CLOSE" size="30" textAlignment="CENTER" />
<graphic> </graphic>
<MaterialDesignIconView fill="WHITE" glyphName="CLOSE" size="30" textAlignment="CENTER"/> </JFXButton>
</graphic> <JFXButton id="back" alignment="CENTER" contentDisplay="CENTER" layoutY="405.0" ripplerFill="#646464" text="" textAlignment="CENTER">
</JFXButton> <graphic>
</children> <MaterialDesignIconView fill="WHITE" glyphName="CHEVRON_LEFT" size="30" textAlignment="CENTER" />
</Pane> </graphic>
</JFXButton>
</children>
</Pane>
<JFXTextArea fx:id="output" focusColor="#d8d8d8" prefHeight="419.0" prefWidth="692.0" unFocusColor="#ffffff00"> <JFXTextArea fx:id="output" focusColor="#d8d8d8" prefHeight="419.0" prefWidth="692.0" unFocusColor="#ffffff00">
<padding> <padding>
<Insets left="10.0" top="10.0"/> <Insets left="10.0" top="10.0"/>

View file

@ -1,4 +1,4 @@
var app, stage, scene, loginScene, menuScene, consoleScene, consoleStage, optionsScene; var app, stage, scene, loginScene, menuScene, consoleScene, optionsScene;
var rootPane, loginPane, menuPane, consoleMenu, optionsMenu; var rootPane, loginPane, menuPane, consoleMenu, optionsMenu;
var LauncherApp = Java.extend(JSApplication, { var LauncherApp = Java.extend(JSApplication, {
@ -15,11 +15,6 @@ var LauncherApp = Java.extend(JSApplication, {
stage.setResizable(false); stage.setResizable(false);
stage.setTitle(config.title); stage.setTitle(config.title);
consoleStage = new javafx.stage.Stage();
consoleStage.initStyle(javafx.stage.StageStyle.TRANSPARENT);
consoleStage.setResizable(false);
consoleStage.setTitle(config.title);
config.icons.forEach(function(icon) { config.icons.forEach(function(icon) {
var iconURL = Launcher.getResourceURL(icon).toString(); var iconURL = Launcher.getResourceURL(icon).toString();
stage.getIcons().add(new javafx.scene.image.Image(iconURL)); stage.getIcons().add(new javafx.scene.image.Image(iconURL));
@ -66,12 +61,6 @@ function setCurrentScene(scene) {
stage.show(); stage.show();
} }
function setConsoleCurrentScene(scene) {
consoleStage.setScene(scene);
consoleStage.sizeToScene();
consoleStage.show();
}
function setRootParent(parent) { function setRootParent(parent) {
scene.setRoot(parent); scene.setRoot(parent);