/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * Histogram.java * * Created on Dec 9, 2009, 9:31:34 AM */ package graderforms.resources; import java.awt.*; import java.net.*; /** * * @author Kevin */ public class Histogram extends javax.swing.JDialog { class myCanvas extends Canvas { public myCanvas() { super(); this.setSize(1000, 1000); } public void paint(Graphics g) { Image img=null; Toolkit tk=this.getToolkit(); URL url=this.getClass().getResource("Histogram.gif"); img=tk.getImage(url); g.setColor(Color.BLACK); g.drawImage(img, 0, 0, null); } } /** Creates new form Histogram */ public Histogram(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); myCanvas m=new myCanvas(); this.add(m); m.paint(m.getGraphics()); this.setLocationRelativeTo(null); this.setTitle("Histogram-Midterm 1"); } /** 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") // //GEN-BEGIN:initComponents private void initComponents() { jButton1 = new javax.swing.JButton(); jButton1.setText("OK"); jButton1.setName("jButton1"); // NOI18N jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(388, Short.MAX_VALUE) .addComponent(jButton1) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(655, Short.MAX_VALUE) .addComponent(jButton1) .addContainerGap()) ); pack(); }// //GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed this.setVisible(false); }//GEN-LAST:event_jButton1ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { Histogram dialog = new Histogram(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; // End of variables declaration//GEN-END:variables }