Skip to content
Snippets Groups Projects
Commit fff02396 authored by Luca Keidel's avatar Luca Keidel
Browse files

Fixed exception when closing remote wallet and prettified FUC amount display

parent 59720ad8
No related branches found
No related tags found
1 merge request!3Preliminary result of the software
......@@ -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);
......
......@@ -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");
......
......@@ -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
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment