Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

java - Is it possible to set different look and feel for different panels within a same frame?

Say, I have 3 panels added to a frame and for the 1st panel i want to set the metal look and feel, for the 2nd panel I want windows look and feel, for the third panel it should be default swing style.

is it possible?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The javax.swing.UIManager class, where the look and feel is set, is a singleton. Only one can be set at any one time.

However, you can (if you're so inclined) override UI delegates on individual components (see JComponent.setUI()). Using this method you could probably hack together some components that use UI delegates of alternate look and feels. But in most cases they'll look up the UIDefaults set by the "real" look and feel, so at best it's probably going to be a poor approximation.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...