Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The basic problem is that the combo's ui delegate can't handle compound editor components. There are several places where it assumes that the editor component is the target of whatever configuration it needs to do. The concrete mis-behaviour here is that it explicitly sets the editor's focusability to that of the combo itself</p> <pre><code>// in BasicComboBoxUI protected void configureEditor() { .... editor.setFocusable(comboBox.isFocusable()); .... ] </code></pre> <p>The implications</p> <ul> <li>by default, the panel's focusable is true because the combo's is true </li> <li>forcing the panel's focusable to false in its constructor has no effect (the ui resets it later on and whenever the LAF is switched)</li> <li>disabling combo's focusable disables the panel's as well</li> </ul> <p>To fix on the level of the editor, you can implement its isFocusable to return false unconditionally:</p> <pre><code>private class PanelEditor extends JPanel implements ComboBoxEditor public boolean isFocusable() { return false; } ... } </code></pre> <p>An aside: for code hygiene, better not <em>extend</em> a view to implement its role as ComboBoxEditor (even though here you need a subclassed JPanel to avoid the problem, so it's arguably borderline :-) - instead implement the editor and let it <em>use</em> the tweaked panel.</p> <p>Also beware that you might stumble into more problems with the compound editor (check the code of BasicComboUI for more places where it assumes a plain childless component), so you might consider not doing it at all but think of a different way to achieve your requirement.</p>
    singulars
    1. This table or related slice is empty.
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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