tyridge77

PixelClass

Feb 14th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Graphics;
  3. import java.awt.Graphics2D;
  4. import java.awt.geom.Ellipse2D;
  5.  
  6. import javax.swing.JPanel;
  7.  
  8. public class Representation extends JPanel{     // Each Pixel representation
  9.    
  10.    
  11.     int x;
  12.     int y;
  13.     int sizex;
  14.     int sizey;
  15.     int width;
  16.     int height;
  17.     Color colorgb;
  18.    
  19.     Representation(int xx,int yy,int ssizex,int ssizey,Color rgb,int w,int h)
  20.     {
  21.      x=xx;
  22.      y=yy;
  23.      sizex=ssizex;
  24.      sizey=ssizey;
  25.      colorgb = rgb;
  26.      width = w;
  27.      height = h;
  28.     }
  29.    
  30.     @Override
  31.     public void paint(Graphics g)
  32.         {
  33.          Graphics2D g2d = (Graphics2D) g;
  34.          g2d.setColor(colorgb);
  35.          
  36.          g2d.fillRect(x,y, sizex, sizey);
  37.          
  38.         }
  39. }
Add Comment
Please, Sign In to add comment