简体   繁体   中英

Can I apply a Swing look and feel to AWT widgets?

I'm developing on a legacy Java desktop application mixing Swing and AWT controls. I can successfully apply the system look and feel to Swing controls of course, but can I do the same for AWT ones? If not, can I implement some bridge in any way?

The basic answer is "no". The AWT components are backed by native OS components, either directly (via OS supplied libraries) or indirectly (via AWT based native components). It's possible that AWT will be linked to "older" component libraries so some of the components won't match the current OS "look and feel", which will be using newer component libraries.

In either case, you can't effect how these components look (and certainly not through Swing's Look and Feel API).

Ok, this might be a little hear say, but The Story Of Awt says "Java's GuiToolkit had to use the native widgets provided by the host window system, whether Windows, Motif, or the Mac. Mimicking the look-and-feel in Java wasn't good enough; it had to be the real native components."

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM