Iniciando funcionalidad estadisticas
This commit is contained in:
@@ -9,20 +9,27 @@ import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import Logica.Gestion;
|
||||
|
||||
public class Menu extends JFrame{
|
||||
protected JPanel panelCentral;
|
||||
protected JTabbedPane pestania;
|
||||
protected Vista ingresos;
|
||||
protected Vista gastos;
|
||||
protected JTextArea total;
|
||||
protected VistaAniadirVisualizar ingresos;
|
||||
protected VistaAniadirVisualizar gastos;
|
||||
protected VistaPanelLateral panel;
|
||||
protected Gestion datosGastos;
|
||||
protected Gestion datosIngresos;
|
||||
public Menu() {
|
||||
this.datosGastos=new Gestion();
|
||||
this.datosIngresos=new Gestion();
|
||||
this.setLayout(new GridBagLayout());
|
||||
GridBagConstraints constrain=new GridBagConstraints();
|
||||
this.ingresos=new Vista(this);
|
||||
this.gastos=new Vista(this);
|
||||
this.panel=new VistaPanelLateral(constrain);
|
||||
this.ingresos=new VistaAniadirVisualizar(this,datosIngresos);
|
||||
this.gastos=new VistaAniadirVisualizar(this,datosGastos);
|
||||
this.panelCentral=new JPanel();
|
||||
this.pestania=new JTabbedPane();
|
||||
constrain.fill=GridBagConstraints.VERTICAL;
|
||||
@@ -33,20 +40,28 @@ public class Menu extends JFrame{
|
||||
this.pestania.addTab("Ingresos", ingresos);
|
||||
this.pestania.addTab("Gastos", gastos);
|
||||
getContentPane().add(pestania);
|
||||
//getContentPane().add(boton);
|
||||
setTitle("Titulo");
|
||||
setSize(new Dimension(230,320));
|
||||
setDefaultCloseOperation(3);
|
||||
setLocationRelativeTo(null);
|
||||
Controlador controlador=new Controlador(this.ingresos);
|
||||
Controlador controlador2=new Controlador(this.gastos);
|
||||
constrain.fill=GridBagConstraints.HORIZONTAL;
|
||||
ControladorAniadirVisualizar controlador=new ControladorAniadirVisualizar(this.ingresos);
|
||||
ControladorAniadirVisualizar controlador2=new ControladorAniadirVisualizar(this.gastos);
|
||||
/*constrain.fill=GridBagConstraints.HORIZONTAL;
|
||||
constrain.gridx=1;
|
||||
constrain.gridy=0;
|
||||
constrain.weightx=1;
|
||||
constrain.weighty=2;
|
||||
this.total=new JTextArea(String.valueOf(Gestion.getTotal()));
|
||||
this.add(this.total,constrain);
|
||||
constrain.weighty=2;*/
|
||||
this.panel.actualizarDatos(datosIngresos);
|
||||
this.pestania.addChangeListener((ChangeListener)->{
|
||||
if(this.pestania.getSelectedIndex()==0) {
|
||||
this.panel.actualizarDatos(datosIngresos);
|
||||
}else {
|
||||
this.panel.actualizarDatos(datosGastos);
|
||||
}
|
||||
});
|
||||
this.add(this.panel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user