File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Action interface

 
Mario Skrlec
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everybody.


I know that the code is probably too long, but pleas help. This is an example from Core Java. There are 12 errors whic can all be in a couple
of categries. The first is the Action interface problem. If i try to make a listener or yellowAction for example, then i get an error that there is
an incompatibile type. But the AbstractAction implements Action interface and it should work. On the other hand, if I make an object of ColorAction
or AbstractAction, but not Action, then the static fields in the Action interface cant be accessed with a "cannot find symbol" error message.
This is straight from the book but it doesnt work.

Also, i tried to run some small code fragments with some class extending AbstractAction and i got the same error. I checked the API and
the AbstractAction implements Action so it should work. What am I thinking wrong?
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No errors here, works perfectly with me.
 
Steve Luke
Bartender
Pie
Posts: 4181
21
IntelliJ IDE Java Python
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If i try to make a listener or yellowAction for example, then i get an error that there is
an incompatibile type. But the AbstractAction implements Action interface and it should work.


Most likely you have another class you named Action in your classpath. Find it, rename (and recompile) it, and/or remove it. Then recompile the code above.
 
Mario Skrlec
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had another class named ActionTest. I am sorry for wasting your time!!!
 
Steve Luke
Bartender
Pie
Posts: 4181
21
IntelliJ IDE Java Python
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mario Skrlec wrote:I had another class named ActionTest. I am sorry for wasting your time!!!


Bah:
No question is too simple or too small!
This isn't a waste of time. It is a common mistake and something that happens at least once before you learn to check for it.

I am glad you found the fix.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic