From c6edc0f99c99a7f06e32e8c20e04fbaa10d5cfbd Mon Sep 17 00:00:00 2001 From: Luca Keidel <info@lucakeidel.de> Date: Wed, 15 Jun 2016 01:57:27 +0200 Subject: [PATCH] Made wallet gui a bit prettier --- src/main/java/fucoin/MainRemote.java | 13 +++++++++---- .../java/fucoin/gui/WalletGuiControlImpl.java | 19 +++++++++++++++++-- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/main/java/fucoin/MainRemote.java b/src/main/java/fucoin/MainRemote.java index 02d8e9f..88be325 100644 --- a/src/main/java/fucoin/MainRemote.java +++ b/src/main/java/fucoin/MainRemote.java @@ -16,7 +16,6 @@ import scala.concurrent.Await; import javax.swing.*; public class MainRemote { - public static ActorRef remoteSuperVisorActor; private static JTextField walletNameField = new JTextField(5); private static JTextField pathField = new JTextField(5); @@ -53,12 +52,18 @@ public class MainRemote { path = pathField.getText(); } - // terminate if user clicked abort - if (path == null) { + // check input + if(result == JOptionPane.OK_OPTION && (path.equals("") || walletName.equals(""))){ + continue; + } + + // terminate if user clicked cancel + if (result == JOptionPane.CANCEL_OPTION) { system.terminate(); + return; } - // tell the node that we want to join the network + // resolve the given address ActorSelection selection = system.actorSelection(path); try { diff --git a/src/main/java/fucoin/gui/WalletGuiControlImpl.java b/src/main/java/fucoin/gui/WalletGuiControlImpl.java index 0a001f0..5c03f89 100644 --- a/src/main/java/fucoin/gui/WalletGuiControlImpl.java +++ b/src/main/java/fucoin/gui/WalletGuiControlImpl.java @@ -14,7 +14,7 @@ public class WalletGuiControlImpl implements WalletGuiControl { private JFrame window = new JFrame("test"); private JPanel topPanel = new JPanel(); - private JLabel lblMyAddress = new JLabel("My Address:"); + private JTextField txtMyName = new JTextField("<MyName>"); private JTextField txtMyAddress = new JTextField("<MyAddress>"); private JLabel lblMyAmount = new JLabel("My FUCs: "); private JLabel txtMyAmount = new JLabel(" <MyFUCs>"); @@ -40,7 +40,22 @@ public class WalletGuiControlImpl implements WalletGuiControl { // Row 1 JPanel row1 = new JPanel(); row1.setLayout(new BoxLayout(row1, BoxLayout.PAGE_AXIS)); - row1.add(lblMyAddress); + + txtMyName.setHorizontalAlignment(JTextField.CENTER); + txtMyName.setBorder(BorderFactory.createEmptyBorder()); + txtMyName.setFont(txtMyName.getFont().deriveFont(18f).deriveFont(Font.BOLD)); + txtMyName.setEditable(false); + txtMyName.setForeground(Color.WHITE); + txtMyName.setBackground(new Color(123,94,167)); + txtMyName.setText(wallet.getName()); + + txtMyAddress.setHorizontalAlignment(JTextField.CENTER); + txtMyAddress.setBorder(BorderFactory.createEmptyBorder()); + txtMyAddress.setEditable(false); + txtMyAddress.setForeground(Color.WHITE); + txtMyAddress.setBackground(new Color(137,112,176)); + + row1.add(txtMyName); row1.add(txtMyAddress); topPanel.add(row1); // Row 2 -- GitLab