简体   繁体   中英

Transparent JFrame background, but visible contents

I'm trying to make a desktop widget using Java, basically what it is, a clock that looks like the Sense Clock Widget from HTC android phones.

Everything is set, clock works and I have a background and clock hour/minute images. The only thing I need is to make the JFrame background transparent. The JFrame is undecorated and can be moved around by its content, just like any widget should act.

I need to figure out how to make the ugly JFrame background from grey to transparent but keep the contents opaque.

frame.setBackground(new Color(0,0,0,0));

The frame is transparent but the content is visible.

结果的形象

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