本文整理匯總了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);
}