Question

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 ?

Was it helpful?

Solution

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, e.g. Font.SANS_SERIF or 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.

image

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top