可以分层ImageIcons吗? [英] Possible to layer ImageIcons?

查看:67
本文介绍了可以分层ImageIcons吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以在Java中对ImageIcons进行分层.我将使用GIF图像,并将有一个ImageIcons网格,代表我的JPane的背景".

I was wondering if it were possible to layer ImageIcons in Java. I will be working with GIF images, and will have a grid of ImageIcons representing the "background" of my JPane.

当特定条件为真时,我需要能够在其他图像之上添加具有透明性的图像.

When a certain condition is true, I need to be able to add an image that has transparency on top of the other image.

关于, 杰克·亨特

推荐答案

是的,并且有两种正确的方法

yes that's possible and there are two correct ways

1)如果只有一个图像,则将 JLabel 图标

1) if is there only one Image then put JLabel with Icon to the GlassPane

2)将 LayeredPane 用于< = Java6(不是Java7用户,那里有JLayer)

2) use LayeredPane for <= Java6 (not Java7 user there is JLayer)

这篇关于可以分层ImageIcons吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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