AbstractGridElement.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:Push2Display 作者:
/**
 * Draws a menu at the top of the element.
 *
 * @param gc The graphics context
 * @param left The left bound of the menus drawing area
 * @param width The width of the menu
 * @param layoutSettings The layout settings to use
 */
protected void drawMenu (final Graphics2D gc, final int left, final int width, final LayoutSettings layoutSettings)
{
    final Color borderColor = layoutSettings.getBorderColor ();
    if (this.menuName == null || this.menuName.length () == 0)
    {
        // Remove the 2 pixels of the previous menus border line
        gc.setColor (borderColor);
        gc.fillRect (left - SEPARATOR_SIZE, MENU_HEIGHT - 2, SEPARATOR_SIZE, 1);
        return;
    }

    final Color textColor = layoutSettings.getTextColor ();

    gc.setColor (this.isMenuSelected ? textColor : borderColor);
    gc.fillRect (left, 0, width, MENU_HEIGHT - 1);

    gc.setColor (textColor);
    gc.fillRect (left, MENU_HEIGHT - 2, width + SEPARATOR_SIZE, 1);

    gc.setColor (this.isMenuSelected ? borderColor : textColor);
    gc.setFont (layoutSettings.getTextFont (UNIT));
    drawTextInBounds (gc, this.menuName, left, 0, width, UNIT + SEPARATOR_SIZE, Label.CENTER);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号