当前位置: 首页>>代码示例>>Java>>正文


Java CheckButton类代码示例

本文整理汇总了Java中org.darkstorm.minecraft.gui.component.CheckButton的典型用法代码示例。如果您正苦于以下问题:Java CheckButton类的具体用法?Java CheckButton怎么用?Java CheckButton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CheckButton类属于org.darkstorm.minecraft.gui.component包,在下文中一共展示了CheckButton类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: WurstCheckButtonUI

import org.darkstorm.minecraft.gui.component.CheckButton; //导入依赖的package包/类
WurstCheckButtonUI(WurstTheme theme) {
    super(CheckButton.class);
    this.theme = theme;

    foreground = Color.WHITE;
    background = new Color(0.125f, 0.125f, 0.125f, 0.25f);
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:8,代码来源:WurstCheckButtonUI.java

示例2: SimpleCheckButtonUI

import org.darkstorm.minecraft.gui.component.CheckButton; //导入依赖的package包/类
SimpleCheckButtonUI(SimpleTheme theme) {
    super(CheckButton.class);
    this.theme = theme;

    foreground = Color.WHITE;
    background = new Color(128, 128, 128, 128);
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:8,代码来源:SimpleCheckButtonUI.java

示例3: getDefaultComponentSize

import org.darkstorm.minecraft.gui.component.CheckButton; //导入依赖的package包/类
@Override
protected Dimension getDefaultComponentSize(CheckButton component) {
    return new Dimension(
            theme.getFontRenderer().getStringWidth(component.getText()) + theme.getFontRenderer().FONT_HEIGHT + 6,
            theme.getFontRenderer().FONT_HEIGHT + 4);
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:7,代码来源:WurstCheckButtonUI.java

示例4: getInteractableComponentRegions

import org.darkstorm.minecraft.gui.component.CheckButton; //导入依赖的package包/类
@Override
protected Rectangle[] getInteractableComponentRegions(CheckButton component) {
    return new Rectangle[]{new Rectangle(0, 0, component.getWidth(), component.getHeight())};
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:5,代码来源:WurstCheckButtonUI.java

示例5: handleComponentInteraction

import org.darkstorm.minecraft.gui.component.CheckButton; //导入依赖的package包/类
@Override
protected void handleComponentInteraction(CheckButton component, Point location, int button) {
    if (location.x <= component.getWidth() && location.y <= component.getHeight() && button == 0) component.press();
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:5,代码来源:WurstCheckButtonUI.java

示例6: renderComponent

import org.darkstorm.minecraft.gui.component.CheckButton; //导入依赖的package包/类
@Override
protected void renderComponent(CheckButton button) {
    translateComponent(button, false);
    Rectangle area = button.getArea();
    glEnable(GL_BLEND);
    glDisable(GL_CULL_FACE);

    glDisable(GL_TEXTURE_2D);
    RenderUtil.setColor(button.getBackgroundColor());
    int size = area.height - 4;
    glBegin(GL_QUADS);
    {
        glVertex2d(2, 2);
        glVertex2d(size + 2, 2);
        glVertex2d(size + 2, size + 2);
        glVertex2d(2, size + 2);
    }
    glEnd();
    if (button.isSelected()) {
        glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
        glBegin(GL_QUADS);
        {
            glVertex2d(3, 3.5);
            glVertex2d(size + 0.5, 3.5);
            glVertex2d(size + 0.5, size + 1);
            glVertex2d(3, size + 1);
        }
        glEnd();
    }
    glLineWidth(1.0f);
    glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
    glBegin(GL_LINE_LOOP);
    {
        glVertex2d(2, 2);
        glVertex2d(size + 2, 2);
        glVertex2d(size + 2, size + 2);
        glVertex2d(2 - 0.5, size + 2);
    }
    glEnd();
    Point mouse = RenderUtil.calculateMouseLocation();
    Component parent = button.getParent();
    while (parent != null) {
        mouse.x -= parent.getX();
        mouse.y -= parent.getY();
        parent = parent.getParent();
    }
    if (area.contains(mouse)) {
        glColor4f(0.0f, 0.0f, 0.0f, Mouse.isButtonDown(0) ? 0.5f : 0.3f);
        glBegin(GL_QUADS);
        {
            glVertex2d(0, 0);
            glVertex2d(area.width, 0);
            glVertex2d(area.width, area.height);
            glVertex2d(0, area.height);
        }
        glEnd();
    }
    glEnable(GL_TEXTURE_2D);

    String text = button.getText();
    theme.getFontRenderer().drawString(text, size + 4, area.height / 2 - theme.getFontRenderer().FONT_HEIGHT / 2,
            RenderUtil.toRGBA(button.getForegroundColor()));

    glEnable(GL_CULL_FACE);
    glDisable(GL_BLEND);
    translateComponent(button, true);
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:68,代码来源:SimpleCheckButtonUI.java


注:本文中的org.darkstorm.minecraft.gui.component.CheckButton类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。