import java.awt.Color;
import java.awt.Graphics2D;

import javax.swing.JComponent;


public class Box implements Drawingthing{
 
 int size;

 public Box(int size)
 {
  this.size=size;
 }
 public void drawthing(Graphics2D g2, JComponent j) {
  // TODO Auto-generated method stub
  int colorA = (int)(Math.random()*256);
  int colorB = (int)(Math.random()*256);
  int colorC = (int)(Math.random()*256);
  int a = (int)(Math.random()*256);
  int b = (int)(Math.random()*256);
  
  Color color = new Color(colorA,colorB,colorC);
  
  g2.setColor(color);
  g2.fillRect(a, b, size, size);

  
 }

}
---------------------------------------------------------------------
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JComponent;
import javax.swing.JPanel;


public class myDrawboard extends JPanel{
 
 int size;
 int item_count=0;
 String item_name;
 Graphics g;
JComponent j;

 public myDrawboard()
 {
  setBackground(Color.BLACK);
 }
 
 public void paintComponent(Graphics g){
  this.g=g;
  super.paintComponent(g);
  }

 public void additem(int parseInt, String string){
  // TODO Auto-generated method stub
  Box a = new Box(parseInt);
  size=parseInt;
  if(string.equals("Box"))
  {
   a.drawthing(g,j);  <-----------여기서 if걸어서 Box면 박스 만들고 싶은데 안만들어져 ㅠ.ㅠ 
  }
}