透明度和 JPanel
我想在单击 JTable 上的编辑按钮时显示一个表单。显示的表单应与 JTable 重叠,并且应使 jTable 变暗(就像具有透明度的黑色背景一样)。我该怎么做?我是否必须在创建 JFrame 期间将 jPanel 添加到窗口,还是应该将面板创建为单独的文件并在单击按钮时使其可见。告诉我该怎么做?
编辑
与此类似的内容
编辑 2
您已使用 JOption 窗格,另一个建议是使用 JDialog。但如果我使用其中任何一个,我都无法创建子窗口。我只需要从弹出的 Jdialog 窗口中调用虚拟键盘即可。我无法访问键盘,因为 JDialog 保持焦点。如何解决这个问题?
编辑 3
当前的问题是,我正在使用虚拟键盘在使用 JDialog 显示的表单中键入值。现在我无法打开虚拟键盘并使其处于活动状态。即使我打开它,它也在 JDialog 后面,并且焦点仍然在 JDialog 上。我需要关闭 JDialog 才能使用虚拟键盘。
I want to show a form when i click on edit button on the JTable. The form that is displayed should overlap the JTable and should darken the jTable (just like a black background with transparency). How do i do this ? Do i have to add the jPanel to the window during creation of JFrame or shall i create the panel as a separate file and make it visible when the button is clicked. Tell me how to do this ?
EDIT
Something similar to this
EDIT 2
You have used JOption pane and the other suggestion was to use JDialog. But if i use either of those i cant create child window. I just need to call virtual keyboard from the popped up Jdialog window. I cant access the keyboard as the JDialog is holding the focus. How to solve this issue ?
EDIT 3
The current problem is, i am using virtual keyboard for typing the values in the form displayed by using JDialog. Now i cant able to open the virtual Keyboard and make it active. Even if i open it it is behind the JDialog and the focus is still with JDialog. I need to close the JDialog for using the virtual keyboard.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我回答得有点晚,因为我正在创建一个测试程序,但我的想法与安德鲁的想法相同(对不起安德鲁,安德鲁1+):
I'm a little late in answering as I was creating a test program, but my idea is the same as Andrew's (sorry Andrew, and 1+ to Andrew):
请参阅 Java 教程中的如何使用根窗格。从屏幕截图来看,您需要弹出一个
JOptionPane
(或JDialog
)作为输入,并在玻璃窗格上绘制阴影。See How to Use Root Panes in the Java Tutorial. From the screen-shot it appears you need to pop a
JOptionPane
(orJDialog
) for the input and draw the shading on the glass pane.