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


Java ProgressBar类代码示例

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


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

示例1: SimpleProgressBarUI

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

	foreground = theme.foreground.brighter();
	background = new Color(64, 64, 128, 128 + 128 / 2);
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:8,代码来源:SimpleProgressBarUI.java

示例2: WurstProgressBarUI

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

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

示例3: SimpleProgressBarUI

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

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

示例4: SimpleProgressBarUI

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

	foreground = Color.LIGHT_GRAY;
	background = new Color(128, 128, 128, 128 + 128 / 2);
}
 
开发者ID:DarkStorm652,项目名称:Minecraft-GUI-API,代码行数:8,代码来源:SimpleProgressBarUI.java

示例5: renderComponent

import org.darkstorm.minecraft.gui.component.ProgressBar; //导入依赖的package包/类
@Override
protected void renderComponent(ProgressBar component) {
	Rectangle area = component.getArea();
	int fontSize = theme.getFontRenderer().FONT_HEIGHT;
	FontRenderer fontRenderer = theme.getFontRenderer();

	translateComponent(component, false);
	glEnable(GL_BLEND);
	glDisable(GL_CULL_FACE);
	glDisable(GL_TEXTURE_2D);

	RenderUtil.setColor(component.getBackgroundColor());
	glLineWidth(0.9f);
	glBegin(GL_LINE_LOOP);
	{
		glVertex2d(0, 0);
		glVertex2d(area.width, 0);
		glVertex2d(area.width, area.height);
		glVertex2d(0, area.height);
	}
	glEnd();

	double barPercentage = (component.getValue() - component.getMinimumValue()) / (component.getMaximumValue() - component.getMinimumValue());
	RenderUtil.setColor(component.getForegroundColor());
	glBegin(GL_QUADS);
	{
		glVertex2d(0, 0);
		glVertex2d(area.width * barPercentage, 0);
		glVertex2d(area.width * barPercentage, area.height);
		glVertex2d(0, area.height);
	}
	glEnd();

	glEnable(GL_TEXTURE_2D);
	String content = null;
	switch(component.getValueDisplay()) {
	case DECIMAL:
		content = String.format("%,.3f", component.getValue());
		break;
	case INTEGER:
		content = String.format("%,d", Long.valueOf(Math.round(component.getValue())));
		break;
	case PERCENTAGE:
		int percent = (int) Math.round((component.getValue() - component.getMinimumValue()) / (component.getMaximumValue() - component.getMinimumValue()) * 100D);
		content = String.format("%d%%", percent);
	default:
	}
	if(content != null) {
		glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
		fontRenderer.drawString(content, component.getWidth() / 2 - fontRenderer.getStringWidth(content) / 2, component.getHeight() / 2 - fontSize / 2, RenderUtil.toRGBA(component.getForegroundColor()));
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	}
	glEnable(GL_CULL_FACE);
	glDisable(GL_BLEND);
	translateComponent(component, true);
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:57,代码来源:SimpleProgressBarUI.java

示例6: getDefaultComponentSize

import org.darkstorm.minecraft.gui.component.ProgressBar; //导入依赖的package包/类
@Override
protected Dimension getDefaultComponentSize(ProgressBar component) {
	return new Dimension(100, 4 + theme.getFontRenderer().FONT_HEIGHT);
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:5,代码来源:SimpleProgressBarUI.java

示例7: getInteractableComponentRegions

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

示例8: renderComponent

import org.darkstorm.minecraft.gui.component.ProgressBar; //导入依赖的package包/类
@Override
protected void renderComponent(ProgressBar component) {
    Rectangle area = component.getArea();
    int fontSize = theme.getFontRenderer().FONT_HEIGHT;
    FontRenderer fontRenderer = theme.getFontRenderer();

    translateComponent(component, false);
    glEnable(GL_BLEND);
    glDisable(GL_CULL_FACE);
    glDisable(GL_TEXTURE_2D);

    RenderUtil.setColor(component.getBackgroundColor());
    glLineWidth(0.9f);
    glBegin(GL_LINE_LOOP);
    {
        glVertex2d(0, 0);
        glVertex2d(area.width, 0);
        glVertex2d(area.width, area.height);
        glVertex2d(0, area.height);
    }
    glEnd();

    double barPercentage = (component.getValue() - component.getMinimumValue()) /
            (component.getMaximumValue() - component.getMinimumValue());
    RenderUtil.setColor(component.getForegroundColor());
    glBegin(GL_QUADS);
    {
        glVertex2d(0, 0);
        glVertex2d(area.width * barPercentage, 0);
        glVertex2d(area.width * barPercentage, area.height);
        glVertex2d(0, area.height);
    }
    glEnd();

    glEnable(GL_TEXTURE_2D);
    String content = null;
    switch (component.getValueDisplay()) {
        case DECIMAL:
            content = String.format("%,.3f", component.getValue());
            break;
        case INTEGER:
            content = String.format("%,d", Math.round(component.getValue()));
            break;
        case PERCENTAGE:
            int percent = (int) Math.round((component.getValue() - component.getMinimumValue()) /
                    (component.getMaximumValue() - component.getMinimumValue()) * 100D);
            content = String.format("%d%%", percent);
        default:
    }
    if (content != null) {
        glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
        fontRenderer.drawString(content, component.getWidth() / 2 - fontRenderer.getStringWidth(content) / 2,
                component.getHeight() / 2 - fontSize / 2, RenderUtil.toRGBA(component.getForegroundColor()));
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    }
    glEnable(GL_CULL_FACE);
    glDisable(GL_BLEND);
    translateComponent(component, true);
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:60,代码来源:WurstProgressBarUI.java

示例9: getDefaultComponentSize

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

示例10: getInteractableComponentRegions

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


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