how do I add a slider button to this window that would increase or decrease the shape of the square in it in java?
<pre><code>import javax.swing.*; // For JPanel, etc.
import java.awt.*;           // For Graphics, etc.
import java.awt.geom.*;      // For Ellipse2D, etc.
import java.awt.event.*; 


public class ShapeExample extends JPanel {
  private Rectangle2D.Double square =
    new Rectangle2D.Double(50, 50, 100, 100);
  private Rectangle2D.Double square1 =
    new Rectangle2D.Double(10, 10, 200, 200);
 private Ellipse2D.Double circle =
    new Ellipse2D.Double(50, 50, 100, 100);
 public void paintComponent(Graphics g) {
    clear(g);
    Graphics2D g2d = (Graphics2D)g;
     g2d.setPaint(Color.red);

    //g2d.fill(square);
    g2d.draw(square);
    g2d.draw(square1);
    g2d.fill(square1);

} 

} 

  // super.paintComponent clears offscreen pixmap,
  // since we're using double buffering by default.

  protected void clear(Graphics g) {
    super.paintComponent(g);
  }

  protected Rectangle2D.Double getsquare() {
    return(square);
  }

  public static void main(String[] args) {
    WindowUtilities.openInJFrame(new ShapeExample(), 100, 100);


  }
}
</code></pre>
