![](/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.