You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2026/05/23 12:39:58 UTC
(cayenne) branch master updated: CayenneModeler .. Messy combo box sizing for editable popups
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git
The following commit(s) were added to refs/heads/master by this push:
new 35bc313e2 CayenneModeler .. Messy combo box sizing for editable popups
35bc313e2 is described below
commit 35bc313e20691a4cc12c8413e528cd4f297c1934
Author: Andrus Adamchik <an...@objectstyle.com>
AuthorDate: Sat May 23 08:39:51 2026 -0400
CayenneModeler .. Messy combo box sizing for editable popups
fixing an issue on windows
---
.../modeler/toolkit/table/CMComboBoxCellEditor.java | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/toolkit/table/CMComboBoxCellEditor.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/toolkit/table/CMComboBoxCellEditor.java
index 1cc28d3b9..d0e207a77 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/toolkit/table/CMComboBoxCellEditor.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/toolkit/table/CMComboBoxCellEditor.java
@@ -62,7 +62,21 @@ public class CMComboBoxCellEditor extends AbstractCellEditor
comboBox.addPopupMenuListener(new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
+ // First call: sets popup.preferredSize so the popup *window* is created at the
+ // correct width (window size is determined from popup.preferredSize before show()).
adjustPopupWidth();
+ // Second call via invokeLater: BasicComboPopup.show() calls getPopupLocation()
+ // *after* firing this listener, which re-constrains scroller.maxSize back to the
+ // column width. Running again on the next EDT cycle fixes the scroller, then
+ // revalidate/repaint forces the layout to update inside the already-wide window.
+ SwingUtilities.invokeLater(() -> {
+ adjustPopupWidth();
+ Object child = comboBox.getUI().getAccessibleChild(comboBox, 0);
+ if (child instanceof JPopupMenu popup) {
+ popup.revalidate();
+ popup.repaint();
+ }
+ });
}
@Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {}
@Override public void popupMenuCanceled(PopupMenuEvent e) {}