Note that there are some explanatory texts on larger screens.

plurals
  1. POSwing Popup menus are not completely painted
    primarykey
    data
    text
    <p>I have this in several areas of an app I'm working on and I can see no way to replicate it outside of this app. I can't create a sscce since I can't manage to replicate this at all - This leads me to believe that it must be something caused by the parent frame / app, but I have no idea where to look.</p> <p>What I see is that part of the left hand side of popup menus are not painted. I see this behaviour with JCombobox popups as well as JPopupMenu's. I've attached a couple of images to show what I mean. most of these did work properly previously and without any changes to the code where the popupmenu's are created or displayed, this problem has spread to a lot of other places now.</p> <p>I'm not mixing heavyweight and lightweight components, as we only use Swing components and the two examples I show below are in completely different parts of the app. The first one is in a fairly simple panel with very little functionality, but the second example (JPoopupMenu) is in a very complex legacy panel. </p> <p>On both of these and other place where I see it, I'm not altering the parent's clipping region at all and in all case, these popups are constructed and displayed on the EDT. </p> <p>I know this question is rather vague, but that is because of the nature of the problem. I'll provide any requested info.</p> <p><img src="https://i.stack.imgur.com/73oGz.jpg" alt="JComboBox popup issue"> This specific case happens to be a custom combobox model, but we've seen it when using the DefaultComboBoxModel as well:</p> <pre><code>public class GroupListModel extends AbstractListModel implements ComboBoxModel{ private List&lt;groupObject&gt; groups; private groupObject selectedItem = null; public GroupListModel() { this(new ArrayList&lt;groupObject&gt;()); } public GroupListModel(List&lt;groupObject&gt; groups) { this.groups = groups; } @Override public int getSize() { return groups.size(); } @Override public Object getElementAt(int index) { if(index&gt;=groups.size()){ throw new IndexOutOfBoundsException(); } return groups.get(index); } public void setGroups(List&lt;groupObject&gt; groups){ this.groups = groups; fireContentsChanged(this, 0, groups.size()); } public void addElement(groupObject group){ groups.add(group); fireIntervalAdded(this, groups.size()-1, groups.size()-1); } public void addElement(groupObject group, int index){ groups.add(index, group); fireIntervalAdded(this, index, index+1); } @Override public void setSelectedItem(Object anItem) { if(anItem instanceof groupObject){ selectedItem = (groupObject) anItem; }else{ throw new IllegalArgumentException(); } fireContentsChanged(this, 0, groups.size()); } @Override public Object getSelectedItem() { return selectedItem; } </code></pre> <p>This is a JPopupMenu that gets displayed when you right click using the following code: <img src="https://i.stack.imgur.com/MUNve.jpg" alt="JPopupMenu paint problem"></p> <pre><code>public void mouseClicked(MouseEvent e) { if( e.getButton()==e.BUTTON3 ){ lastClickedID = tmp.getUniqueID(); lastClickedGui = (bigEventGui) gui; itmComplete.setText( completed ? ctOne.getLang("uncomplete") : ctOne.getLang("complete") ); itmComplete.setIcon( (completed ? iconFramework.getIcon( iconFramework.UNCOMPLETE_ITEM, 24, false) : iconFramework.getIcon( iconFramework.COMPLETE_ITEM, 24, false) )); popRCEvent.show(gui, e.getX(), e.getY() ); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload