• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Overriding the refresh method from the custom panel class.

 
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to let the refresh method be abstract from my custom panel class
since I need to refresh the inherited panels when things have changed (they are added to
a JTabbedPane). Now my question is should I put the initialization code there within
the refresh method so that it can be reused as well.
But my problem is as the object of those panels are member
variables of the parent class, all the listeners could have been
added twice and some peculiar results would come out.
I thought about divide them into 2 methods. One called
setup(), one refresh(), setup() is used for
initalization and refresh() is used for
JTabbedPane refreshing, but I don't know if I have done too much
for the class. What do you think?
Thanks
Jack
 
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure I fully understand your problem but what I can say is a method should do exactly what it's name implies it does and nothing more. Methods should also be named to suggest they do one thing as per your method name of refresh. So, as your method is called refresh it should not be doing setup, that task is for a method called setup, initialise or some other such name.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic