Errori grafici
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -7,6 +7,7 @@ package gui;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import logic.MyBank;
|
import logic.MyBank;
|
||||||
@@ -33,6 +34,12 @@ public class GUIMyBank extends javax.swing.JFrame {
|
|||||||
*/
|
*/
|
||||||
public GUIMyBank() {
|
public GUIMyBank() {
|
||||||
initComponents();
|
initComponents();
|
||||||
|
try {
|
||||||
|
ArrayList<ContoCorrente> conti = (ArrayList<ContoCorrente>) MyBank.importaConti();
|
||||||
|
MyBank.setConti(conti);
|
||||||
|
} catch (IOException e) {
|
||||||
|
JOptionPane.showMessageDialog(null, e.getMessage());
|
||||||
|
}
|
||||||
lblNumeroContoCorrente.setVisible(false);
|
lblNumeroContoCorrente.setVisible(false);
|
||||||
txtNumeroContoCorrente.setVisible(false);
|
txtNumeroContoCorrente.setVisible(false);
|
||||||
txtNumeroContoCorrente.setEditable(false);
|
txtNumeroContoCorrente.setEditable(false);
|
||||||
|
|||||||
@@ -14,9 +14,8 @@ import java.text.ParseException;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.InputMismatchException;
|
import java.util.List;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
@@ -36,49 +35,17 @@ public class MyBank {
|
|||||||
static final String ERRORE_GENERICO = "Errore: opzione non valida.";
|
static final String ERRORE_GENERICO = "Errore: opzione non valida.";
|
||||||
static final String ERRORE_CONTI_VUOTO = "Errore: è necessario aggiungere almeno un conto corrente prima di proseguire.";
|
static final String ERRORE_CONTI_VUOTO = "Errore: è necessario aggiungere almeno un conto corrente prima di proseguire.";
|
||||||
public static final String PATH_CONTI = "./src/logic/conti/";
|
public static final String PATH_CONTI = "./src/logic/conti/";
|
||||||
private static ArrayList<ContoCorrente> conti = importaConti();
|
private static ArrayList<ContoCorrente> conti;
|
||||||
|
|
||||||
|
public static void setConti(ArrayList<ContoCorrente> conti) {
|
||||||
|
MyBank.conti = conti;
|
||||||
|
}
|
||||||
|
|
||||||
public static ArrayList<ContoCorrente> getConti() {
|
public static ArrayList<ContoCorrente> getConti() {
|
||||||
return conti;
|
return conti;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static List<ContoCorrente> importaConti() throws IOException{
|
||||||
int scelta = -1;
|
|
||||||
|
|
||||||
do {
|
|
||||||
System.out.println("Scegliere un'opzione:");
|
|
||||||
System.out.println("1. Aprire conto corrente");
|
|
||||||
System.out.println("2. Versamento");
|
|
||||||
System.out.println("3. Prelievo");
|
|
||||||
System.out.println("4. Mostra movimenti");
|
|
||||||
System.out.println("0. Esci");
|
|
||||||
System.out.print("Opzione: ");
|
|
||||||
|
|
||||||
try {
|
|
||||||
scelta = sc.nextInt();
|
|
||||||
sc.nextLine();
|
|
||||||
|
|
||||||
switch (scelta) {
|
|
||||||
case 0:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
System.out.println(ERRORE_GENERICO);
|
|
||||||
pausa();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} catch (InputMismatchException _) {
|
|
||||||
System.out.println(ERRORE_GENERICO);
|
|
||||||
pausa();
|
|
||||||
}
|
|
||||||
} while (scelta != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void pausa() {
|
|
||||||
System.out.println("Premere un tasto per continuare. . .");
|
|
||||||
sc.nextLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
static ArrayList<ContoCorrente> importaConti() {
|
|
||||||
ArrayList<ContoCorrente> conti = new ArrayList<>();
|
ArrayList<ContoCorrente> conti = new ArrayList<>();
|
||||||
File percorsoConti = new File(PATH_CONTI);
|
File percorsoConti = new File(PATH_CONTI);
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
@@ -104,10 +71,8 @@ public class MyBank {
|
|||||||
numeriContiCorrenti.add(conti.getLast().getNumeroContoCorrente());
|
numeriContiCorrenti.add(conti.getLast().getNumeroContoCorrente());
|
||||||
ContoCorrente.setNumeriContiCorrenti(numeriContiCorrenti);
|
ContoCorrente.setNumeriContiCorrenti(numeriContiCorrenti);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (IOException e) {
|
||||||
System.out.println("Errore nella lettura del file di conto corrente.");
|
throw new IOException("Errore nella lettura del file di conto corrente:\n" + e.getMessage());
|
||||||
System.out.println(e.getMessage());
|
|
||||||
System.out.println(e.getStackTrace());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user