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

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

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

import java.awt.Color;

import javax.swing.ButtonModel;
import javax.swing.JComponent;

import freeseawind.lf.border.LuckBorderField;
import freeseawind.lf.controller.LuckArrowButton;

/**
 * Combobox下拉按钮,没有找到合适的图片素材替换(T T), 这里使用Java2D绘制的箭头按钮实现类
 *
 * @see LuckArrowButton
 * @see LuckBorderField
 * @author freeseawind@github
 * @version 1.0
 *
 */
public abstract class LuckComboBoxButton extends LuckArrowButton
{
    private static final long serialVersionUID = 7344386766250021707L;

    public LuckComboBoxButton(int direction)
    {
        super(direction);
    }

    /**
     * Gets the border property of the parent container
     *
     * @return LuckBorderField
     */
    public abstract LuckBorderField getBorderField();

    /**
     * Gets the parent container
     *
     * @return JComponent
     */
    public abstract JComponent getParentComp();

    /**
     * Gets the arrow color
     *
     * @param model ButtonModel
     * @return Color Gets the color in the current state.
     */
    protected Color getArrowColor(ButtonModel model)
    {
        if (getModel().isPressed() || getModel().isRollover()
                || getBorderField().isFocusGaind())
        {
            return highlight;
        }

        return normal;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy