Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / September 2004

Tip: Looking for answers? Try searching our database.

cannot resolve symbol

Thread view: 
Michael - 26 Sep 2004 01:32 GMT
I am having a problem compiling my program that I think is related to
my classpath. All of my swing components create unresolved symbols in
their declarations. Here are my compile errors:

C:\Documents and Settings\Michael\My
Documents\School\CSC3360\Concentration>java
c Concentration.java
Concentration.java:18: cannot resolve symbol
symbol  : class Jframe
location: class Concentration
               Jframe f = new ConcentrationFrame("Concentration");
               ^
.\ConcentrationFrame.java:16: cannot resolve symbol
symbol  : class Jframe
location: class ConcentrationFrame
public class ConcentrationFrame extends Jframe {
                                       ^
.\ConcentrationFrame.java:18: cannot resolve symbol
symbol  : class Jpanel
location: class ConcentrationFrame
       private Jpanel centerPanel =
               ^
.\ConcentrationFrame.java:20: cannot resolve symbol
symbol  : class Jpanel
location: class ConcentrationFrame
       private Jpanel buttonPanel =
               ^
.\ConcentrationFrame.java:22: cannot resolve symbol
symbol  : class Jlabel
location: class ConcentrationFrame
       private Jlabel statusLabel =
               ^
.\ConcentrationFrame.java:19: cannot resolve symbol
symbol  : class Jpanel
location: class ConcentrationFrame
               new Jpanel(new FlowLayout(FlowLayout.CENTER, 20, 20));
                   ^
.\ConcentrationFrame.java:21: cannot resolve symbol
symbol  : class Jpanel
location: class ConcentrationFrame
               new Jpanel(new GridLayout(4, 6, 20, 20));
                   ^
.\ConcentrationFrame.java:36: cannot resolve symbol
symbol  : method setBackground (java.awt.Color)
location: class ConcentrationFrame
               setBackground(new Color(255, 255, 255));
               ^
.\ConcentrationFrame.java:58: cannot resolve symbol
symbol  : variable f
location: class ConcentrationFrame
               Container contentPane = f.getContentPane();
                                       ^
.\ConcentrationFrame.java:65: cannot resolve symbol
symbol  : variable EXIT_ON_CLOSE
location: class ConcentrationFrame
               setDefaultCloseOperation(EXIT_ON_CLOSE);
                                        ^
10 errors

As you can see, I am not certain that the compiler is seeing the
javax.swing file in the classpath. I had this problem before in a
program using only awt and changed both my path and classpath to the
following:

PATH = C:\j2sdk1.4.2_05\bin;C:\Program Files\SSH Communications
Security\SSH Secure Shell
CLASSPATH = .;C:\Program Files\Java\j2re1.4.1\lib\ext\QTJava.zip

Everything before the semicolon was added to both environment
variables by me to resolve the compilation issues I had with the
previous program. However, that program compiles fine now. Please
help!

Here is the driver class. The helper class imports the same packages.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;

// Driver class
public class Concentration {
    public static void main(String[] args) {
        Jframe f = new ConcentrationFrame("Concentration");
        Dimension screenSize =
            Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = f.getSize();
        f.setLocation((screenSize.width - frameSize.width) / 2,
            (screenSize.height - frameSize.height) / 2);
        f.pack();
        f.setVisible(true);
    }
}

Hope this helps.
George W. Cherry - 26 Sep 2004 02:29 GMT
> I am having a problem compiling my program that I think is related to
> my classpath. All of my swing components create unresolved symbols in
[quoted text clipped - 91 lines]
>
> Hope this helps.

Java is case sensitive, and the names of the classes
you want are JFrame, JPanel, JLabel, and so on. You
may have other errors, but fix these first, and recompile.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.