title: How to use a setStroke on a graphics object?
body: <p>I am trying to make a program where when you click a check box saying that you want an object to be drawn with a dashed line you can, but when I create a stroke and try to use it my graphics does not acknowledge it.  The code is set to double buffer so the image doesn't disappear when you are creating it.  I am not sure how to make the objects draw in with the dashed line and would appreciate any help!</p>
  
  <pre><code>    Graphics bgg = bg.getGraphics();
      if(!jCheckBox1.isSelected()){
          bgg.drawImage(fg, jPanel1.getX(), jPanel1.getY()-50, null);
      }
      else{
          Graphics2D g2d = (Graphics2D) bgg;
          float[] fa = {10, 10, 10};
          BasicStroke bs = new BasicStroke(5, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10, fa, 10);
          g2d.setStroke(bs);
          g2d.drawImage(fg, jPanel1.getX(), jPanel1.getY()-50, null);
      }
  </code></pre>