Terminado backend de gestionde varios meses con varias gestiones
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
package VistaControlador;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.List;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.ListCellRenderer;
|
||||
|
||||
class CheckBoxList<E> extends JCheckBox implements ListCellRenderer<E> {
|
||||
|
||||
private static final long serialVersionUID = 3734536442230283966L;
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList<? extends E> list, E value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
setComponentOrientation(list.getComponentOrientation());
|
||||
|
||||
setFont(list.getFont());
|
||||
setText(String.valueOf(value));
|
||||
|
||||
setBackground(list.getBackground());
|
||||
setForeground(list.getForeground());
|
||||
|
||||
setSelected(isSelected);
|
||||
setEnabled(list.isEnabled());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package VistaControlador;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
@@ -13,6 +14,7 @@ import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import Logica.Gestion;
|
||||
import Logica.Meses;
|
||||
|
||||
public class Menu extends JFrame{
|
||||
protected JPanel panelCentral;
|
||||
@@ -20,17 +22,21 @@ public class Menu extends JFrame{
|
||||
protected VistaAniadirVisualizar ingresos;
|
||||
protected VistaAniadirVisualizar gastos;
|
||||
protected VistaPanelLateral panel;
|
||||
Meses meses;
|
||||
protected Gestion datosGastos;
|
||||
protected Gestion datosIngresos;
|
||||
public Menu() {
|
||||
this.meses=new Meses();
|
||||
meses.aniadirGestion("Ingresos", LocalDate.now().getYear(), LocalDate.now().getMonth());
|
||||
meses.aniadirGestion("Gastos", LocalDate.now().getYear(), LocalDate.now().getMonth());
|
||||
VistaAniadirVisualizar.setPanelLateral(panel);
|
||||
this.datosGastos = new Gestion();
|
||||
this.datosIngresos = new Gestion();
|
||||
this.setLayout(new GridBagLayout());
|
||||
GridBagConstraints constrain = new GridBagConstraints();
|
||||
this.panel = new VistaPanelLateral(constrain);
|
||||
this.ingresos = new VistaAniadirVisualizar(this,datosIngresos,true);
|
||||
this.gastos = new VistaAniadirVisualizar(this,datosGastos,false);
|
||||
this.ingresos = new VistaAniadirVisualizar(this,meses.getGestionesActuales().get(0),true);
|
||||
this.gastos = new VistaAniadirVisualizar(this,meses.getGestionesActuales().get(1),false);
|
||||
this.panelCentral = new JPanel();
|
||||
this.pestania = new JTabbedPane();
|
||||
constrain.fill = GridBagConstraints.VERTICAL;
|
||||
@@ -48,12 +54,12 @@ public class Menu extends JFrame{
|
||||
ControladorAniadirVisualizar controlador = new ControladorAniadirVisualizar(this.ingresos);
|
||||
ControladorAniadirVisualizar controlador2 = new ControladorAniadirVisualizar(this.gastos);
|
||||
ControladorPanelLateral controlador3 = new ControladorPanelLateral(this.panel);
|
||||
this.panel.actualizarDatos(datosIngresos);
|
||||
//this.panel.actualizarDatos(datosIngresos);
|
||||
this.pestania.addChangeListener((ChangeListener)->{
|
||||
if(this.pestania.getSelectedIndex() == 0) {
|
||||
this.panel.actualizarDatos(datosIngresos);
|
||||
this.panel.actualizarDatos(meses.getGestionesActuales().get(0));
|
||||
}else {
|
||||
this.panel.actualizarDatos(datosGastos);
|
||||
this.panel.actualizarDatos(meses.getGestionesActuales().get(1));
|
||||
}
|
||||
});
|
||||
this.add(this.panel);
|
||||
|
||||
Reference in New Issue
Block a user