我可以将图像放置在JFrame之外吗? [英] Can I place image outside JFrame?

查看:45
本文介绍了我可以将图像放置在JFrame之外吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在 JFrame外面放置图像吗?

Can I place an image outside JFrame?

我正在开发一个应用程序,我想使Gui看起来更好,并且按钮的某些部分应该放在外面.有办法吗?

I am developing an app, and I wanted to make the Gui good looking and some part of the buttons should go outside. Is there a way to do this?

推荐答案

是的,但这并不容易,因为您将不断需要监视父框架的位置以保持子框架的位置窗口.

Yes, but it's not going to be easy, as you going to constantly need to monitor the position of the parent frame in order to maintain the position of the child window.

基本上,您可以做的是创建第二个未装饰的透明窗口.您需要对齐父窗口旁边的窗口并调整其大小.

Essentially, what you can do is create a second, undecorated and transparent window. You would need to align and size the window next to the parent window.

在此子窗口上,然后需要添加一个透明的组件作为您的主要容器.

On to this child window, you would need to then add a transparent component which would act as your primary container.

看看如何创建半透明和异形的窗口了解更多详情

例如:

  • How to draw images on transparent window?
  • How to make a transparent JFrame but keep everything else the same?
  • Creating a JFrame you can click through

这篇关于我可以将图像放置在JFrame之外吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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