Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have tested default behaviour of a combobox. And when I am scrolling over the popup it is fine it will not close it. But when I scroll outside it or even over the combobox itself then it disappears. </p> <p>I do not know if you are after something like this but I have added the mouse wheel listener to the combobox this way if I detect the movement over the combobox there I am reshowing the popup. -- This bit only partially solves the issue that the mouse wheeling will not show the combo box when scrolling over the combobox.</p> <pre><code>import java.awt.HeadlessException; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class ComboBoxMouseWheel { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createGUI(); } }); } private static void createGUI() throws HeadlessException { String[] items = new String[] { "oasoas", "saas", "saasas" }; final JComboBox jcb = new JComboBox(items); jcb.addMouseWheelListener(new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent e) { System.out.println("ohjasajs"); e.consume(); jcb.showPopup(); } }); JPanel p = new JPanel(); p.add(jcb); JPanel contentPane = new JPanel(); contentPane.add(p); JFrame f = new JFrame(); f.setContentPane(contentPane); f.setSize(300, 300); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); } } </code></pre> <p>I hope this is helpful even a bit. If you manage to solve other way please do share it with us. The solution provided by @trashgod seems doable but it looks so elaborated :), thus I propose mine approach an alternative.</p> <p>Good luck, Boro.</p>
    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.
    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.
 

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