Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Can't find class WindowCloser

  1. #1
    Member
    Join Date
    Feb 2013
    Posts
    30
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Can't find class WindowCloser

    I am working on my final project for class and I am having problems finding the .class file to run the program. Any help would be greatly appreciated!

    import java.awt.*;
    import java.awt.event.*;

    public class ShepGrisPickColor {
    public static void main(String[] args) {
    Frame f = new PickColorFrame("Pick Color");
    f.setSize(300, 300);
    f.setVisible(true);
    }
    }
    class PickColorFrame extends Frame {
    private Label redLabel =
    new Label("Red = 128", Label.CENTER);
    private Label greenLabel =
    new Label("Green = 128", Label.CENTER);
    private Label blueLabel =
    new Label("Blue = 128", Label.CENTER);
    private Scrollbar redBar =
    new Scrollbar(Scrollbar.HORIZONTAL, 128, 1, 0, 256);
    private Scrollbar greenBar =
    new Scrollbar(Scrollbar.HORIZONTAL, 128, 1, 0, 256);
    private Scrollbar blueBar =
    new Scrollbar(Scrollbar.HORIZONTAL, 128, 1, 0, 256);


    public PickColorFrame(String title) {

    super(title);
    setBackground(new Color(128, 128, 128));
    setLayout(new GridLayout(6, 1));

    ScrollbarListener listener = new ScrollbarListener();


    add(redBar);
    redBar.addAdjustmentListener(listener);
    add(redLabel);


    add(greenBar);
    greenBar.addAdjustmentListener(listener);
    add(greenLabel);


    add(blueBar);
    blueBar.addAdjustmentListener(listener);
    add(blueLabel);


    addWindowListener(new WindowCloser());
    }

    class ScrollbarListener implements AdjustmentListener {
    public void adjustmentValueChanged(AdjustmentEvent evt) {
    int red = redBar.getValue();
    int green = greenBar.getValue();
    int blue = blueBar.getValue();

    redLabel.setText("Red = " + red);
    greenLabel.setText("Green = " + green);
    blueLabel.setText("Blue = " + blue);

    Color newColor = new Color(red, green, blue);
    redLabel.setBackground(newColor);
    greenLabel.setBackground(newColor);
    blueLabel.setBackground(newColor);
    }
    }
    }


    The error I am getting is --
    cannot find symbol - class WindowCloser
    This line is highlighted --
    addWindowListener(new WindowCloser());

    Thank you in advance for any help and advise.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,308
    Thanks
    181
    Thanked 824 Times in 767 Posts
    Blog Entries
    5

    Default Re: Can't find class WindowCloser

    The compiler is pretty explicit with that error - it cannot find the WindowLoader class. We can only guess what it is, or where it might reside, as its not part of J2SE. So the question becomes, where is it?

  3. #3
    Member
    Join Date
    Feb 2013
    Posts
    30
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: Can't find class WindowCloser

    I found the problem. Thank you so much for the info!

Similar Threads

  1. Error: Could not find or load main class
    By lijepdan in forum Java Theory & Questions
    Replies: 8
    Last Post: March 22nd, 2013, 04:32 PM
  2. Can't find Main Class??
    By zlloyd1 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 12th, 2013, 12:38 PM
  3. Cant find main class swing
    By LoganC in forum Java IDEs
    Replies: 6
    Last Post: October 18th, 2012, 09:19 PM
  4. Applet cannot find client.class?
    By JoshRod in forum What's Wrong With My Code?
    Replies: 0
    Last Post: April 18th, 2010, 05:17 PM
  5. could not find the main class
    By Tisofa in forum Object Oriented Programming
    Replies: 1
    Last Post: September 27th, 2009, 02:58 AM