title: Java Graphics - draw shape on Jbutton
body: <p>I am making a minimally small paint application for a class in Java.  I need to make several buttons for the user to select different shapes, and on those buttons I am supposed to put an image of the shape they are using.  For example, a button that lets a user draw a line should have have an image of a line on it.  A button that draws a rectangle, a rectangle should be on it.  I need to be able to do this from within the program without using an external image source.</p>
  
  <p>Here is my current button code example.</p>
  
  <pre><code>lineB = new JButton();
  lineB.setBounds(0, 25, 20, 20);
  lineB.setBackground(Color.WHITE);
  shapePanel.add(lineB);
  lineB.addActionListener(this);
  </code></pre>