mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-187873 Use Custom popup in Win10 and Mac lafs too
This commit is contained in:
+14
-13
@@ -78,7 +78,7 @@ public class DarculaComboBoxUI extends BasicComboBoxUI implements Border, ErrorB
|
||||
|
||||
@Override
|
||||
protected ComboPopup createPopup() {
|
||||
return (comboBox instanceof ComboBoxWithWidePopup) ? new WidePopup(comboBox) : super.createPopup();
|
||||
return new CustomComboPopup(comboBox);
|
||||
}
|
||||
|
||||
protected PropertyChangeListener createPropertyListener() {
|
||||
@@ -505,26 +505,27 @@ public class DarculaComboBoxUI extends BasicComboBoxUI implements Border, ErrorB
|
||||
}
|
||||
|
||||
// Wide popup that uses preferred size
|
||||
private static class WidePopup extends BasicComboPopup {
|
||||
public WidePopup(JComboBox combo) {
|
||||
protected static class CustomComboPopup extends BasicComboPopup {
|
||||
public CustomComboPopup(JComboBox combo) {
|
||||
super(combo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(Component invoker, int x, int y) {
|
||||
Dimension popupSize = comboBox.getSize();
|
||||
Dimension prefSize = comboBox.getPreferredSize();
|
||||
Insets insets = getInsets();
|
||||
if (comboBox instanceof ComboBoxWithWidePopup) {
|
||||
Dimension popupSize = comboBox.getSize();
|
||||
Dimension prefSize = comboBox.getPreferredSize();
|
||||
Insets insets = getInsets();
|
||||
|
||||
popupSize.width = Math.max(popupSize.width, prefSize.width);
|
||||
popupSize.setSize(popupSize.width - (insets.right + insets.left), getPopupHeightForRowCount(comboBox.getMaximumRowCount()));
|
||||
popupSize.width = Math.max(popupSize.width, prefSize.width);
|
||||
popupSize.setSize(popupSize.width - (insets.right + insets.left), getPopupHeightForRowCount(comboBox.getMaximumRowCount()));
|
||||
|
||||
scroller.setMaximumSize(popupSize);
|
||||
scroller.setPreferredSize(popupSize);
|
||||
scroller.setMinimumSize(popupSize);
|
||||
|
||||
list.revalidate();
|
||||
scroller.setMaximumSize(popupSize);
|
||||
scroller.setPreferredSize(popupSize);
|
||||
scroller.setMinimumSize(popupSize);
|
||||
|
||||
list.revalidate();
|
||||
}
|
||||
super.show(invoker, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -31,7 +31,6 @@ import javax.swing.border.Border;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicArrowButton;
|
||||
import javax.swing.plaf.basic.BasicComboBoxEditor;
|
||||
import javax.swing.plaf.basic.BasicComboPopup;
|
||||
import javax.swing.plaf.basic.ComboPopup;
|
||||
import java.awt.*;
|
||||
import java.awt.event.FocusAdapter;
|
||||
@@ -277,7 +276,7 @@ public class MacIntelliJComboBoxUI extends DarculaComboBoxUI {
|
||||
|
||||
@Override
|
||||
protected ComboPopup createPopup() {
|
||||
return new BasicComboPopup(comboBox) {
|
||||
return new CustomComboPopup(comboBox) {
|
||||
@Override
|
||||
protected void configurePopup() {
|
||||
super.configurePopup();
|
||||
|
||||
+3
-3
@@ -34,7 +34,6 @@ import javax.swing.event.PopupMenuEvent;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicArrowButton;
|
||||
import javax.swing.plaf.basic.BasicComboBoxEditor;
|
||||
import javax.swing.plaf.basic.BasicComboPopup;
|
||||
import javax.swing.plaf.basic.ComboPopup;
|
||||
import javax.swing.text.JTextComponent;
|
||||
import java.awt.*;
|
||||
@@ -517,8 +516,9 @@ public class WinIntelliJComboBoxUI extends DarculaComboBoxUI {
|
||||
}
|
||||
|
||||
|
||||
@Override protected ComboPopup createPopup() {
|
||||
return new BasicComboPopup(comboBox) {
|
||||
@Override
|
||||
protected ComboPopup createPopup() {
|
||||
return new CustomComboPopup(comboBox) {
|
||||
@Override
|
||||
protected void configurePopup() {
|
||||
super.configurePopup();
|
||||
|
||||
Reference in New Issue
Block a user