All Downloads are FREE. Search and download functionalities are using the official Maven repository.

freeseawind.lf.basic.combobox.LuckComboBoxUIBundle Maven / Gradle / Ivy

The newest version!
package freeseawind.lf.basic.combobox;

import java.awt.Color;
import java.awt.Component;
import java.awt.Insets;
import java.awt.Point;
import java.awt.image.BufferedImage;

import javax.swing.JComboBox;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;

import freeseawind.lf.border.LuckBorderField;
import freeseawind.lf.border.LuckNinePatchBorder;
import freeseawind.lf.border.LuckShapeBorder;
import freeseawind.lf.cfg.LuckResourceBundle;
import freeseawind.lf.utils.LuckRes;

/**
 * 
 * ComboboxUI资源绑定类。
 *
 * A ComboboxUI resource bundle class.
 * 
* * @author freeseawind@github * @version 1.0 * */ public class LuckComboBoxUIBundle extends LuckResourceBundle { /** *

* Combobox背景颜色属性key *

* *

* Combobox background color properties. *

*/ public static final String BACKGROUND = "ComboBox.background"; /** *

* Combobox选中时内容背景颜色 (注: 本主题中没有用到该属性) *

* *

* Combobox background color properties when selected. * (Note: This property is not used in this topic) *

*/ public static final String SELECTIONBACKGROUND = "ComboBox.selectionBackground"; /** *

* Combobox弹出菜单中选中时字体颜色 *

* *

* Combobox popup menu font color properties when selected. *

*/ public static final String SELECTIONFOREGROUND = "ComboBox.selectionForeground"; /** *

* [LittleLuck属性]下拉按钮背景颜色属性key, 默认true *

* *

* [LittLeLuck Attributes] arrow button background properties. *

*/ public static final String BUTTONBACKGROUND = "ComboBox.buttonBackground"; /** *

* [LittleLuck属性]下拉按钮获取焦点时背景颜色 *

* *

* [LittLeLuck Attributes] arrow shape color properties * when button has focus. *

*/ public static final String BUTTONFOCUS = "ComboBox.buttonFocus"; /** *

* Combobox边框属性key, 默认间距(3, 4, 3, 4) *

* *

* Combobox border property key, default spacing (3, 4, 3, 4) *

*/ public static final String BORDER = "ComboBox.border"; /** *

* [LittleLuck属性] 下拉列表边框属性key, 默认间距(5, 3, 6, 3) *

* *

* [LittLeLuck Attributes] Popup Menu border property key, * default spacing (5, 3, 6, 3) *

*/ public static final String POPUPBORDER = "ComboBox.poupBorder"; /** *

* [LittleLuck属性] 列表单元边框属性key, 默认间距(0, 4, 0, 0) *

* *

* [LittLeLuck Attributes] Popup Menu renderer border * property key, default spacing (5, 3, 6, 3) *

*/ public static final String RENDERERBORDER = "ComboBox.rendererBorder"; /** *

* [LittleLuck属性] 是否启用焦点边框 *

* *

* [LittleLuck Attributes] Whether to enable the focus * border, default true. *

*/ public static final String ISFOCUSBORDER = "ComboBox.isFocusBorder"; /** *

* [LittleLuck属性] 设置弹出窗口偏移坐标 *

* *

* [LittleLuck Attributes] Popup window offset coordinates * properties. *

*/ public static final String POPUPLOCATION = "ComboBox.popLocation"; public void uninitialize() { UIManager.put(BUTTONBACKGROUND, null); UIManager.put(BUTTONFOCUS, null); UIManager.put(POPUPBORDER, null); UIManager.put(RENDERERBORDER, null); UIManager.put(ISFOCUSBORDER, null); UIManager.put(POPUPLOCATION, null); } @Override protected void installColor(UIDefaults table) { table.put(BACKGROUND, getColorRes(Color.WHITE)); table.put(SELECTIONBACKGROUND, getColorRes(0, 150, 201, 200)); table.put(BUTTONBACKGROUND, getColorRes(Color.WHITE)); table.put(BUTTONFOCUS, getColorRes(245, 171, 84)); table.put(SELECTIONFOREGROUND, getColorRes(Color.WHITE)); } @Override protected void installBorder(UIDefaults table) { Insets insets = new Insets(3, 4, 3, 4); table.put(BORDER, new LuckShapeBorder(insets) { private static final long serialVersionUID = 8164006958194911458L; @Override public LuckBorderField getBorderField(Component c) { JComboBox combox = (JComboBox) c; if(combox.getUI() instanceof LuckBorderField) { return (LuckBorderField)combox.getUI(); } return null; } }); BufferedImage img = LuckRes.getImage("popupmenu/shadow_border.9.png"); UIManager.put(POPUPBORDER, getBorderRes(new LuckNinePatchBorder(new Insets(5, 3, 6, 3), img))); table.put(RENDERERBORDER, getBorderRes(new EmptyBorder(new Insets(0, 4, 0, 0)))); } @Override protected void installOther(UIDefaults table) { table.put(POPUPLOCATION, new Point(0, 1)); table.put(ISFOCUSBORDER, Boolean.TRUE); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy