本文整理汇总了Java中org.darkstorm.minecraft.gui.layout.Constraint类的典型用法代码示例。如果您正苦于以下问题:Java Constraint类的具体用法?Java Constraint怎么用?Java Constraint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Constraint类属于org.darkstorm.minecraft.gui.layout包,在下文中一共展示了Constraint类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefaultComponentSize
import org.darkstorm.minecraft.gui.layout.Constraint; //导入依赖的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);
}
示例2: getDefaultComponentSize
import org.darkstorm.minecraft.gui.layout.Constraint; //导入依赖的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);
}
示例3: add
import org.darkstorm.minecraft.gui.layout.Constraint; //导入依赖的package包/类
@Override
public void add(Component child, Constraint... constraints) {
synchronized (children) {
Container parent = child.getParent();
if (parent != null && parent.hasChild(child)) parent.remove(child);
children.put(child, constraints);
if (!enabled) child.setEnabled(false);
if (!visible) child.setVisible(false);
child.setParent(this);
child.setTheme(getTheme());
layoutChildren();
}
}
示例4: getConstraints
import org.darkstorm.minecraft.gui.layout.Constraint; //导入依赖的package包/类
@Override
public Constraint[] getConstraints(Component child) {
if (child == null) throw new NullPointerException();
synchronized (children) {
Constraint[] constraints = children.get(child);
return constraints != null ? constraints : new Constraint[0];
}
}
示例5: layoutChildren
import org.darkstorm.minecraft.gui.layout.Constraint; //导入依赖的package包/类
@Override
public void layoutChildren() {
synchronized (children) {
Component[] components = children.keySet().toArray(new Component[children.size()]);
Rectangle[] areas = new Rectangle[components.length];
for (int i = 0; i < components.length; i++) {
areas[i] = components[i].getArea();
}
Constraint[][] allConstraints = children.values().toArray(new Constraint[children.size()][]);
if (getTheme() != null) layoutManager.reposition(ui.getChildRenderArea(this), areas, allConstraints);
for (Component child : components) {
if (child instanceof Container) ((Container) child).layoutChildren();
}
}
}
示例6: add
import org.darkstorm.minecraft.gui.layout.Constraint; //导入依赖的package包/类
void add(Component child, Constraint... constraints);
示例7: getConstraints
import org.darkstorm.minecraft.gui.layout.Constraint; //导入依赖的package包/类
Constraint[] getConstraints(Component child);