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


Java Component类代码示例

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


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

示例1: resizeComponents

import org.darkstorm.minecraft.gui.component.Component; //导入依赖的package包/类
@Override
protected void resizeComponents() {
	Theme theme = getTheme();
	Frame[] frames = getFrames();
	Button enable = new BasicButton("Enable");
	Button disable = new BasicButton("Disable");
	Dimension enableSize = theme.getUIForComponent(enable).getDefaultSize(enable);
	Dimension disableSize = theme.getUIForComponent(disable).getDefaultSize(disable);
	int buttonWidth = Math.max(enableSize.width, disableSize.width);
	int buttonHeight = Math.max(enableSize.height, disableSize.height);
	for(Frame frame : frames) {
		if(frame instanceof ModuleFrame) {
			for(Component component : frame.getChildren()) {
				if(component instanceof Button) {
					component.setWidth(buttonWidth);
					component.setHeight(buttonHeight);
				}
			}
		}
	}
	recalculateSizes();
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:23,代码来源:ExampleGuiManager.java

示例2: getComponentUIForClass

import org.darkstorm.minecraft.gui.component.Component; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public ComponentUI getComponentUIForClass(
		Class<? extends Component> componentClass) {
	for(Class<?> componentInterface : componentClass.getInterfaces()) {
		ComponentUI ui = uis.get(componentInterface);
		if(ui != null)
			return ui;
	}
	if(componentClass.getSuperclass().equals(Component.class))
		return uis.get(componentClass);
	else if(!Component.class.isAssignableFrom(componentClass
			.getSuperclass()))
		return null; // WTF?
	return getComponentUIForClass((Class<? extends Component>) componentClass
			.getSuperclass());
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:17,代码来源:AbstractTheme.java

示例3: resizeComponents

import org.darkstorm.minecraft.gui.component.Component; //导入依赖的package包/类
@Override
protected void resizeComponents() {
	Theme theme = getTheme();
	Frame[] frames = getFrames();
	Button enable = new BasicButton("Enable");
	Button disable = new BasicButton("Disable");
	Dimension enableSize = theme.getUIForComponent(enable).getDefaultSize(
			enable);
	Dimension disableSize = theme.getUIForComponent(disable)
			.getDefaultSize(disable);
	int buttonWidth = Math.max(enableSize.width, disableSize.width);
	int buttonHeight = Math.max(enableSize.height, disableSize.height);
	for (Frame frame : frames) {
		if (frame instanceof ModuleFrame) {
			for (Component component : frame.getChildren()) {
				if (component instanceof Button) {
					component.setWidth(buttonWidth);
					component.setHeight(buttonHeight);
				}
			}
		}
	}
	recalculateSizes();
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:25,代码来源:GuiManager.java

示例4: resizeComponents

import org.darkstorm.minecraft.gui.component.Component; //导入依赖的package包/类
@Override
protected void resizeComponents() {
    Theme theme = getTheme();
    Frame[] frames = getFrames();
    Button enable = new BasicButton("Enable", "");
    Button disable = new BasicButton("Disable", "");
    Dimension enableSize = theme.getUIForComponent(enable).getDefaultSize(enable);
    Dimension disableSize = theme.getUIForComponent(disable).getDefaultSize(disable);
    int buttonWidth = Math.max(enableSize.width, disableSize.width);
    int buttonHeight = Math.max(enableSize.height, disableSize.height);
    for (Frame frame : frames) {
        if (frame instanceof ModuleFrame) {
            for (Component component : frame.getChildren()) {
                if (component instanceof Button) {
                    component.setWidth(buttonWidth);
                    component.setHeight(buttonHeight);
                }
            }
        }
    }
    recalculateSizes();
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:23,代码来源:GuiManager.java

示例5: getDefaultComponentSize

import org.darkstorm.minecraft.gui.component.Component; //导入依赖的package包/类
@Override
protected Dimension getDefaultComponentSize(Panel component) {
	Component[] children = component.getChildren();
	Rectangle[] areas = new Rectangle[children.length];
	Constraint[][] constraints = new Constraint[children.length][];
	for(int i = 0; i < children.length; i++) {
		Component child = children[i];
		Dimension size = child.getTheme().getUIForComponent(child)
				.getDefaultSize(child);
		areas[i] = new Rectangle(0, 0, size.width, size.height);
		constraints[i] = component.getConstraints(child);
	}
	return component.getLayoutManager().getOptimalPositionedSize(areas,
			constraints);
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:16,代码来源:SimplePanelUI.java

示例6: render

import org.darkstorm.minecraft.gui.component.Component; //导入依赖的package包/类
public void render(Component component) {
	if(component == null)
		throw new NullPointerException();
	if(!handledComponentClass.isInstance(component))
		throw new IllegalArgumentException();
	if(!component.isVisible())
		return;
	renderComponent(handledComponentClass.cast(component));
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:10,代码来源:AbstractComponentUI.java

示例7: getDefaultSize

import org.darkstorm.minecraft.gui.component.Component; //导入依赖的package包/类
@Override
public Dimension getDefaultSize(Component component) {
	if(component == null)
		throw new NullPointerException();
	if(!handledComponentClass.isInstance(component))
		throw new IllegalArgumentException();
	return getDefaultComponentSize(handledComponentClass.cast(component));
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:9,代码来源:AbstractComponentUI.java

示例8: translateComponent

import org.darkstorm.minecraft.gui.component.Component; //导入依赖的package包/类
protected void translateComponent(Component component, boolean reverse) {
	Component parent = component.getParent();
	while(parent != null) {
		GL11.glTranslated((reverse ? -1 : 1) * parent.getX(), (reverse ? -1 : 1) * parent.getY(), 0);
		parent = parent.getParent();
	}
	GL11.glTranslated((reverse ? -1 : 1) * component.getX(), (reverse ? -1 : 1) * component.getY(), 0);
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:9,代码来源:AbstractComponentUI.java

示例9: getDefaultBackgroundColor

import org.darkstorm.minecraft.gui.component.Component; //导入依赖的package包/类
@Override
public Color getDefaultBackgroundColor(Component component) {
	if(component == null)
		throw new NullPointerException();
	if(!handledComponentClass.isInstance(component))
		throw new IllegalArgumentException();
	return getBackgroundColor(handledComponentClass.cast(component));
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:9,代码来源:AbstractComponentUI.java

示例10: getDefaultForegroundColor

import org.darkstorm.minecraft.gui.component.Component; //导入依赖的package包/类
@Override
public Color getDefaultForegroundColor(Component component) {
	if(component == null)
		throw new NullPointerException();
	if(!handledComponentClass.isInstance(component))
		throw new IllegalArgumentException();
	return getForegroundColor(handledComponentClass.cast(component));
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:9,代码来源:AbstractComponentUI.java

示例11: getInteractableRegions

import org.darkstorm.minecraft.gui.component.Component; //导入依赖的package包/类
@Override
public Rectangle[] getInteractableRegions(Component component) {
	if(component == null)
		throw new NullPointerException();
	if(!handledComponentClass.isInstance(component))
		throw new IllegalArgumentException();
	return getInteractableComponentRegions(handledComponentClass.cast(component));
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:9,代码来源:AbstractComponentUI.java

示例12: handleInteraction

import org.darkstorm.minecraft.gui.component.Component; //导入依赖的package包/类
@Override
public void handleInteraction(Component component, Point location, int button) {
	if(component == null)
		throw new NullPointerException();
	if(!handledComponentClass.isInstance(component))
		throw new IllegalArgumentException();
	handleComponentInteraction(handledComponentClass.cast(component), location, button);
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:9,代码来源:AbstractComponentUI.java

示例13: handleUpdate

import org.darkstorm.minecraft.gui.component.Component; //导入依赖的package包/类
@Override
public void handleUpdate(Component component) {
	if(component == null)
		throw new NullPointerException();
	if(!handledComponentClass.isInstance(component))
		throw new IllegalArgumentException();
	handleComponentUpdate(handledComponentClass.cast(component));
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:9,代码来源:AbstractComponentUI.java

示例14: getComponentUIForClass

import org.darkstorm.minecraft.gui.component.Component; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public ComponentUI getComponentUIForClass(Class<? extends Component> componentClass) {
    for (Class<?> componentInterface : componentClass.getInterfaces()) {
        ComponentUI ui = uis.get(componentInterface);
        if (ui != null) return ui;
    }
    if (componentClass.getSuperclass().equals(Component.class)) {
        return uis.get(componentClass);
    } else if (!Component.class.isAssignableFrom(componentClass.getSuperclass())) return null; // WTF?
    return getComponentUIForClass((Class<? extends Component>) componentClass.getSuperclass());
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:12,代码来源:AbstractTheme.java

示例15: getDefaultComponentSize

import org.darkstorm.minecraft.gui.component.Component; //导入依赖的package包/类
@Override
protected Dimension getDefaultComponentSize(Panel component) {
    Component[] children = component.getChildren();
    Rectangle[] areas = new Rectangle[children.length];
    Constraint[][] constraints = new Constraint[children.length][];
    for (int i = 0; i < children.length; i++) {
        Component child = children[i];
        Dimension size = child.getTheme().getUIForComponent(child).getDefaultSize(child);
        areas[i] = new Rectangle(0, 0, size.width, size.height);
        constraints[i] = component.getConstraints(child);
    }
    return component.getLayoutManager().getOptimalPositionedSize(areas, constraints);
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:14,代码来源:WurstPanelUI.java


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