I开发者_JAVA百科 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?
The important thing is to update all components shown in the frame
UIManager.setLookAndFeel(lnfName);
SwingUtilities.updateComponentTreeUI(frame);
frame.pack();
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.
精彩评论