Here you can find the source of cleanPopupLayoutMetrics(JPopupMenu popupMenu)
Parameter | Description |
---|---|
popupMenu | Popup menu. |
public static void cleanPopupLayoutMetrics(JPopupMenu popupMenu)
//package com.java2s; import java.awt.Component; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; public class Main { /**//ww w . java2 s. co m * Key to store the layout metrics. The value should be an instance of * {@link MenuLayoutMetrics}. */ private static final String LAYOUT_METRICS = "substancelaf.internal.menus.layoutMetrics"; /** * Cleans the layout metrics of the popup menu of the specified menu item. * * @param menuItem * Menu item. */ private static void cleanPopupLayoutMetrics(JMenuItem menuItem) { Component comp = menuItem.getParent(); if (comp instanceof JPopupMenu) { JPopupMenu popupMenu = (JPopupMenu) comp; cleanPopupLayoutMetrics(popupMenu); } } /** * Cleans the layout metrics of the specified popup menu. * * @param popupMenu * Popup menu. */ public static void cleanPopupLayoutMetrics(JPopupMenu popupMenu) { if (popupMenu != null) { popupMenu.putClientProperty(LAYOUT_METRICS, null); } } }