使JPanel不绘制其背景(透明) [英] Make a JPanel not draw its background (Transparent)

查看:74
本文介绍了使JPanel不绘制其背景(透明)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Java中,是否有可能使 JPanel 跳过绘制背景,因此除了上面的组件外,它是透明的?

Is it possible, in Java, to make a JPanel skip drawing its background thus being transparent except for the components on it?

推荐答案

setOpaque(false)

它' ll将背景绘制到其父级,可以绘制自己的背景。

It'll pass off painting the background to its parent, which may draw its own background.

您可以进行屏幕捕获,然后使用它来绘制面板的背景。

You can do a screen capture and then use that to paint the background of the panel.

这篇关于使JPanel不绘制其背景(透明)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆