customized login button
This commit is contained in:
parent
d0557a2a6d
commit
c88212b7e1
|
@ -9,6 +9,7 @@ import me.teridax.jcash.lang.Locales;
|
|||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -78,15 +79,27 @@ public final class Main {
|
|||
public static void main(String[] args) {
|
||||
initializeSystemLogger(Level.FINE);
|
||||
|
||||
Locales.autodetectDefaultLocale();
|
||||
|
||||
setPlatformDependingTheme();
|
||||
|
||||
loadExtraFont();
|
||||
|
||||
Locales.autodetectDefaultLocale();
|
||||
|
||||
// create main instance and show the login screen
|
||||
instance();
|
||||
getInstance().loadDatabase();
|
||||
}
|
||||
|
||||
private static void loadExtraFont() {
|
||||
try {
|
||||
var font = Font.createFont(Font.TRUETYPE_FONT, IconProvider.class.getResourceAsStream("res/Circus.ttf"));
|
||||
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
ge.registerFont(font);
|
||||
} catch (IOException | FontFormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the look and feel via the ui manager.
|
||||
* This function will select a look and feel so that the application will
|
||||
|
|
|
@ -25,4 +25,8 @@ public class IconProvider {
|
|||
|
||||
return DEFAULT_IMAGE;
|
||||
}
|
||||
|
||||
public static Image getSetupIcon() {
|
||||
return loadIcon("res/login.jpg");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package me.teridax.jcash.gui.account;
|
||||
|
||||
import me.teridax.jcash.Logging;
|
||||
import me.teridax.jcash.banking.accounts.Account;
|
||||
import me.teridax.jcash.banking.accounts.CurrentAccount;
|
||||
import me.teridax.jcash.banking.accounts.SavingsAccount;
|
||||
import me.teridax.jcash.banking.management.Profile;
|
||||
|
@ -8,6 +9,8 @@ import me.teridax.jcash.decode.StringDecoder;
|
|||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
import static javax.swing.SwingConstants.RIGHT;
|
||||
import static me.teridax.jcash.gui.Utils.addGridBagRow;
|
||||
|
@ -42,9 +45,9 @@ public class AccountView extends JPanel {
|
|||
|
||||
this.accountSelection.removeAllItems();
|
||||
|
||||
for (var otherAccount : profile.getAccounts()) {
|
||||
this.accountSelection.addItem(otherAccount.getDescription());
|
||||
}
|
||||
var accounts = profile.getAccounts();
|
||||
Arrays.stream(accounts).sorted(Comparator.comparingInt(Account::getIban)).forEach(a -> this.accountSelection.addItem(a.getDescription()));
|
||||
|
||||
this.accountSelection.setSelectedItem(profile.getPrimaryAccount().getDescription());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package me.teridax.jcash.gui.login;
|
||||
|
||||
import me.teridax.jcash.gui.IconProvider;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.*;
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
import java.text.NumberFormat;
|
||||
|
||||
import static java.awt.BorderLayout.NORTH;
|
||||
|
@ -60,6 +63,10 @@ public class LoginView extends JPanel {
|
|||
this.pin = new JPasswordField();
|
||||
this.login = new JButton(translate("Login"));
|
||||
|
||||
this.login.setFont(new Font("Circus", Font.PLAIN, 72));
|
||||
this.login.setBackground(Color.RED);
|
||||
this.login.setForeground(Color.CYAN);
|
||||
|
||||
restrictPasswordToDigits();
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 294 KiB |
|
@ -2,6 +2,7 @@ package me.teridax.jcash.gui.takeoff;
|
|||
|
||||
import me.teridax.jcash.Logging;
|
||||
import me.teridax.jcash.banking.accounts.Account;
|
||||
import me.teridax.jcash.banking.accounts.CurrentAccount;
|
||||
import me.teridax.jcash.gui.InvalidInputException;
|
||||
import me.teridax.jcash.gui.Utils;
|
||||
|
||||
|
@ -18,8 +19,13 @@ public class TakeoffController {
|
|||
public TakeoffController(Account account) {
|
||||
this.account = account;
|
||||
|
||||
var overdraft = 0.0;
|
||||
if (account instanceof CurrentAccount) {
|
||||
overdraft += ((CurrentAccount) account).getOverdraft();
|
||||
}
|
||||
|
||||
this.data = new TakeoffData(account.getBalance());
|
||||
this.view = new TakeoffView(this.data.getMaxValue());
|
||||
this.view = new TakeoffView(this.data.getMaxValue() + overdraft);
|
||||
|
||||
this.view.getTakeoff().addActionListener(e -> takeOff());
|
||||
this.view.getCancel().addActionListener(e -> view.dispose());
|
||||
|
|
|
@ -3,6 +3,7 @@ package me.teridax.jcash.gui.transfer;
|
|||
import me.teridax.jcash.Logging;
|
||||
import me.teridax.jcash.Main;
|
||||
import me.teridax.jcash.banking.accounts.Account;
|
||||
import me.teridax.jcash.banking.accounts.CurrentAccount;
|
||||
import me.teridax.jcash.banking.management.BankingManagementSystem;
|
||||
import me.teridax.jcash.gui.InvalidInputException;
|
||||
import me.teridax.jcash.gui.Utils;
|
||||
|
@ -23,7 +24,12 @@ public class TransferController {
|
|||
public TransferController(Account account, BankingManagementSystem bms) {
|
||||
this.account = account;
|
||||
|
||||
this.view = new TransferView(account.getBalance());
|
||||
var overdraft = 0.0;
|
||||
if (account instanceof CurrentAccount) {
|
||||
overdraft += ((CurrentAccount) account).getOverdraft();
|
||||
}
|
||||
|
||||
this.view = new TransferView(account.getBalance() + overdraft);
|
||||
this.transferData = new TransferData(bms);
|
||||
this.view.getTransfer().addActionListener(e -> transfer());
|
||||
this.view.getCancel().addActionListener(e -> view.dispose());this.view.getValue().getDocument().addDocumentListener(new DocumentListener() {
|
||||
|
|
Loading…
Reference in New Issue