i am currently working on a GUI for a program. i have created 100 jpanels which i have set opaque and colored blue. All of these blocks get an error which says that an identifier is expected for the lines which set them opaque and colors them, heres an example:
BoardDesigner.java:97: <identifier> expected Block25.setBackground(MyBlue); ^ BoardDesigner.java:97: <identifier> expected Block25.setBackground(MyBlue); ^
heres a bit of the code:
//creating the blue colour used in the JLabels Color MyBlue = new Color(0,0,255); //Creation of the Block JLabels JLabel Block1 = new JLabel(); Block1.setOpaque(true); Block1.setBackground(MyBlue); JLabel Block2 = new JLabel(); Block2.setOpaque(true); Block2.setBackground(MyBlue); JLabel Block3 = new JLabel(); Block3.setOpaque(true); Block3.setBackground(MyBlue);
anyone have an idea whats wrong?