Advertisement
mobal

Untitled

Mar 21st, 2013
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. import java.awt.Graphics;
  2.  
  3. import javax.swing.JFrame;
  4.  
  5. public class Histogram {
  6.     private Image img;
  7.     private Graphics g;
  8.     private int height = 600;
  9.     private int width = 600;
  10.     private JFrame frame;
  11.    
  12.     public Histogram(Image img) {
  13.         this.img = img;
  14.         this.frame = new JFrame("Histogram");
  15.        
  16.         this.initHistogram(true);
  17.     }
  18.    
  19.     private void initHistogram(boolean visiblity) {
  20.         this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  21.         this.frame.setBounds(0, 0, this.width, this.height);
  22.         this.frame.setVisible(visiblity);
  23.        
  24.         this.g = this.frame.getGraphics();
  25.         // this.g.drawImage(this.img.getImage(), 0, 0, null);
  26.        
  27.         this.g.drawRect(10, 10, 100, 100);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement