added icon
This commit is contained in:
parent
97bafa3fa5
commit
9895ae03b9
|
@ -1,11 +1,15 @@
|
||||||
package me.teridax.jcash;
|
package me.teridax.jcash;
|
||||||
|
|
||||||
|
import me.teridax.jcash.gui.IconProvider;
|
||||||
import me.teridax.jcash.gui.Loader;
|
import me.teridax.jcash.gui.Loader;
|
||||||
import me.teridax.jcash.gui.account.AccountController;
|
import me.teridax.jcash.gui.account.AccountController;
|
||||||
import me.teridax.jcash.gui.login.LoginController;
|
import me.teridax.jcash.gui.login.LoginController;
|
||||||
import me.teridax.jcash.lang.Locales;
|
import me.teridax.jcash.lang.Locales;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.logging.*;
|
import java.util.logging.*;
|
||||||
|
|
||||||
|
@ -33,6 +37,7 @@ public final class Main {
|
||||||
this.window.setTitle(translate("Cashmachine"));
|
this.window.setTitle(translate("Cashmachine"));
|
||||||
this.window.setLocationByPlatform(true);
|
this.window.setLocationByPlatform(true);
|
||||||
this.window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
this.window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
this.window.setIconImage(IconProvider.getWindowIcon());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -152,4 +157,8 @@ public final class Main {
|
||||||
window.setContentPane(new JLabel(translate("you're logged out")));
|
window.setContentPane(new JLabel(translate("you're logged out")));
|
||||||
window.setVisible(false);
|
window.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JFrame getWindow() {
|
||||||
|
return this.window;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package me.teridax.jcash.gui;
|
||||||
|
|
||||||
|
import me.teridax.jcash.Main;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static me.teridax.jcash.Logging.LOGGER;
|
||||||
|
|
||||||
|
public class IconProvider {
|
||||||
|
|
||||||
|
private static final Image DEFAULT_IMAGE = new BufferedImage(256, 256, BufferedImage.TYPE_INT_RGB);
|
||||||
|
|
||||||
|
public static Image getWindowIcon() {
|
||||||
|
return loadIcon("res/register.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Image loadIcon(String path) {
|
||||||
|
try {
|
||||||
|
var is = Objects.requireNonNull(IconProvider.class.getResourceAsStream(path));
|
||||||
|
return ImageIO.read(is);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.severe("Unable to load icon " + path + " because: " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return DEFAULT_IMAGE;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package me.teridax.jcash.gui;
|
package me.teridax.jcash.gui;
|
||||||
|
|
||||||
import me.teridax.jcash.Logging;
|
import me.teridax.jcash.Logging;
|
||||||
|
import me.teridax.jcash.Main;
|
||||||
import me.teridax.jcash.banking.management.BankingManagementSystem;
|
import me.teridax.jcash.banking.management.BankingManagementSystem;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
@ -35,7 +36,7 @@ public class Loader {
|
||||||
fileChooser.setDialogType(JFileChooser.OPEN_DIALOG);
|
fileChooser.setDialogType(JFileChooser.OPEN_DIALOG);
|
||||||
fileChooser.setAcceptAllFileFilterUsed(false);
|
fileChooser.setAcceptAllFileFilterUsed(false);
|
||||||
|
|
||||||
if (fileChooser.showDialog(null, translate("Load database")) == APPROVE_OPTION) {
|
if (fileChooser.showDialog(Main.getInstance().getWindow(), translate("Load database")) == APPROVE_OPTION) {
|
||||||
// parse file content
|
// parse file content
|
||||||
try {
|
try {
|
||||||
return BankingManagementSystem.loadFromCsv(fileChooser.getSelectedFile().toPath());
|
return BankingManagementSystem.loadFromCsv(fileChooser.getSelectedFile().toPath());
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class AccountView extends JPanel {
|
||||||
|
|
||||||
this.balance.setText(StringDecoder.LOCAL_NUMBER_FORMAT.format(account.getBalance()) + " €");
|
this.balance.setText(StringDecoder.LOCAL_NUMBER_FORMAT.format(account.getBalance()) + " €");
|
||||||
|
|
||||||
this.type.setText(account.getClass().getSimpleName());
|
this.type.setText(translate(account.getClass().getSimpleName()));
|
||||||
if (account instanceof CurrentAccount) {;
|
if (account instanceof CurrentAccount) {;
|
||||||
this.typeSpecialLabel.setText(translate("Overdraft"));
|
this.typeSpecialLabel.setText(translate("Overdraft"));
|
||||||
this.typeSpecialProperty.setText( StringDecoder.LOCAL_NUMBER_FORMAT.format(((CurrentAccount) account).getOverdraft()) + " €");
|
this.typeSpecialProperty.setText( StringDecoder.LOCAL_NUMBER_FORMAT.format(((CurrentAccount) account).getOverdraft()) + " €");
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
https://pixabay.com/vectors/register-cash-register-modern-23666/
|
||||||
|
![register](https://cdn.pixabay.com/photo/2012/04/01/17/34/register-23666_960_720.png)
|
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
|
@ -1,6 +1,7 @@
|
||||||
package me.teridax.jcash.gui.takeoff;
|
package me.teridax.jcash.gui.takeoff;
|
||||||
|
|
||||||
import me.teridax.jcash.Logging;
|
import me.teridax.jcash.Logging;
|
||||||
|
import me.teridax.jcash.Main;
|
||||||
import me.teridax.jcash.banking.accounts.Account;
|
import me.teridax.jcash.banking.accounts.Account;
|
||||||
|
|
||||||
import static javax.swing.JOptionPane.ERROR_MESSAGE;
|
import static javax.swing.JOptionPane.ERROR_MESSAGE;
|
||||||
|
@ -31,7 +32,7 @@ public class TakeoffDialog {
|
||||||
view.dispose();
|
view.dispose();
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
Logging.LOGGER.severe("Could not take off money: " + ex.getMessage());
|
Logging.LOGGER.severe("Could not take off money: " + ex.getMessage());
|
||||||
showMessageDialog(null, "Reason: " + ex.getMessage(), translate("Could not take off money"), ERROR_MESSAGE);
|
showMessageDialog(Main.getInstance().getWindow(), "Reason: " + ex.getMessage(), translate("Could not take off money"), ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package me.teridax.jcash.gui.transfer;
|
package me.teridax.jcash.gui.transfer;
|
||||||
|
|
||||||
import me.teridax.jcash.Logging;
|
import me.teridax.jcash.Logging;
|
||||||
|
import me.teridax.jcash.Main;
|
||||||
import me.teridax.jcash.banking.accounts.Account;
|
import me.teridax.jcash.banking.accounts.Account;
|
||||||
import me.teridax.jcash.banking.management.BankingManagementSystem;
|
import me.teridax.jcash.banking.management.BankingManagementSystem;
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ public class TransferDialog {
|
||||||
this.transferView.dispose();
|
this.transferView.dispose();
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
Logging.LOGGER.severe("Could not transfer: " + ex.getMessage());
|
Logging.LOGGER.severe("Could not transfer: " + ex.getMessage());
|
||||||
showMessageDialog(null, translate("Invalid account"), translate("Could not transfer"), ERROR_MESSAGE);
|
showMessageDialog(Main.getInstance().getWindow(), translate("Invalid account"), translate("Could not transfer"), ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,8 @@ PLZ,PLZ,PLZ,NPA,邮政编码
|
||||||
City,Ort,Ubicación,Ville,城市
|
City,Ort,Ubicación,Ville,城市
|
||||||
Password,Passwort,contraseña,Mot de passe,密码
|
Password,Passwort,contraseña,Mot de passe,密码
|
||||||
Login,Anmelden,Inicio de sesión,S'inscrire,登录
|
Login,Anmelden,Inicio de sesión,S'inscrire,登录
|
||||||
Current account,Girokonto,Cuenta corriente,Compte courant,活期账户
|
CurrentAccount,Girokonto,Cuenta corriente,Compte courant,活期账户
|
||||||
Savings account,Sparkonto,Cuenta de ahorro,Compte d'épargne,储蓄账户
|
SavingsAccount,Sparkonto,Cuenta de ahorro,Compte d'épargne,储蓄账户
|
||||||
Address,Adresse,Dirección,Adresse,地址
|
Address,Adresse,Dirección,Adresse,地址
|
||||||
Logout,Abmelden,desconectarse,Se désinscrire,退出登录
|
Logout,Abmelden,desconectarse,Se désinscrire,退出登录
|
||||||
Transfer,Überweisen,transferencia,Virement bancaire,转账
|
Transfer,Überweisen,transferencia,Virement bancaire,转账
|
||||||
|
|
|
Loading…
Reference in New Issue