mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-17 15:57:18 -04:00
Merge pull request #622 from Lenni0451/javafx
Added autoscroll and fixed typo
This commit is contained in:
commit
cef9f0b2bb
@ -17,12 +17,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.jackhuang.hmcl.ui;
|
package org.jackhuang.hmcl.ui;
|
||||||
|
|
||||||
|
import com.jfoenix.controls.JFXCheckBox;
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.beans.property.ReadOnlyIntegerProperty;
|
import javafx.beans.property.ReadOnlyIntegerProperty;
|
||||||
import javafx.beans.property.ReadOnlyIntegerWrapper;
|
import javafx.beans.property.ReadOnlyIntegerWrapper;
|
||||||
import javafx.concurrent.Worker;
|
import javafx.concurrent.Worker;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.control.ComboBox;
|
import javafx.scene.control.ComboBox;
|
||||||
import javafx.scene.control.ToggleButton;
|
import javafx.scene.control.ToggleButton;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
@ -122,7 +124,8 @@ public final class LogWindow extends Stage {
|
|||||||
pre.setTextContent(line);
|
pre.setTextContent(line);
|
||||||
div.appendChild(pre);
|
div.appendChild(pre);
|
||||||
impl.body.appendChild(div);
|
impl.body.appendChild(div);
|
||||||
impl.engine.executeScript("checkNewLog(\"" + level.name().toLowerCase() + "\");scrollToBottom();");
|
//impl.engine.executeScript("checkNewLog(\"" + level.name().toLowerCase() + "\");scrollToBottom();");
|
||||||
|
impl.engine.executeScript("checkNewLog(\"" + level.name().toLowerCase() + "\");" + (impl.autoscroll.isSelected() ? "scrollToBottom();" : ""));
|
||||||
|
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case FATAL:
|
case FATAL:
|
||||||
@ -166,6 +169,8 @@ public final class LogWindow extends Stage {
|
|||||||
private ToggleButton btnDebugs;
|
private ToggleButton btnDebugs;
|
||||||
@FXML
|
@FXML
|
||||||
private ComboBox<String> cboLines;
|
private ComboBox<String> cboLines;
|
||||||
|
@FXML
|
||||||
|
private CheckBox autoscroll;
|
||||||
|
|
||||||
final WebEngine engine;
|
final WebEngine engine;
|
||||||
Node body;
|
Node body;
|
||||||
|
@ -1,20 +1,24 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import com.jfoenix.controls.JFXButton?>
|
<?import com.jfoenix.controls.JFXButton?>
|
||||||
|
<?import com.jfoenix.controls.JFXCheckBox?>
|
||||||
<?import com.jfoenix.controls.JFXComboBox?>
|
<?import com.jfoenix.controls.JFXComboBox?>
|
||||||
<?import javafx.collections.FXCollections?>
|
|
||||||
<?import javafx.scene.control.*?>
|
|
||||||
<?import javafx.scene.layout.*?>
|
|
||||||
<?import javafx.scene.web.WebView?>
|
|
||||||
<?import java.lang.String?>
|
<?import java.lang.String?>
|
||||||
<fx:root xmlns="http://javafx.com/javafx"
|
<?import javafx.collections.FXCollections?>
|
||||||
xmlns:fx="http://javafx.com/fxml"
|
<?import javafx.scene.control.Label?>
|
||||||
type="StackPane"
|
<?import javafx.scene.control.ToggleButton?>
|
||||||
style="-fx-background-color: white; -fx-padding: 3 0 3 0;">
|
<?import javafx.scene.control.ToggleGroup?>
|
||||||
|
<?import javafx.scene.layout.BorderPane?>
|
||||||
|
<?import javafx.scene.layout.HBox?>
|
||||||
|
<?import javafx.scene.layout.StackPane?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
<?import javafx.scene.web.WebView?>
|
||||||
|
|
||||||
|
<fx:root style="-fx-background-color: white; -fx-padding: 3 0 3 0;" type="StackPane" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
|
||||||
<VBox spacing="3">
|
<VBox spacing="3">
|
||||||
<BorderPane style="-fx-padding: 0 3 0 3;">
|
<BorderPane style="-fx-padding: 0 3 0 3;">
|
||||||
<left>
|
<left>
|
||||||
<HBox alignment="CENTER_LEFT" style="-fx-padding: 0 0 0 4;" spacing="3">
|
<HBox alignment="CENTER_LEFT" spacing="3" style="-fx-padding: 0 0 0 4;">
|
||||||
<Label text="%logwindow.show_lines" />
|
<Label text="%logwindow.show_lines" />
|
||||||
<JFXComboBox fx:id="cboLines">
|
<JFXComboBox fx:id="cboLines">
|
||||||
<items>
|
<items>
|
||||||
@ -29,19 +33,19 @@
|
|||||||
</left>
|
</left>
|
||||||
<right>
|
<right>
|
||||||
<HBox spacing="3">
|
<HBox spacing="3">
|
||||||
<ToggleButton styleClass="log-toggle" style="-fx-background-color: #F7A699;" fx:id="btnFatals" text="0 fatals" selected="true">
|
<ToggleButton fx:id="btnFatals" selected="true" style="-fx-background-color: #F7A699;" styleClass="log-toggle" text="0 fatals">
|
||||||
<toggleGroup><ToggleGroup /></toggleGroup>
|
<toggleGroup><ToggleGroup /></toggleGroup>
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
<ToggleButton styleClass="log-toggle" style="-fx-background-color: #FFCCBB;" fx:id="btnErrors" text="0 errors" selected="true">
|
<ToggleButton fx:id="btnErrors" selected="true" style="-fx-background-color: #FFCCBB;" styleClass="log-toggle" text="0 errors">
|
||||||
<toggleGroup><ToggleGroup /></toggleGroup>
|
<toggleGroup><ToggleGroup /></toggleGroup>
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
<ToggleButton styleClass="log-toggle" style="-fx-background-color: #FFEECC;" fx:id="btnWarns" text="0 warns" selected="true">
|
<ToggleButton fx:id="btnWarns" selected="true" style="-fx-background-color: #FFEECC;" styleClass="log-toggle" text="0 warns">
|
||||||
<toggleGroup><ToggleGroup /></toggleGroup>
|
<toggleGroup><ToggleGroup /></toggleGroup>
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
<ToggleButton styleClass="log-toggle" style="-fx-background-color: #FBFBFB;" fx:id="btnInfos" text="0 infos" selected="true">
|
<ToggleButton fx:id="btnInfos" selected="true" style="-fx-background-color: #FBFBFB;" styleClass="log-toggle" text="0 infos">
|
||||||
<toggleGroup><ToggleGroup /></toggleGroup>
|
<toggleGroup><ToggleGroup /></toggleGroup>
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
<ToggleButton styleClass="log-toggle" style="-fx-background-color: #EEE9E0;" fx:id="btnDebugs" text="0 debugs" selected="true">
|
<ToggleButton fx:id="btnDebugs" selected="true" style="-fx-background-color: #EEE9E0;" styleClass="log-toggle" text="0 debugs">
|
||||||
<toggleGroup><ToggleGroup /></toggleGroup>
|
<toggleGroup><ToggleGroup /></toggleGroup>
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
</HBox>
|
</HBox>
|
||||||
@ -50,7 +54,8 @@
|
|||||||
<StackPane style="-fx-border: 1 0 1 0; -fx-border-color: #dddddd;" VBox.vgrow="ALWAYS">
|
<StackPane style="-fx-border: 1 0 1 0; -fx-border-color: #dddddd;" VBox.vgrow="ALWAYS">
|
||||||
<WebView fx:id="webView" />
|
<WebView fx:id="webView" />
|
||||||
</StackPane>
|
</StackPane>
|
||||||
<HBox alignment="CENTER_RIGHT" style="-fx-padding: 0 3 0 3;" spacing="3">
|
<HBox alignment="CENTER_RIGHT" spacing="3" style="-fx-padding: 0 3 0 3;">
|
||||||
|
<JFXCheckBox fx:id="autoscroll" selected="true" text="%logwindow.autoscroll" />
|
||||||
<JFXButton onMouseClicked="#onTerminateGame" text="%logwindow.terminate_game" />
|
<JFXButton onMouseClicked="#onTerminateGame" text="%logwindow.terminate_game" />
|
||||||
<JFXButton onMouseClicked="#onClear" text="%button.clear" />
|
<JFXButton onMouseClicked="#onClear" text="%button.clear" />
|
||||||
</HBox>
|
</HBox>
|
||||||
|
@ -180,7 +180,7 @@ launch.state.dependencies=Dependencies
|
|||||||
launch.state.done=Done
|
launch.state.done=Done
|
||||||
launch.state.logging_in=Logging In
|
launch.state.logging_in=Logging In
|
||||||
launch.state.modpack=Loading modpack
|
launch.state.modpack=Loading modpack
|
||||||
launch.state.waiting_launching=Launcing modpack
|
launch.state.waiting_launching=Launching modpack
|
||||||
launch.wrong_javadir=Invalid Java directory, default Java path will be applied.
|
launch.wrong_javadir=Invalid Java directory, default Java path will be applied.
|
||||||
|
|
||||||
launcher=Launcher
|
launcher=Launcher
|
||||||
@ -203,6 +203,7 @@ login.enter_password=Please enter your password.
|
|||||||
logwindow.show_lines=Show Lines
|
logwindow.show_lines=Show Lines
|
||||||
logwindow.terminate_game=Terminate Game
|
logwindow.terminate_game=Terminate Game
|
||||||
logwindow.title=Log
|
logwindow.title=Log
|
||||||
|
logwindow.autoscroll=Autoscroll
|
||||||
|
|
||||||
main_page=Home
|
main_page=Home
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user