繁体   English   中英

我想在 Jtextfield 上发生焦点事件时显示一个弹出菜单,生成弹出窗口但 t 不在该文本字段上它应该在的位置

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM