This makes it possible to change the value in disabled JComboBoxes...
protected void installListeners() { .... .... .... this.scrollListener = new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent e) { if ((JoxyComboBoxUI.this.comboBox.isEnabled())) { if (e.getScrollType() == 0) { int currentIndex = JoxyComboBoxUI. this.comboBox.getSelectedIndex(); if (e.getWheelRotation() == 1) { if (currentIndex < JoxyComboBoxUI. this.comboBox.getItemCount() - 1) { JoxyComboBoxUI.this.comboBox.setSelectedIndex( currentIndex + 1); } } if (e.getWheelRotation() == -1) { if (currentIndex > 0) { JoxyComboBoxUI.this.comboBox.setSelectedIndex( currentIndex - 1); } } } } } }; this.comboBox.addMouseWheelListener(this.scrollListener); }
Log in to post a comment.