void () { setUI(new BasicPopupMenuUI() { @Override public void uninstallDefaults() {} @Override public void installDefaults() { if (popupMenu.getLayout() == null || popupMenu.getLayout() instanceof UIResource) { popupMenu.setLayout(new DefaultMenuLayout(popupMenu, BoxLayout.Y_AXIS)); } popupMenu.setOpaque(true); LookAndFeel.installColorsAndFont(popupMenu, "PopupMenu.background", "PopupMenu.foreground", "PopupMenu.font"); } @Override public Popup getPopup(JPopupMenu popup, int x, int y) { PopupFactory factory = PopupFactory.getSharedInstance(); int oldType = -1; boolean isRoundBorder = WindowRoundedCornersManager.isAvailable(); if (isRoundBorder) { oldType = PopupUtil.getPopupType(factory); if (oldType == 2) { oldType = -1; } else { PopupUtil.setPopupType(factory, 2); } } Popup p = super.getPopup(popup, x, y); if (oldType >= 0) { PopupUtil.setPopupType(factory, oldType); } if (isRoundBorder) { Window window = ComponentUtil.getWindow(popup); if (window != null) { if ((SystemInfoRt.isMac && UIUtil.isUnderDarcula()) || SystemInfoRt.isWindows) { WindowRoundedCornersManager.setRoundedCorners(window, JBUI.CurrentTheme.Popup.borderColor(true)); popup.setBorder(null); } else { WindowRoundedCornersManager.setRoundedCorners(window); } } } return p; } }); }