本文整理汇总了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();
}
示例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());
}
示例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();
}
示例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();
}
示例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);
}
示例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));
}
示例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));
}
示例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);
}
示例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));
}
示例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));
}
示例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));
}
示例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);
}
示例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));
}
示例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());
}
示例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);
}