Erm, it is still WORA.

I suggest a TreeUI which allows you to plugin the OS TreeUI. The custom tree
UI would call methods in the plugged-in TreeUI, except where those methods
needed to be overridden.

-----Original Message-----
From: CLARK,RAND (HP-Roseville,ex1) <[EMAIL PROTECTED]>
To: '[EMAIL PROTECTED]' <[EMAIL PROTECTED]>
Date: Friday, March 23, 2001 08:34
Subject: subclassing BasicXXXUI classes


>I am writing an application for both the Win32 and Mac platforms.  On each,
>it will run under the respective system look and feel.
>
>In doing my development on Win32 I needed to subclass BasicTreeUI to get
>some specialized behavior in a tree.  I did all the necessary work to
>register my class with the UIManager and all went well.  After moving my
app
>to the Mac, the tree does not behave properly at all.  Analyzing the
>problem, I now realize that by subclassing BasicTreeUI (call my new class
>MyBasicTreeUI) I am effectively cutting myself off from any system-specific
>behavior, as specified in WindowsTreeUI and MacTreeUI, both of which
inherit
>from BasicTreeUI.  MyBasicTreeUI is essentially a peer of these two
classes.
>
>I now know that I somehow need to incorporate the behavior in WindowsTreeUI
>and MacTreeUI, depending on where the app is running.  But, how is that
done
>elegantly?  One way is to create two new classes, one a subclass of
>WindowsTreeUI and one a subclass of MacTreeUI; at runtime, detect the
>platform and register the appropriate UI class.  What I don't like about
>this is: 1)I need to create 2 new classes, with probably the same code in
>each; and 2)there needs to be a runtime platform check.  So much for WORA!
>
>Any ideas on this?  Ideally, I need to inject my class into the hierarchy
so
>it exists like this: BasicTreeUI is superclass of MyBasicTreeUI is
>superclass to WindowsTreeUi and to MacTreeUI.  I don't know any way to do
>this.  Someone suggested modifying Swing source to change the inheritance,
>but I can't imagine that that is legal license-wise, is it?
>
>Thanks for your thoughts on this, rand
>
>--------------------------------
>Rand Clark
>Software Design Engineer
>Transoft Networks
>a Hewlett-Packard company
>805.883.4315
>[EMAIL PROTECTED]
>--------------------------------
>
>_______________________________________________
>Advanced-swing mailing list
>[EMAIL PROTECTED]
>http://eos.dk/mailman/listinfo/advanced-swing

_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to