java - Extending existing Swing look and feels with custom JComponents -
I am writing a custom Now, while this work seems quite easy, I do not know how to easily expand and realize an existing form with my custom How do I think about registering the correct To be a bit more specific, at this time I am overriding the But this approach completely defeats the utility of purpose and utilization altogether. I want to be able to convert it to: And to see and feel it at the right time, set the correct sub class of I know, That I can easily get it by creating custom subclasses of each supported If you want it or not - to register your custom UI in some way with UINGER If you is , then you may know more about them; -) T is needed, however, is a custom subclass of supported LAFs: You can manually register them (and you can update the registration once the LF is changed, so you can use the UINEG But a property is needed) in such a case will be informed. A JCIFT and UI implementation with the "Custom UI" classified after the general conventions (basic custom UI, Windows Custom UI ...) Registration will be something like this: Note that custom UI requires static createUI which gives an example of UEE: and the component needs to publish its uiClassID, and set its UI: The advantage of using SwingX is to provide basic facilities to automatically register custom components. You'll need an additional class - customaddon - which provides per-lf configuration and contributes to the custom component in that edition: JComponent which should look different for different forms and It seems that I intend to have at least the different
ComponentUi classes for
WindowsLookAndFeel ,
MetalLookAndFeel and
MotifLookAndFeel .
ComponentUi classes.
ComponentUi for different forms and think? Is this possible at all? If not, what is the most preferred way of writing a custom component to look different?
JComponent # updateUI different
ComponentUi example to set my In custom component:
@Override Public Zero Update (UI) (LookIFeel Feel = UIManager.getLookAndFeel (); If (for example WindowsLookAndFeel looks) {setUI (MyWindowsCustomUi.createUI (this)); } And if (for example MotifLookAndFeel) {setUI (MyMotivCustomUi.createUI (this)); } And if (for example MetalLookAndFeel) {setUI (MyMetalCustomUi.createUI (this)); } Other {setUI (MyBasicCustomUi.createUI (this)); }}
Public Zero Update (UI) (setUI (MyCustomUi) UIManager.getUI (this)); }
MyCustomUi
LookAndFeel , which register related
ComponentUi during that time
BasicLookAndFeel #initComponentDefaults (UIDefaults) - but this is not what I want to do.
string prefix = UIManager.getLookAndFeel (). GetID (); UIManager.getLookAndFeelDefaults (). Put ("CustomUI", myUIPackage + "." + Prefix + custom UI);
public static component UI createdUI (JCMPNAP) [new Basic Custom UI Refund (); }
@Override public string getUIClassID () {"CustomUI" Return; } @ Override Public Owned Update (UII) (Set UI (UINAZ.AR.JET) (this); }
Comments
Post a Comment