[英]external panels in swing
I have something like this... 我有这样的东西...
Its a bunch of JLabels within JPanels inside a 它在JPanels内的一堆JLabel
--JFrame --JFrame
--JPanel
--Set<JPanel>
--JLabel object contained in each JPanel object cotained in the set
I want to create an external panel/frame so that each time I hover over each individual JPanel, a new frame/panel pops up giving me some data. 我想创建一个外部面板/框架,以便每次将鼠标悬停在每个JPanel上时,都会弹出一个新的框架/面板,为我提供一些数据。 This will essentially overlap over the JFrame.
这实际上将在JFrame上重叠。
Its pretty brief but I just need some guidance as to what I need to look up. 它很简短,但是我只需要一些有关查找内容的指导。
Maybe you can just use JToolTip. 也许您可以只使用JToolTip。 When the mouse hovers over the label for a couple of seconds it will display automatically.
当鼠标悬停在标签上几秒钟时,它将自动显示。 See the section from the Swing tutorial on How to Use Tool Tips .
请参阅Swing教程中有关如何使用工具提示的部分 。
Or if you want something more complicated use a MouseListener. 或者,如果您想要更复杂的东西,请使用MouseListener。 On
mouseEntered()
you can display a JPopupMenu
or an undecorated JDialog
. 在
mouseEntered()
您可以显示JPopupMenu
或未装饰的JDialog
。
You can start by reading the Swing tutorial on How to Write a Mouse Listener . 您可以先阅读有关如何编写鼠标侦听器的Swing教程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.