mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2025-01-19 00:26:27 +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.scene.control.*;
|
||||
import main.protocol.HConnection;
|
||||
import main.protocol.HMessage;
|
||||
import main.protocol.TrafficListener;
|
||||
import main.ui.SubForm;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -38,6 +40,18 @@ public class Connection extends SubForm {
|
||||
cbx_autodetect.selectedProperty().addListener(observable -> {
|
||||
inpPort.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");
|
||||
@ -65,7 +79,7 @@ public class Connection extends SubForm {
|
||||
|
||||
if (newState == HConnection.State.CONNECTED) {
|
||||
lblState.setText("Connected");
|
||||
outHost.setText(getHConnection().getHost());
|
||||
outHost.setText(getHConnection().getDomain());
|
||||
outPort.setText(getHConnection().getPort()+"");
|
||||
}
|
||||
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());
|
||||
}
|
||||
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();
|
||||
}
|
||||
if (newState == HConnection.State.NOT_CONNECTED) {
|
||||
|
@ -126,7 +126,7 @@
|
||||
<Insets />
|
||||
</GridPane.margin>
|
||||
<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>
|
||||
<Insets bottom="7.0" left="5.0" right="5.0" top="7.0" />
|
||||
</GridPane.margin>
|
||||
@ -136,7 +136,7 @@
|
||||
<Insets bottom="7.0" left="7.0" right="5.0" top="7.0" />
|
||||
</GridPane.margin>
|
||||
</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>
|
||||
<Insets bottom="7.0" left="5.0" right="5.0" top="7.0" />
|
||||
</GridPane.margin>
|
||||
|
@ -32,6 +32,27 @@ public class Tools extends SubForm {
|
||||
//TODO: toExpression() without bytelength limit for this use only
|
||||
|
||||
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 -> {
|
||||
boolean isInt = true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user