I am trying to add a new label to my jFrame at the click of a button and I just want it to be a rectangle with a blue background and no text.
I am running the following code:
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) { 
   JLabel lable23 = new JLabel("Loop Label");
   lable23.setLocation(570, 60);
   lable23.setOpaque(true);
   lable23.setBackground(Color.BLUE);
   add(lable23);
   validate();
   repaint();
}  
how ever when i click on the button nothing works. I have tried adding JFrame.add() and JFrame.validate and repaint but this just gives me a syntax error. Any pointers would be great.
Thanks
 
    