I have a program in java with several Jpanels designed; with certain font and background color for each component on each of my panels. Is there any clean way to change font of jpanels and components on them? I mean I want to bind properties to my components; and as I changed the property; It's influence reflect on all of jpanels.
You might want to investigate the use of different Look and Feels . This will allow you to change pretty much any properties of your components, and you can even change the loof & feel dynamically at runtime.
Also see the answers to this question: How do I get the default font for Swing JTabbedPane labels?
您可以使用JComponent#putClientProperty(Object key,Object value) ,此方法可用于一个JComponent
多个属性
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.