本文整理汇总了Java中javax.swing.SizeRequirements.calculateTiledPositions方法的典型用法代码示例。如果您正苦于以下问题:Java SizeRequirements.calculateTiledPositions方法的具体用法?Java SizeRequirements.calculateTiledPositions怎么用?Java SizeRequirements.calculateTiledPositions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.SizeRequirements
的用法示例。
在下文中一共展示了SizeRequirements.calculateTiledPositions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testLayoutMajorAxis04
import javax.swing.SizeRequirements; //导入方法依赖的package包/类
/**
* Tests <code>layoutMajorAxis</code> with "flexible" settings:
* resizable children, height space > minimum but < preferred.
*/
public void testLayoutMajorAxis04() {
makeFlexible();
int[] offsets = new int[view.getViewCount()];
int[] spans = new int[view.getViewCount()];
final int axis = Y_AXIS;
shape.height = major.minimum - 50;
assertTrue(shape.height < major.minimum);
view.layoutMajorAxis(shape.height, axis, offsets, spans);
// This method doesn't mark layout as valid
assertFalse(view.isLayoutValid(axis));
SizeRequirements[] childReq = new SizeRequirements[view.getViewCount()];
int[] childOffsets = new int[view.getViewCount()];
int[] childSpans = new int[view.getViewCount()];
fillRequirements(childReq, axis);
SizeRequirements.calculateTiledPositions(shape.height, major, childReq, childOffsets,
childSpans);
for (int i = 0; i < view.getViewCount(); i++) {
assertEquals("Offsets are different @ " + i, childOffsets[i], offsets[i]);
assertEquals("Spans are different @ " + i, childSpans[i], spans[i]);
}
}
示例2: layoutColumns
import javax.swing.SizeRequirements; //导入方法依赖的package包/类
/**
* Lays out the columns to fit within the given target span.
* Returns the results through {@code offsets} and {@code spans}.
*
* @param targetSpan the given span for total of all the table
* columns
* @param reqs the requirements desired for each column. This
* is the column maximum of the cells minimum, preferred, and
* maximum requested span
* @param spans the return value of how much to allocated to
* each column
* @param offsets the return value of the offset from the
* origin for each column
*/
protected void layoutColumns(int targetSpan, int[] offsets, int[] spans,
SizeRequirements[] reqs) {
// allocate using the convenience method on SizeRequirements
SizeRequirements.calculateTiledPositions(targetSpan, null, reqs,
offsets, spans);
}
示例3: layoutColumns
import javax.swing.SizeRequirements; //导入方法依赖的package包/类
/**
* Lays out the columns to fit within the specified target span.
*
* @param targetSpan the total span for the columns
* @param offsets an array that holds the offsets of the columns when this
* method returns
* @param spans an array that holds the spans of the columns when this method
* returns
* @param reqs the size requirements for each column
*/
protected void layoutColumns(int targetSpan, int[] offsets, int spans[],
SizeRequirements[] reqs)
{
updateColumnRequirements();
SizeRequirements r = calculateMinorAxisRequirements(X_AXIS, null);
SizeRequirements.calculateTiledPositions(targetSpan, r, columnRequirements,
offsets, spans);
}