![JAR search and dependency download from the Maven repository](/logo.png)
freeseawind.lf.basic.checkboxmenuitem.LuckCheckBoxMenuItemUI Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of littleluck Show documentation
Show all versions of littleluck Show documentation
Java Swing cross platform LookAndFeel
The newest version!
package freeseawind.lf.basic.checkboxmenuitem;
import java.awt.Dimension;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicCheckBoxMenuItemUI;
/**
*
* LuckCheckBoxMenuItemUI实现类, ,在{@link BasicCheckBoxMenuItemUI}基础上做了如下改变:
*
设置CheckBoxMenuItem为不完全透明
* 设置CheckBoxMenuItem最小高度为20
* -------------------------------------------------------------------------------
* LuckCheckBoxMenuItem View UI implementation class,based on
* {@link BasicCheckBoxMenuItemUI} made the following changes:
* Set CheckBoxMenuItem to be not completely transparent
* Set the CheckBoxMenuItem minimum height to 20
*
*
* @see LuckCheckboxMenuItemUIBundle
* @see LuckCheckboxIcon
* @author freeseawind@github
* @version 1.0
*
*/
public class LuckCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI
{
public static ComponentUI createUI(JComponent c)
{
return new LuckCheckBoxMenuItemUI();
}
/**
* * 重写方法,设置菜单的最小高度为20, 否则会出现菜单项大小不一致的情况。 * * Rewrite method, set the minimum height of the menu is 20, otherwise the * menu item size will be inconsistent situation. **/ protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap) { Dimension dimension = super.getPreferredMenuItemSize(c, checkIcon, arrowIcon, defaultTextIconGap); if (dimension != null && dimension.height < 20) { dimension.setSize(dimension.width, 20); } return dimension; } }
© 2015 - 2025 Weber Informatics LLC | Privacy Policy