如何在鼠标Cliked的另一个JPanel上添加JPanel [英] How to add a JPanel on another JPanel where mouse Cliked
本文介绍了如何在鼠标Cliked的另一个JPanel上添加JPanel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在研究我的主要项目。这是一个可以绘制和检查逻辑电路是否正常工作的项目...
我想在另一个上画一个JPanel(比如说AND门) JPanel(让我们说帆布)
在我点击Canvas的地方..
怎么做请告诉我......!
提前致谢...
I am working on my major project. ITs a project where Logical Circuits can be draw and checked whether its working or not correctly...
I want to draw a JPanel(let say AND gate) on another JPanel(Let say Canvas)
at the point where I click on Canvas..
How to do it please tell me...!
Thanks in advance...
推荐答案
请以某种格式说明您的解释。
当我尝试阅读时,我会头疼。
调整大小:
面板的位置在调整大小的那一刻不再有效。
使用百分比值创建头寸
- relative
可以用来计算新的位置
- 绝对
使用像素并且没有缩放效果。
在两个选项中你必须重新绘制所有GUI - 而不仅仅是基本的主要JPanel。
please at some format to your explanation.
I get a headache when I try to read that.
Resize:
The positions for your Panels are no more valid in that moment of resize.
Make the position
- relative
using percent values, which you can use to calculate the new position
- absolute
using pixels and having no zoom effect.
in both options you have to repaint ALL the GUI - not just the basic main JPanel.
这篇关于如何在鼠标Cliked的另一个JPanel上添加JPanel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文