mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2025-01-31 12:52:36 +01:00
UI fully responsive again
This commit is contained in:
parent
77134c0cdc
commit
1629bf3cfe
@ -9,6 +9,8 @@ import javafx.event.EventHandler;
|
|||||||
import javafx.event.EventType;
|
import javafx.event.EventType;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import main.protocol.HConnection;
|
import main.protocol.HConnection;
|
||||||
|
import main.protocol.HMessage;
|
||||||
|
import main.protocol.TrafficListener;
|
||||||
import main.ui.SubForm;
|
import main.ui.SubForm;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -38,6 +40,18 @@ public class Connection extends SubForm {
|
|||||||
cbx_autodetect.selectedProperty().addListener(observable -> {
|
cbx_autodetect.selectedProperty().addListener(observable -> {
|
||||||
inpPort.setDisable(cbx_autodetect.isSelected());
|
inpPort.setDisable(cbx_autodetect.isSelected());
|
||||||
inpHost.setDisable(cbx_autodetect.isSelected());
|
inpHost.setDisable(cbx_autodetect.isSelected());
|
||||||
|
if (cbx_autodetect.isSelected()) {
|
||||||
|
btnConnect.setDisable(false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
int i = Integer.parseInt(inpPort.getEditor().getText());
|
||||||
|
btnConnect.setDisable(i < 0 || i >= 256 * 256);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
btnConnect.setDisable(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
inpPort.getItems().addAll("30000", "38101");
|
inpPort.getItems().addAll("30000", "38101");
|
||||||
@ -65,7 +79,7 @@ public class Connection extends SubForm {
|
|||||||
|
|
||||||
if (newState == HConnection.State.CONNECTED) {
|
if (newState == HConnection.State.CONNECTED) {
|
||||||
lblState.setText("Connected");
|
lblState.setText("Connected");
|
||||||
outHost.setText(getHConnection().getHost());
|
outHost.setText(getHConnection().getDomain());
|
||||||
outPort.setText(getHConnection().getPort()+"");
|
outPort.setText(getHConnection().getPort()+"");
|
||||||
}
|
}
|
||||||
if (newState == HConnection.State.WAITING_FOR_CLIENT) {
|
if (newState == HConnection.State.WAITING_FOR_CLIENT) {
|
||||||
|
@ -42,7 +42,7 @@ public class Logger extends SubForm {
|
|||||||
miniLogText(Color.ORANGE, "Connecting to "+getHConnection().getDomain() + ":" + getHConnection().getPort());
|
miniLogText(Color.ORANGE, "Connecting to "+getHConnection().getDomain() + ":" + getHConnection().getPort());
|
||||||
}
|
}
|
||||||
if (newState == HConnection.State.CONNECTED) {
|
if (newState == HConnection.State.CONNECTED) {
|
||||||
miniLogText(Color.GREEN, "Connecting to "+getHConnection().getDomain() + ":" + getHConnection().getPort());
|
miniLogText(Color.GREEN, "Connected to "+getHConnection().getDomain() + ":" + getHConnection().getPort());
|
||||||
packetLogger.start();
|
packetLogger.start();
|
||||||
}
|
}
|
||||||
if (newState == HConnection.State.NOT_CONNECTED) {
|
if (newState == HConnection.State.NOT_CONNECTED) {
|
||||||
|
@ -126,7 +126,7 @@
|
|||||||
<Insets />
|
<Insets />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
<children>
|
<children>
|
||||||
<Button fx:id="btn_toExpr" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#btn_toExpr_clicked" text="------>" GridPane.columnIndex="1" GridPane.halignment="CENTER">
|
<Button fx:id="btn_toExpr" disable="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#btn_toExpr_clicked" text="------>" GridPane.columnIndex="1" GridPane.halignment="CENTER">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="7.0" left="5.0" right="5.0" top="7.0" />
|
<Insets bottom="7.0" left="5.0" right="5.0" top="7.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
@ -136,7 +136,7 @@
|
|||||||
<Insets bottom="7.0" left="7.0" right="5.0" top="7.0" />
|
<Insets bottom="7.0" left="7.0" right="5.0" top="7.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</TextArea>
|
</TextArea>
|
||||||
<Button fx:id="btn_toPacket" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#btn_toPacket_clicked" text="<------" GridPane.columnIndex="2" GridPane.halignment="CENTER">
|
<Button fx:id="btn_toPacket" disable="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#btn_toPacket_clicked" text="<------" GridPane.columnIndex="2" GridPane.halignment="CENTER">
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="7.0" left="5.0" right="5.0" top="7.0" />
|
<Insets bottom="7.0" left="5.0" right="5.0" top="7.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
|
@ -32,6 +32,27 @@ public class Tools extends SubForm {
|
|||||||
//TODO: toExpression() without bytelength limit for this use only
|
//TODO: toExpression() without bytelength limit for this use only
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
txt_packetArea.textProperty().addListener(observable -> {
|
||||||
|
btn_toExpr.setDisable(new HPacket(txt_packetArea.getText()).isCorrupted());
|
||||||
|
});
|
||||||
|
|
||||||
|
txt_packetArea.setOnKeyPressed(event -> {
|
||||||
|
if(event.getCode().equals(KeyCode.ENTER) && !btn_toExpr.isDisable()) {
|
||||||
|
btn_toExpr_clicked(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
txt_exprArea.textProperty().addListener(observable -> {
|
||||||
|
btn_toPacket.setDisable(new HPacket(txt_exprArea.getText()).isCorrupted());
|
||||||
|
});
|
||||||
|
|
||||||
|
txt_exprArea.setOnKeyPressed(event -> {
|
||||||
|
if(event.getCode().equals(KeyCode.ENTER) && !btn_toPacket.isDisable()) {
|
||||||
|
btn_toPacket_clicked(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
txt_intDecoded.textProperty().addListener(observable -> {
|
txt_intDecoded.textProperty().addListener(observable -> {
|
||||||
boolean isInt = true;
|
boolean isInt = true;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user