Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 2nd, 2012  |  syntax: None  |  size: 0.54 KB  |  views: 39  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. package game.project;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Graphics;
  5. import java.awt.Graphics2D;
  6. import javax.swing.JPanel;
  7.  
  8. public class MainRenderHandler extends JPanel {
  9.        
  10.         private static final long serialVersionUID = 1L;
  11.        
  12.         public void paintComponent(Graphics Gr) {
  13.                
  14.                 super.paintComponent(Gr);
  15.                 Graphics2D G2 = (Graphics2D) Gr;
  16.                 G2.setColor(Color.BLACK);
  17.                 G2.drawRect(0,0,500,500);
  18.                
  19.         }
  20.        
  21.         public void repaint(){
  22.                
  23.                 paintComponent(null);
  24.                
  25.         }
  26.        
  27.         public MainRenderHandler(){
  28.                
  29.                 repaint();
  30.                
  31.         }
  32.        
  33. }
clone this paste RAW Paste Data