53 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package VistaControlador;
 | |
| 
 | |
| import java.awt.Frame;
 | |
| import java.awt.GridBagConstraints;
 | |
| import java.awt.event.ActionEvent;
 | |
| import java.awt.event.ActionListener;
 | |
| 
 | |
| import javax.swing.JFrame;
 | |
| 
 | |
| import org.jfree.chart.ChartFactory;
 | |
| import org.jfree.chart.ChartFrame;
 | |
| import org.jfree.chart.JFreeChart;
 | |
| import org.jfree.data.xy.XYSeries;
 | |
| import org.jfree.data.xy.XYSeriesCollection;
 | |
| 
 | |
| import com.github.lgooddatepicker.components.DatePicker;
 | |
| import com.github.lgooddatepicker.zinternaltools.DemoPanel;
 | |
| public class ControladorPanelLateral implements ActionListener{
 | |
| 	private VistaPanelLateral vista;
 | |
| 	
 | |
| 	public ControladorPanelLateral(VistaPanelLateral vista) {
 | |
| 		this.vista=vista;
 | |
| 		this.aniadirElementos();
 | |
| 	}
 | |
| 	
 | |
| 	public void actionPerformed(ActionEvent e) {
 | |
| 		if(e.getActionCommand().equals(this.vista.mostrarEstadisticas.getActionCommand())) {
 | |
| 			
 | |
| 			XYSeries serie=new XYSeries("Mes");
 | |
| 			serie.add(10,1);
 | |
| 			serie.add(4,2);
 | |
| 			serie.add(90,10);
 | |
| 			XYSeriesCollection dataset=new XYSeriesCollection(serie);
 | |
| 			JFreeChart chart=ChartFactory.createXYLineChart("Mes", "Dias", "Gastos", dataset);
 | |
| 			ChartFrame frame=new ChartFrame("Estadisricas", chart);
 | |
| 			frame.setVisible(true);
 | |
| 			frame.setSize(700,500);
 | |
| 		}
 | |
| 		//}else if(e.getActionCommand().equals(this.vista.elegirMes.getActionCommand())){
 | |
| 			
 | |
| 		//}
 | |
| 		
 | |
| 	}
 | |
| 	
 | |
| 	private void aniadirElementos() {
 | |
| 		this.vista.mostrarEstadisticas.addActionListener(this);
 | |
| 		this.vista.mostrarEstadisticas.setActionCommand("Mostrar estadisticas");
 | |
| 		//this.vista.elegirMes.addActionListener(this);
 | |
| 		//this.vista.elegirMes.setActionCommand("Elegir mes");
 | |
| 	}
 | |
| 
 | |
| }
 |