當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。