![](/img/trans.png)
[英]How to make a popup menu added to a JtextField to be invisible when the JTextField's focus is lost?
[英]i want to show a popup menu when there is a focus event occur on a Jtextfield,popup is generated but t is not over that textfield where it should be
timePopUp.setPopupSize(100, 50);
timePopUp.setLocation(fieldName.getX(),fieldName.getY());
timePopUp 是 JPopupMenu 的变量名
尝试使用SwingUtilities.convertPointToScreen
将点转换为屏幕,看看它是否有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.