fork download
  1. import java.awt.Dimension;
  2. import java.awt.Graphics;
  3. import java.awt.image.BufferedImage;
  4.  
  5. import javax.swing.JPanel;
  6.  
  7. class ImagePanel extends JPanel {
  8.  
  9. private BufferedImage img;
  10.  
  11. @Override
  12. public Dimension getPreferredSize() {
  13. return new Dimension(200, 200);
  14. }
  15.  
  16.  
  17. @Override
  18. protected void paintComponent(Graphics g) {
  19. // TODO Auto-generated method stub
  20. super.paintComponent(g);
  21. if(img != null)
  22. g.drawImage(img, 0, 0, this);
  23. }
  24.  
  25.  
  26. public BufferedImage getImg() {
  27. return img;
  28. }
  29.  
  30.  
  31. public void setImg(BufferedImage img) {
  32. this.img = img;
  33. }
  34.  
  35.  
  36.  
  37. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
spoj: The program compiled successfully, but main class was not found.
      Main class should contain method: public static void main (String[] args).
stdout
Standard output is empty