Mediator
Mediator

Reputation: 15378

How to dynamically add a new look and feel?

I want to make sure that the user himself could add L & F. But how to do this I do not understand. it is even possible?

Upvotes: 0

Views: 1681

Answers (2)

Christian Meister
Christian Meister

Reputation: 108

The important thing is to update all components shown in the frame

UIManager.setLookAndFeel(lnfName);
SwingUtilities.updateComponentTreeUI(frame);
frame.pack();

Upvotes: 2

david
david

Reputation: 471

If I got your question right then it is pretty straight forward really. Have a look at http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html. There is even a demo app that lets you change the L&F on the fly.

The important class doing most of the work is UIManager.

Upvotes: 0

Related Questions