mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 10:15:52 +00:00
Wallet template: couple of misc tweaks
This commit is contained in:
parent
b9363999ae
commit
8b8266f9d6
@ -8,7 +8,6 @@ import javafx.animation.*;
|
|||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.ContextMenu;
|
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.ProgressBar;
|
import javafx.scene.control.ProgressBar;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
@ -19,9 +18,8 @@ import wallettemplate.controls.ClickableBitcoinAddress;
|
|||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
|
||||||
import static javafx.application.Platform.isFxApplicationThread;
|
|
||||||
import static wallettemplate.Main.bitcoin;
|
import static wallettemplate.Main.bitcoin;
|
||||||
|
import static wallettemplate.utils.GuiUtils.checkGuiThread;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets created auto-magically by FXMLLoader via reflection. The widget fields are set to the GUI controls they're named
|
* Gets created auto-magically by FXMLLoader via reflection. The widget fields are set to the GUI controls they're named
|
||||||
@ -32,7 +30,6 @@ public class Controller {
|
|||||||
public VBox syncBox;
|
public VBox syncBox;
|
||||||
public HBox controlsBox;
|
public HBox controlsBox;
|
||||||
public Label balance;
|
public Label balance;
|
||||||
public ContextMenu addressMenu;
|
|
||||||
public Button sendMoneyOutBtn;
|
public Button sendMoneyOutBtn;
|
||||||
public ClickableBitcoinAddress addressControl;
|
public ClickableBitcoinAddress addressControl;
|
||||||
|
|
||||||
@ -91,7 +88,7 @@ public class Controller {
|
|||||||
public class BalanceUpdater extends AbstractWalletEventListener {
|
public class BalanceUpdater extends AbstractWalletEventListener {
|
||||||
@Override
|
@Override
|
||||||
public void onWalletChanged(Wallet wallet) {
|
public void onWalletChanged(Wallet wallet) {
|
||||||
checkState(isFxApplicationThread());
|
checkGuiThread();
|
||||||
refreshBalanceLabel();
|
refreshBalanceLabel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,13 +18,13 @@ import java.util.function.BiConsumer;
|
|||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
|
|
||||||
public class GuiUtils {
|
public class GuiUtils {
|
||||||
private static void runAlert(BiConsumer<Stage, AlertWindowController> setup) {
|
public static void runAlert(BiConsumer<Stage, AlertWindowController> setup) {
|
||||||
try {
|
try {
|
||||||
// JavaFX2 doesn't actually have a standard alert template. Instead the Scene Builder app will create FXML
|
// JavaFX2 doesn't actually have a standard alert template. Instead the Scene Builder app will create FXML
|
||||||
// files for an alert window for you, and then you customise it as you see fit. I guess it makes sense in
|
// files for an alert window for you, and then you customise it as you see fit. I guess it makes sense in
|
||||||
// an odd sort of way.
|
// an odd sort of way.
|
||||||
Stage dialogStage = new Stage();
|
Stage dialogStage = new Stage();
|
||||||
dialogStage.initModality(Modality.WINDOW_MODAL);
|
dialogStage.initModality(Modality.APPLICATION_MODAL);
|
||||||
FXMLLoader loader = new FXMLLoader(GuiUtils.class.getResource("alert.fxml"));
|
FXMLLoader loader = new FXMLLoader(GuiUtils.class.getResource("alert.fxml"));
|
||||||
Pane pane = loader.load();
|
Pane pane = loader.load();
|
||||||
AlertWindowController controller = loader.getController();
|
AlertWindowController controller = loader.getController();
|
||||||
@ -40,7 +40,10 @@ public class GuiUtils {
|
|||||||
public static void crashAlert(Throwable t) {
|
public static void crashAlert(Throwable t) {
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
Throwable rootCause = Throwables.getRootCause(t);
|
Throwable rootCause = Throwables.getRootCause(t);
|
||||||
Runnable r = () -> runAlert((stage, controller) -> controller.crashAlert(stage, rootCause.toString()));
|
Runnable r = () -> {
|
||||||
|
runAlert((stage, controller) -> controller.crashAlert(stage, rootCause.toString()));
|
||||||
|
Platform.exit();
|
||||||
|
};
|
||||||
if (Platform.isFxApplicationThread())
|
if (Platform.isFxApplicationThread())
|
||||||
r.run();
|
r.run();
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user