import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
* Crea la finestra principale
*
* @author Antonio Terreno
* @created 20 giugno 2002
*/
public class ContoCorrenteFrame extends JFrame {
/**
*Costruttore dell'oggetto ContoCorrenteFrame
*/
public ContoCorrenteFrame() {
contoVista = new ContoCorrenteView(contoModello);
Container cp = getContentPane();
cp.setLayout(new BorderLayout());
cp.add(contoVista, BorderLayout.CENTER);
cp.add(new ExitButton(), BorderLayout.SOUTH);
addWindowListener(new ExitFrame());
Toolkit kit = Toolkit.getDefaultToolkit();
setTitle("Bancomat Java Interface");
setSize(450, 300);
setLocation(100, 100);
Image img = kit.getImage("icona.png");
setIconImage(img);
setVisible(true);
}
/**
* Il main della classe ContoCorrenteFrame
*
* @param args Gli argomenti da linea di comando
*/
public static void main(String[] args) {
ContoCorrente conto1 = new ContoCorrente("Antonio",100);
ContoCorrente conto2 = new ContoCorrente("Angelo",50);
ContoCorrente conto3 = new ContoCorrente("Vito",10);
ContoCorrente conto4 = new ContoCorrente("Mauro",110);
ContoCorrente conto5 = new ContoCorrente("Gisella",150);
ContoCorrente conto6 = new ContoCorrente("Nadia",1500);
ContoCorrente conto7 = new ContoCorrente("Romina",300);
ContoCorrente conto8 = new ContoCorrente("Mauro",1200);
ContoCorrente conto9 = new ContoCorrente("Emiliano",1500);
ContoCorrente conto10 = new ContoCorrente("Tiziana",90);
ContoCorrenteConSpese conto11 = new ContoCorrenteConSpese("Efisio",300);
ContoCorrenteConSpese conto12 = new ContoCorrenteConSpese("Roberto",200);
ContoCorrenteFrame frame = new ContoCorrenteFrame();
}
private ContoCorrente[] contoModello;
private ContoCorrenteView contoVista;
}
/**
* Gestisce l'uscita dal frame
*
* @author Antonio Terreno
* @created 20 giugno 2002
*/
class ExitFrame extends WindowAdapter {
/**
* Gestisce la chiusura della finestra
*
* @param e Evento
*/
public void windowClosing(WindowEvent e) {
System.exit(0);
}
}
/**
* Gestisce le azioni sul bottone d'uscita
*
* @author Antonio Terreno
* @created 20 giugno 2002
*/
class ExitButton extends JButton implements ActionListener {
/**
*Costruttore per l'oggetto ExitButton
*/
public ExitButton() {
super("Exit");
addActionListener(this);
}
/**
* Chiude il programma
*
* @param e Evento
*/
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
}