Saturday, May 22, 2010

Jcreator Error,,plz help?

--------------------Configuration: %26lt;Default%26gt;--------------------


C:\Documents and Settings\House_Guest1_2\My Documents\JCreator Pro\MyProjects\joeyy\src\test1.java:34: operator % cannot be applied to javax.swing.JTextField,int


if ( name % 3 = 0)


^


C:\Documents and Settings\House_Guest1_2\My Documents\JCreator Pro\MyProjects\joeyy\src\test1.java:36: operator % cannot be applied to javax.swing.JTextField,int


if (name % 3 != 0)


^


C:\Documents and Settings\House_Guest1_2\My Documents\JCreator Pro\MyProjects\joeyy\src\test1.java:49: incompatible types


found : java.lang.String


required: double


double text = name.getText();


^


C:\Documents and Settings\House_Guest1_2\My Documents\JCreator Pro\MyProjects\joeyy\src\test1.java:50: setText(java.lang.String) in javax.swing.JLabel cannot be applied to (double)


hello.setText( text);


^


C:\Documents and Settings\House_Guest1_2\My Documents\JCreator Pro\MyProjects\joeyy\src\test1.java:55: cannot resolve symbol


symbol : class ColorDemo


location: class test1


ColorDemo colorApp = new ColorDemo();


^


C:\Documents and Settings\House_Guest1_2\My Documents\JCreator Pro\MyProjects\joeyy\src\test1.java:55: cannot resolve symbol


symbol : class ColorDemo


location: class test1


ColorDemo colorApp = new ColorDemo();


^


6 errors





Process completed.

Jcreator Error,,plz help?
Most of those errors seem pretty clear.





if ( name % 3 = 0) %26lt;= you probably want ==


but also, is name an integer?





double text = name.getText(); %26lt;= can assign a String to a double





ColorDemo colorApp = new ColorDemo(); %26lt;= looks like a problem finding your class: spelling and capitalization , also, it this class already defined? Is it public?
Reply:double text = name.getText();


change to :


double text = Double.parseDouble(name.getText())





hello.setText( text);


change to:


hello.setText( text.toString());





ColorDemo colorApp = new ColorDemo();


- make sure u have import the class to the current file and include the class during compliation

columbine

No comments:

Post a Comment