Java Code Examples for javax.swing.SizeRequirements#calculateTiledPositions()

The following examples show how to use javax.swing.SizeRequirements#calculateTiledPositions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FilterBar.java    From pcgen with GNU Lesser General Public License v2.1 6 votes vote down vote up
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]);
	}
}
 
Example 2
Source File: FilterBar.java    From pcgen with GNU Lesser General Public License v2.1 6 votes vote down vote up
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]);
	}
}
 
Example 3
Source File: TableView.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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);
}
 
Example 4
Source File: TableView.java    From jdk8u-dev-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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);
}
 
Example 5
Source File: TableView.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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);
}
 
Example 6
Source File: TableView.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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);
}
 
Example 7
Source File: TableView.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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);
}
 
Example 8
Source File: TableView.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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);
}
 
Example 9
Source File: TableView.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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);
}
 
Example 10
Source File: TableView.java    From Java8CN with Apache License 2.0 3 votes vote down vote up
/**
 * 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);
}
 
Example 11
Source File: TableView.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 * 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);
}
 
Example 12
Source File: TableView.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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);
}
 
Example 13
Source File: TableView.java    From Bytecoder with Apache License 2.0 3 votes vote down vote up
/**
 * 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);
}
 
Example 14
Source File: TableView.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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);
}
 
Example 15
Source File: TableView.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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);
}
 
Example 16
Source File: TableView.java    From JDKSourceCode1.8 with MIT License 3 votes vote down vote up
/**
 * 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);
}
 
Example 17
Source File: TableView.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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);
}
 
Example 18
Source File: TableView.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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);
}
 
Example 19
Source File: TableView.java    From dragonwell8_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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);
}