Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
    Bookmark Topic Watch Topic
  • New Topic

problem with actionlistener  RSS feed

 
jeevansai jinne
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Report post to moderator
I am trying to make an applet to convert timezones but was getting problem of implementing actionlistener in other class.

This works



But if i split actionlistener into different class like this it do not work .








But both code are same Can someone figure out my mistake not only this code i was unable to implement actionlistener in seperate class in any code everytime i was getting some error but not know why can someone suggest how to implement object oriented methodology properly .
 
Tony Docherty
Bartender
Posts: 3270
82
  • Mark post as helpful
  • send pies
  • Report post to moderator
My comments from your other thread on this subject still stand.

Your class called 'action' (which should be called something like TimeAction - note the upper case first letter and the reason it's not just Action is there is a class in the javax.swing package called Action and whilst duplicate class names in different packages is ok it can getting confusing) should not be extending Clock - what are you trying to achieve by doing so?
If you have extended Clock in the hope it will be able to access the variables declared in the Clock applet you are mistaken as it will be accessing different instances of the variables.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66255
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please continue any discussion your other topic on this matter.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!