Java tutorial
/* * 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.Color; import java.awt.Dimension; import java.awt.Image; import java.awt.Toolkit; import javax.swing.JFrame; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.CategoryPlot; import org.jfree.data.general.DefaultPieDataset; /** * * @author Gustavo */ public class Grafico_QuantidadeReclamacoesUF extends javax.swing.JDialog { private GeneralDAO dao; private Toolkit kit = Toolkit.getDefaultToolkit(); private Dimension screenSize = kit.getScreenSize(); /** * Creates new form grafico */ public Grafico_QuantidadeReclamacoesUF(java.awt.Frame parent, boolean modal, GeneralDAO dao, JFreeChart chart) { super(parent, modal); initComponents(); this.dao = dao; int screenHeight = screenSize.height; int screenWidth = screenSize.width; this.setSize(screenWidth, screenHeight - 100); grafico(chart); Image icone = kit.getImage("src/Icones/relatorio.png"); this.setIconImage(icone); } private void grafico(JFreeChart chart) { CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLUE); ChartPanel panel = new ChartPanel(chart); panel.setVisible(true); panel.setSize(screenSize.width - 10, screenSize.height - 140); this.add(panel); } /** * 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 Estado"); 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 }