From fff023969af2b50eb11623c1fb4fe302d123bd1f Mon Sep 17 00:00:00 2001
From: Luca Keidel <info@lucakeidel.de>
Date: Wed, 15 Jun 2016 01:13:03 +0200
Subject: [PATCH] Fixed exception when closing remote wallet and prettified FUC
 amount display

---
 src/main/java/fucoin/Main.java                |  6 +++---
 .../java/fucoin/gui/WalletGuiControlImpl.java | 19 +++++++++----------
 .../java/fucoin/wallet/AbstractWallet.java    |  4 +++-
 src/main/java/fucoin/wallet/WalletImpl.java   |  6 +-----
 4 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/src/main/java/fucoin/Main.java b/src/main/java/fucoin/Main.java
index 4cdd54c..892daeb 100644
--- a/src/main/java/fucoin/Main.java
+++ b/src/main/java/fucoin/Main.java
@@ -6,7 +6,6 @@ import akka.actor.Props;
 import com.typesafe.config.Config;
 import com.typesafe.config.ConfigFactory;
 import fucoin.actions.join.ActionJoinAnswer;
-import fucoin.actions.join.ServerActionJoin;
 import fucoin.supervisor.SuperVisorImpl;
 import fucoin.wallet.WalletImpl;
 
@@ -59,11 +58,12 @@ public class Main {
     private static void createWallets() {
         //Init Wallets
         for (int i = 0; i < numberOfWallets; i++) {
+
             String nameOfTheWallet = "Wallet" + String.valueOf(i);
-            //chain the wallets. wallet2 knows wallet1, wallet3 knows wallet2 and so on.
-            String nameOfThePreviousWallet = "";
             Props props;
+
             if (i > 0) {
+                //chain the wallets. wallet2 knows wallet1, wallet3 knows wallet2 and so on.
                 props = WalletImpl.props(cActiveActors.get(i - 1), nameOfTheWallet);
             } else {
                 props = WalletImpl.props(null, nameOfTheWallet);
diff --git a/src/main/java/fucoin/gui/WalletGuiControlImpl.java b/src/main/java/fucoin/gui/WalletGuiControlImpl.java
index dbc8651..0a001f0 100644
--- a/src/main/java/fucoin/gui/WalletGuiControlImpl.java
+++ b/src/main/java/fucoin/gui/WalletGuiControlImpl.java
@@ -16,9 +16,8 @@ public class WalletGuiControlImpl implements WalletGuiControl {
     private JPanel topPanel = new JPanel();
     private JLabel lblMyAddress = new JLabel("My Address:");
     private JTextField txtMyAddress = new JTextField("<MyAddress>");
-    private JLabel lblEmpty = new JLabel("");
-    private JLabel lblMyAmount = new JLabel("My FUCs:");
-    private JTextField txtMyAmount = new JTextField("<MyFUCs>");
+    private JLabel lblMyAmount = new JLabel("My FUCs: ");
+    private JLabel txtMyAmount = new JLabel(" <MyFUCs>");
     private JPanel centerPanel = new JPanel();
     private JLabel lblSendTo = new JLabel("Send to:");
     private JComboBox<String> txtSendTo = new JComboBox<>();
@@ -45,11 +44,12 @@ public class WalletGuiControlImpl implements WalletGuiControl {
         row1.add(txtMyAddress);
         topPanel.add(row1);
         // Row 2
-        JPanel row2 = new JPanel();
-        row2.setLayout(new GridLayout(1, 3));
+        JPanel row2 = new JPanel(new GridBagLayout());
+        Font fucFont = txtMyAmount.getFont().deriveFont(20f).deriveFont(Font.BOLD);
+        lblMyAmount.setFont(fucFont);
+        txtMyAmount.setFont(fucFont);
         row2.add(lblMyAmount);
         row2.add(txtMyAmount);
-        row2.add(lblEmpty);
         topPanel.add(row2);
         window.add(topPanel);
         //<hr>
@@ -69,8 +69,6 @@ public class WalletGuiControlImpl implements WalletGuiControl {
         addNewButton.addActionListener(e -> {
             ActorSelection selection = wallet.getContext().actorSelection(sendToNewEdt.getText());
             System.out.println(selection);
-            //selection.tell("Hallo!", self());
-            //txtSendTo.addItem();
         });
         centerup2.add(addNewButton, BorderLayout.EAST);
         centerPanel.add(centerup2);
@@ -82,7 +80,7 @@ public class WalletGuiControlImpl implements WalletGuiControl {
         centerdown.add(txtSendAmount);
         centerdown.add(btnSend);
         centerPanel.add(centerdown);
-        //centerPanel.add(new JLabel(""));
+
         // Row 3
         JPanel centerdown2 = new JPanel();
         centerdown2.setLayout(new GridLayout(1, 3));
@@ -91,7 +89,8 @@ public class WalletGuiControlImpl implements WalletGuiControl {
         centerdown2.add(btnExit);
         centerPanel.add(centerdown2);
         window.add(centerPanel);
-        //<hr>
+
+
         bottomPanel.setLayout(new BorderLayout());
 
         showDebug = new JCheckBox("Show debug messages in transaction log");
diff --git a/src/main/java/fucoin/wallet/AbstractWallet.java b/src/main/java/fucoin/wallet/AbstractWallet.java
index 13faa08..100d472 100644
--- a/src/main/java/fucoin/wallet/AbstractWallet.java
+++ b/src/main/java/fucoin/wallet/AbstractWallet.java
@@ -3,10 +3,12 @@ package fucoin.wallet;
 import akka.actor.ActorRef;
 import fucoin.AbstractNode;
 
+import java.io.Serializable;
+
 /**
  *
  */
-public abstract class AbstractWallet extends AbstractNode {
+public abstract class AbstractWallet extends AbstractNode implements Serializable{
 
     /**
      * Currently amount of this wallet
diff --git a/src/main/java/fucoin/wallet/WalletImpl.java b/src/main/java/fucoin/wallet/WalletImpl.java
index a3eadea..c694583 100644
--- a/src/main/java/fucoin/wallet/WalletImpl.java
+++ b/src/main/java/fucoin/wallet/WalletImpl.java
@@ -13,16 +13,12 @@ import fucoin.actions.persist.ActionInvokeRevive;
 import fucoin.actions.transaction.ActionGetAmountAnswer;
 import fucoin.actions.transaction.ActionInvokeSentMoney;
 import fucoin.gui.WalletGuiControl;
-import scala.concurrent.Await;
-
-import javax.swing.*;
-import java.util.concurrent.TimeUnit;
 
 public class WalletImpl extends AbstractWallet {
 
     private ActorRef preKnownNeighbour;
     private ActorRef remoteSuperVisorActor;
-    private WalletGuiControl gui;
+    private transient WalletGuiControl gui;
     private String preKnownNeighbourName;
     private boolean isActive;
 
-- 
GitLab