title: Java Error code: Unchecked or unsafe operations...?
body: <p>I'm currently working on a java program that has a JCombo box where users select  a shape and that shape is generated randomly multiple times. I'm using the command line to run it and using notepad. I'm on the latest JDK version. How can I modify my code so it compiles on the newer version..?</p>
  
  <pre><code>import java.awt.*;
  import java.awt.event.*;
  import java.awt.geom.*;
  import java.util.Random;
  import javax.swing.*;
  
  public class Hw1b extends JFrame
  {
      public Hw1b()
      {
          super("Hw1b");
          final ComboPanel comboPanel = new ComboPanel();
          String[] shapeItems = {
              "Square", "Oval", "Rectangle", "Circle"
              //"Circle", "Square", "Oval", "Rectangle"
          };
  
          JComboBox shapeBox = new JComboBox(shapeItems);
          shapeBox.addItemListener(new ItemListener()
          {
              public void itemStateChanged(ItemEvent e)
              {
                  if(e.getStateChange() == ItemEvent.SELECTED)
                  {
                      String item = (String)e.getItem();
                      if(item.equals("Square"))
                          comboPanel.makeSquares();
                      if(item.equals("Oval"))
                          comboPanel.makeOvals();
                      if(item.equals("Rectangle"))
                          comboPanel.makeRectangles();
                      if(item.equals("Circle"))
                          comboPanel.makeCircles();
                      /*  
                      if(item.equals("Circle"))
                          comboPanel.makeSquares();
                      if(item.equals("Square"))
                          comboPanel.makeOvals();
                      if(item.equals("Oval"))
                          comboPanel.makeRectangles();
                      if(item.equals("Rectangle"))
                          comboPanel.makeCircles();
  */                      
                  }
              }
          });
  
          //position and set size of Jpanel 
          JPanel southPanel = new JPanel();
          southPanel.add(shapeBox);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          getContentPane().add(comboPanel, "Center");
          getContentPane().add(southPanel, "South");
          setSize(600,400);
          setLocation(200,200);
          setVisible(true);
      }
  
      private class ComboPanel extends JPanel
      {
          int w, h;
          Random seed;
          static final int
              OVAL = 0,
              RECT = 1;
          int shapeType = -1;
  
          public ComboPanel()
          {
              seed = new Random();
              setBackground(Color.white);
          }
  
          public void paintComponent(Graphics g)
          {
              super.paintComponent(g);
              Graphics2D g2 = (Graphics2D)g;
              g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
              int width = getWidth();
              int height = getHeight();
              int x, y;
              Shape s = null;
              for(int i = 0; i &lt; 20; i++)
              {
                  x = seed.nextInt(width - w);
                  y = seed.nextInt(height - h);
                  switch(shapeType)
                  {
                      case OVAL:
                          s = new Ellipse2D.Double(x, y, w, h);
                          break;
                      case RECT:
                          s = new Rectangle2D.Double(x, y, w, h);
                  }
                  if(shapeType &gt; -1)
                      g2.draw(s);
              }
          }
  
          public void makeSquares()
          {
              shapeType = RECT;
              w = 50;
              h = 50;
              repaint();
          }
  
          public void makeOvals()
          {
              shapeType = OVAL;
              w = 80;
              h = 60;
              repaint();
          }
  
          public void makeRectangles()
          {
              shapeType = RECT;
              w = 80;
              h = 40;
              repaint();
          }
  
          public void makeCircles()
          {
              shapeType = OVAL;
              w = 75;
              h = 75;
              repaint();
          }
      }
  
      public static void main(String[] args)
      {
          new Hw1b();
      }
  }
  </code></pre>