简体   繁体   中英

how to have multiple look and feel in a single swing application

I am using Nimbus look and feel in my Swing project.

Its displaying the excellent look in the project but JEditorPane is not displaying the proper font format when applying Nimbus look and feel

So is it possible to have multiple look and feels for single application? By default the project takes the look and feel applied on the main screen. Can it change the look and feel in between the project execution ?

What you suggest is technically possible, but the approach is fragile for any but the most well-encapsualted default used by a well-behaved UI delegate implementation. In this example , a borrowed JTree icon is shown. For your application, the relevant key is "EditorPane.font". If you change it, some things to keep in mind:

  • Prefer a logical font family to a physical font, eg Font.SANS_SERIF or Font. DIALOG Font. DIALOG .

  • Consider using the deriveFont() method to alter the existing default.

  • Test extensively on your target platform(s).

  • Consider an alternate approach, where possible.

图片

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM