File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Overriding the refresh method from the custom panel class. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Overriding the refresh method from the custom panel class." Watch "Overriding the refresh method from the custom panel class." New topic
Author

Overriding the refresh method from the custom panel class.

Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 590
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
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2176
    
  47
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Overriding the refresh method from the custom panel class.
 
Similar Threads
Need Advice
How to add a gui from different class
How to launch JInternalFrame from a JTabbedPane
When to use JSF 2 Renderer for custom component
keyboard shortcuts to move between tabs inJTabbedPane