Results 1 to 4 of 4
  1. #1
    DrakalDragon is offline Member
    Join Date
    May 2011
    Posts
    2
    Rep Power
    0

    Default Unable to compile...

    New here, but I thought this would be the right place to ask. Whenever I try to compile a .class using ColorPanel, I keep getting an error saying it can't find the symbol. Here's the source.
    Java Code:
    import javax.swing.*;
    import java.awt.*;
    public class GUIWindow{
    	public static void main(String [] args) {
    		JFrame theGUI = new JFrame();
    		theGUI.setTitle("GUI Program");
    		theGUI.setSize(300, 200);
    		theGUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		ColorPanel panel = new ColorPanel(Color.gray);
    		Container pane = theGUI.getContentPane();
    		pane.add(panel);
    		theGUI.setVisible(true);
    	}
    }
    And I get these errors.

    Java Code:
    GUIWindow.java:10: cannot find symbol
    symbol  : class ColorPanel
    location: class GUIWindow
    		ColorPanel panel = new ColorPanel(Color.gray);
    		^
    GUIWindow.java:10: cannot find symbol
    symbol  : class ColorPanel
    location: class GUIWindow
    		ColorPanel panel = new ColorPanel(Color.gray);
    		                       ^
    2 errors
    Any help would be appreciated as I would like not to skip things in this book.

  2. #2
    Toll's Avatar
    Toll is offline Senior Member
    Join Date
    May 2011
    Location
    Sweden
    Posts
    384
    Rep Power
    4

    Default

    Is ColorPanel a class that you have made yourself or downloaded? It's not a general Java-class, in any case.

  3. #3
    DrakalDragon is offline Member
    Join Date
    May 2011
    Posts
    2
    Rep Power
    0

    Default

    The book I got didn't specify to download one, and nowhere did I make one, so I guess I'll have to skip it or work around it. Thanks for your input.

  4. #4
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Posts
    339
    Rep Power
    7

    Default

    It's probably just a JPanel with a colored background. Try this:
    Java Code:
    public class ColorPanel extends JPanel {
        ColorPanel(Color color) {
            setBackground(color);
        }
    }

Similar Threads

  1. unable to compile class for jsp
    By ashok bhagat in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 11-26-2010, 08:40 AM
  2. Replies: 11
    Last Post: 05-18-2010, 01:49 PM
  3. org.apache.jasper.JasperException: Unable to compile class for JSP
    By satya kishore in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 04-13-2010, 02:40 PM
  4. JasperException: Unable to compile
    By Aerinai in forum Java Servlet
    Replies: 0
    Last Post: 06-17-2008, 06:16 PM
  5. Unable to compile
    By gapper in forum New To Java
    Replies: 2
    Last Post: 01-14-2008, 04:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •