Im trying to add ActionListener to some buttons in my applet. When i compiled it gave me this error: C:\JavaStuff\Flier.java:7: cannot resolve symbol symbol : class ActionListener location: class Flier public class Flier extends Applet implements ActionListener ^ I implemented it with this
I imported java.awt.*; so it should get it. Im using J2sdk1.4.2. I made sure everything is all in the right case too. Do i have to make a separate class for the ActionListener? Anyone know? Thanks ahead, I'll check this in the morning. -Clay
I figured it out in class today. I though that import java.awt.*; would import it but i added import java.awt.event.*; and got another error which i fixed by adding the ActionPerformed method and no errors. Thanks for the help though.
Actually, Java doesn't have the concept of package hierarchies at all. The dot (.) is just part of Suns naming convention and doesn't carry any semantic.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by miguel lisboa: BTW what's your opinion: is it better to import each needed class or instead import all (.*)? thanks in advance
[ March 18, 2005: Message edited by: miguel lisboa ]
I've seen many recommendations that you should import each class. For one, this helps avoid ambiguity if two packages contain two different classes with the same name. I know that NetBeans 3.6 has a setting that sets a threshold for the number of classes from a given syntax before importing the whole package. I typically set this to a very high number (9999) so that individual classes are imported. Perhaps Eclipse has a similar setting?
the longer i'm at java the more i get convinced one allways has to go all the way through i read this in help: You can also choose Organize Imports from the context menu of the import declarations in the Outline view. Note: You can specify the order of the import declarations in preferences Window > Preferences > Java > Code Style > Organize Imports.
but as i didnt actually check that path i was unware of the possibility you just refered
thanks for making that good point
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad: