Visao.Relatorio.Grafico_QuantidadeReclamacoesSexo.java Source code

Java tutorial

Introduction

Here is the source code for Visao.Relatorio.Grafico_QuantidadeReclamacoesSexo.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Visao.Relatorio;

import Controle.ControleRelatorio;
import DAO.GeneralDAO;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.data.general.DefaultPieDataset;

/**
 *
 * @author Gustavo
 */
public class Grafico_QuantidadeReclamacoesSexo extends javax.swing.JDialog {

    private GeneralDAO dao;
    private ControleRelatorio controleRelatorio;
    private DefaultPieDataset datasetDB;

    /**
     * Creates new form grafico
     */
    public Grafico_QuantidadeReclamacoesSexo(java.awt.Frame parent, boolean modal, GeneralDAO dao,
            JFreeChart chart) {
        super(parent, modal);
        this.dao = dao;
        controleRelatorio = new ControleRelatorio(dao);
        datasetDB = controleRelatorio.numeroReclamacoesSexoGrafico();
        grafico(chart);
        Toolkit kit = this.getToolkit();
        Image icone = kit.getImage("src/Icones/relatorio.png");
        this.setIconImage(icone);
    }

    private void grafico(JFreeChart chart) {

        ChartPanel panel = new ChartPanel(chart);
        panel.setPreferredSize(new Dimension(600, 600));
        setContentPane(panel);
        this.pack();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Quantidade de Reclamaes por Sexo");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0,
                400, Short.MAX_VALUE));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 300,
                Short.MAX_VALUE));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}