簡體   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