Resizing JPopupMenu and avoiding a "flicker" issue

Posted by Avrom on Stack Overflow See other posts from Stack Overflow or by Avrom
Published on 2010-05-27T15:58:58Z Indexed on 2010/05/27 16:01 UTC
Read the original article Hit count: 352

Filed under:
|
|
|
|

Hi,

I am trying to implement a search results popup list similar to the style found here:

http://www.inquisitorx.com/

(I'm not trying to implement a Google search, I'm just using this as a rough example of the style I'm working on.)

In any event, I am implementing this by using a JList contained within a JPopupMenu which is popped up underneath a JTextField.

When a user enters search terms, the list changes to reflect different matching results. I then call pack on the JPopupMenu to resize it. This works, however, it creates a slight flicker effect since it is actually hiding the popup and showing a popup. (See the private method getPopup in JPopupMenu where it explicitly does this.)

Is there any way to just get it to just resize itself (aside from using a JWindow)?

© Stack Overflow or respective owner

Related posts about java

Related posts about swing