Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Extending classes at runtime

807580Apr 27 2010 — edited Apr 29 2010
Hi,
Is there a way to extend a class at runtime? What I'd like to do is the following:
I want to have a tabbed pane component that does not stretch its tabs when there are several lines of tabs. The stretching of the tabs is implemented in the UI component of JTabbedPane - and this depends on the look & feel - it can be MetalTabbedPaneUI, WindowsTabbedPaneUI, etc.
I want to extend the currently-used UI class (which is only known at runtime) with my own class that overrides a single method.
I can extend all those that I currently know and use some mapping from the currently used class to the one extending it - but tomorrow someone may install a new look & feel which uses a different UI component, for which I will not have an extending class.
Therefore, I'd like to find the currently used UI component class and extend it at runtime.
Thanks,
Shlomy
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 27 2010
Added on Apr 27 2010
16 comments
498 views