Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. import java.awt.*;
  2. import javax.swing.*;
  3.  
  4. public class Table extends JPanel {
  5.  
  6.     private static final long serialVersionUID = -907389172333757537L;
  7.     private Image img = (new ImageIcon(this.getClass().getResource("/img/Queen.png")))
  8.             .getImage();
  9.  
  10.     public Table() {
  11.         setBackground(Color.GREEN);
  12.         setPreferredSize(new Dimension(1024, 768));
  13.         setLayout(null);
  14.  
  15.         repaint();
  16.  
  17.     }
  18.  
  19.     protected void paintComponent(Graphics g) {
  20.         super.paintComponent(g);
  21.         g.drawImage(img, 0, 0, this);
  22.  
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement