遭遇 comp... be showing ... determine its location
原始發表時間:2010-02-10
使用JPopupMenu控制元件時,遭遇component must be showing on the screen to determine its
location
在一個Swing開發的應用介面中,使用JPopupMenu控制元件,結果發現,每次要show這個彈出選單的時候,總會出現如下異常:
java.awt.IllegalComponentStateException:
component must be showing on the screen to determine its location
…………
上網查詢有的通報說是sun的jdk所包含的bug,也有其他解決方法。
最終我這邊找到程式碼中的問題是:程式沒有為JPopupMenu這個物件設定歸屬物件,由於之前的程式碼沒有提交SVN,Local
History中也沒有找回來,所以原始的問題程式碼已經找不到了。
印象中,當時編寫的時候,呼叫了JPopupMenu的某個設定歸屬物件的方法,設定了某個JPanel為JPopupMenu的歸屬物件,而在使用JPopupMenu的show方法展現該選單時,卻使用的是某個JButton為JPopupMenu的invoker引數的值,可能因此而導致了上面的異常。
解決方法就是,去除JPopupMenu與那個JPanel的歸屬關係的關聯程式碼。
由於沒有問題程式碼,本文只是提供對類似問題的一種思路,之前另外一個系統中的Table的CellEditor使用JComboBox作為容器時也會出現這種問題,估計原因也是因為歸屬關係不明確造成,JComboBox中的彈出選單無法定位而導致的。
相關文章
- Physical Standby Switchover_status Showing Not Allowed
- How to Determine When an Index Should be Rebuilt?IndexUI
- Put email in its placeAI
- Location物件物件
- nginx locationNginx
- <location> 元素
- location.href和location.replace()區別
- 6 Thing that determine composite cost
- How boltdb Write its Data?
- ITS WEBGUI in ECC6.0WebGUI
- Physical Standby Switchover_status Showing Not Allowed._1392763.1
- nginx location指令Nginx
- Nginx Location 配置Nginx
- location.protocolProtocol
- JavaScript location 物件JavaScript物件
- nginx location配置Nginx
- Starting httpd: httpd: Could not reliably determine the serverhttpdServer
- window.location.href與window.location.hash區別
- 7 、shrink table and its dependent segments
- Maintain Internet Transaction Server (ITS)AIServer
- nginx location 的配置Nginx
- BOM之location物件物件
- Storage location 地址資訊
- Physical Standby Switchover_status Showing Not Allowed. (Doc ID 1392763.1)
- www/wwwroot/storage/logs" and its not b
- pyttsx3 and its alternativesTTS
- IBM WAS Service--Could not determine the process id of the javaprocess.IBMJava
- 實體類註解錯誤:Could not determine type for:
- nginx location匹配規則Nginx
- Nginx Location 路徑匹配Nginx
- nginx的location優化Nginx優化
- Nginx Location配置總結Nginx
- nginx的location詳解Nginx
- For oracle databases, if the top showing the oracle database, then oracle process is using the top cOracleDatabase
- Spring Boot配置錯誤:Failed to determine a suitable driver classSpring BootAIUI
- AIX: HOW TO DETERMINE WHICH VERSION OF HACMP IS INSTALLED [ID 1057292.6]AIACM
- nginx的location匹配順序、優先順序,location對映衝突排查Nginx
- ORA-15055 ASM Diskgroup Status Showing Dismounted From RDBMS InstanceASM