下面列出了javax.swing.SizeRequirements#calculateTiledPositions ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void layoutComponents(Container target, int xOffset, int yOffset, int maxwidth, int rowheight,
SizeRequirements[] xChildren, SizeRequirements[] yChildren, int start, int end, boolean ltr)
{
SizeRequirements[] children = ArrayUtils.subarray(xChildren, start, end);
int[] xOffsets = new int[children.length];
int[] xSpans = new int[children.length];
SizeRequirements.calculateTiledPositions(maxwidth, null, children, xOffsets, xSpans, ltr);
children = ArrayUtils.subarray(yChildren, start, end);
int[] yOffsets = new int[children.length];
int[] ySpans = new int[children.length];
SizeRequirements total = new SizeRequirements(rowheight, rowheight, rowheight, 0.5f);
SizeRequirements.calculateAlignedPositions(rowheight, total, children, yOffsets, ySpans, ltr);
for (int i = 0; i < children.length; i++)
{
Component c = target.getComponent(i + start);
c.setBounds((int) Math.min((long) xOffset + (long) xOffsets[i], Integer.MAX_VALUE),
(int) Math.min((long) yOffset + (long) yOffsets[i], Integer.MAX_VALUE), xSpans[i], ySpans[i]);
}
}
private void layoutComponents(Container target, int xOffset, int yOffset, int maxwidth, int rowheight,
SizeRequirements[] xChildren, SizeRequirements[] yChildren, int start, int end, boolean ltr)
{
SizeRequirements[] children = ArrayUtils.subarray(xChildren, start, end);
int[] xOffsets = new int[children.length];
int[] xSpans = new int[children.length];
SizeRequirements.calculateTiledPositions(maxwidth, null, children, xOffsets, xSpans, ltr);
children = ArrayUtils.subarray(yChildren, start, end);
int[] yOffsets = new int[children.length];
int[] ySpans = new int[children.length];
SizeRequirements total = new SizeRequirements(rowheight, rowheight, rowheight, 0.5f);
SizeRequirements.calculateAlignedPositions(rowheight, total, children, yOffsets, ySpans, ltr);
for (int i = 0; i < children.length; i++)
{
Component c = target.getComponent(i + start);
c.setBounds((int) Math.min((long) xOffset + (long) xOffsets[i], Integer.MAX_VALUE),
(int) Math.min((long) yOffset + (long) yOffsets[i], Integer.MAX_VALUE), xSpans[i], ySpans[i]);
}
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}