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