public void add(CompositeShape aShape)
{
Rectangle temp = aShape.getBounds();
int width = (int)temp.getWidth();
int height = (int)temp.getHeight();
JButton aButton = new JButton(new ShapeIcon(aShape, width, height));
}
The button only exists in the add method. You declare it then that's it, you are not doing anything with it. No one outside the method can see it. It is not even part of the Box class. You should declare as a private attribute in the Box class and use get method. Then you should add it in the frame that you are displaying.
Suggestion: have Box extend JButton