如何设置Java小程序透明度以显示其后面的内容?
我有一个网页,里面有一个小程序。这个小程序是操作系统拖放操作的放置目标,我只需从文件夹中获取图像,将其拖动到小程序上,就会发生一些事情。
我将此网页提供给图形设计师,他询问是否可以将图像放在 java 小程序后面,以便他可以使用 CSS 模拟更改背景(这是一个皮肤应用程序,图形设计可以在执行过程中更改)。
实际上我应该这样做:
<div>
<applet width="50" height="50" />
</div>
使用这个CSS:
div {
width:50px;
height:50px;
background-image: url(image.jpg) center center no-repeat;
}
但它不起作用(背景不透明)。
是否可以在不失去拖放功能的情况下设置小程序的透明度?
我正在搜索类似于 flash wmode 参数的内容。
更好的解决方案意味着仅更改 CSS/HTML 而无需重新编译 java 类,因此设计团队可以更改页面结构而不更改 Java。
I've got a web page with an applet inside. This applet is a drop target on a drag and drop action from the OS, I simply take an image from a folder, drag it on the applet and something happens.
I give this webpage to a graphic designer and he ask to if he can put an image behind the java applet so he can simulate to change the background using CSS (it is a skinned app and graphic design can change during execution).
Practically i supposed to do:
<div>
<applet width="50" height="50" />
</div>
with this CSS:
div {
width:50px;
height:50px;
background-image: url(image.jpg) center center no-repeat;
}
But it doesn't work (background is opaque).
It is possible to set transparency to the applet without loosing drag and drop capabilities ?
I'm searching something similar to flash wmode parameter.
Better solutions implies only changes on the CSS/HTML without recompiling java class so the designing team can change the page structure without changing the Java.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以将背景图像 URL 作为参数传递到小程序中,或者让小程序使用 Javascript 来询问页面以确定显示什么背景图像。
You might pass the background image URL into the applet as a parameter, or have the applet use Javascript to interrogate the page to determine what background image is shown.
不可能使小程序背景透明,但您可以使用颜色的 alpha 参数来设置小程序组件的透明度,并获得与网站相同的背景,您可以将颜色或图像作为小程序参数传递。但是,如果它是图像,它可能不会像站点那样对齐,除非您将其固定并传递图像的右侧部分。
It is not possible to make an applets background transparent, but you can use the alpha parameter of color to set transparency on components of the applet and to get the same background as the website you could pass the color or image as an applet parameter. However if it's an image, it will probably not be aligned like the site unless you position it fixed and pass the right part of the image.
您可以尝试将小程序代码放在
的
background-color
属性将You can try to put your applet code in a
<td>
tag of a<table>
, and setbackground-color
property of that<td>
to your desired color, the applet will be displayed under that color only.