public class SizeRequirements extends Object implements Serializable
- tiled
- The components are placed end-to-end, starting either at coordinate 0 (the leftmost or topmost position) or at the coordinate representing the end of the allocated span (the rightmost or bottommost position).
- aligned
- The components are aligned as specified by each component's X or Y alignment value.
每个sizerequirements对象包含信息的宽度(X对齐)或高度(y对齐)的一个组成部分,或一组组件:
minimum- The smallest reasonable width/height of the component or component group, in pixels.
preferred- The natural width/height of the component or component group, in pixels.
maximum- The largest reasonable width/height of the component or component group, in pixels.
alignment- The X/Y alignment of the component or component group.
警告:序列化该类的对象与以后的Swing版本不兼容。当前的序列化支持适用于短期贮藏或RMI运行相同Swing版本的应用程序之间。为1.4,为所有JavaBeans™长期存储的支持已被添加到java.beans包。请看XMLEncoder。
| Modifier and Type | Field and Description |
|---|---|
float |
alignment
该对齐方式,指定为1和0之间的值,包括。
|
int |
maximum
允许的最大大小。
|
int |
minimum
最小尺寸要求。
|
int |
preferred
首选(自然)大小。
|
| Constructor and Description |
|---|
SizeRequirements()
创建一个最小的,优先sizerequirements对象大小和最大大小设置为零和0.5的对齐方式(居中)。
|
SizeRequirements(int min, int pref, int max, float a)
创建一个具有指定的最小,优先sizerequirements对象和最大尺寸和指定对齐。
|
| Modifier and Type | Method and Description |
|---|---|
static int[] |
adjustSizes(int delta, SizeRequirements[] children)
通过给定数量调整指定大小的数组。
|
static void |
calculateAlignedPositions(int allocated, SizeRequirements total, SizeRequirements[] children, int[] offsets, int[] spans)
创建一个偏移量/跨度对,指定如何在指定的对齐方式下布局一组组件。
|
static void |
calculateAlignedPositions(int allocated, SizeRequirements total, SizeRequirements[] children, int[] offsets, int[] spans, boolean normal)
创建一组偏移/间距对,指定如何在指定的对齐方式下布局一组组件。
|
static void |
calculateTiledPositions(int allocated, SizeRequirements total, SizeRequirements[] children, int[] offsets, int[] spans)
创建一组偏移/跨度对,表示如何布局一组组件到终端的端到端。
|
static void |
calculateTiledPositions(int allocated, SizeRequirements total, SizeRequirements[] children, int[] offsets, int[] spans, boolean forward)
创建一组偏移/跨度对,表示如何布局一组组件到终端的端到端。
|
static SizeRequirements |
getAlignedSizeRequirements(SizeRequirements[] children)
确定要对齐一组组件所需的总空间。
|
static SizeRequirements |
getTiledSizeRequirements(SizeRequirements[] children)
确定要将一组组件端到端的必要的总空间。
|
String |
toString()
返回一个描述最小值、首选和最大大小的字符串的字符串,以及对齐方式。
|
public int minimum
comp,这应该是等于或
comp.getMinimumSize().height
comp.getMinimumSize().width。
public int preferred
comp,这应该是等于或
comp.getPreferredSize().height
comp.getPreferredSize().width。
public int maximum
comp,这应该是等于或
comp.getMaximumSize().height
comp.getMaximumSize().width。
public float alignment
public SizeRequirements()
public SizeRequirements(int min,
int pref,
int max,
float a)
min的最小大小> = 0
pref -首选大小> = 0
max -最大尺寸> = 0
a -对齐> = 0.0f & < = 1.0f
public String toString()
public static SizeRequirements getTiledSizeRequirements(SizeRequirements[] children)
children -一组组件的空间要求。该载体可以是零长度,这将导致违约sizerequirements对象实例传递回来。
public static SizeRequirements getAlignedSizeRequirements(SizeRequirements[] children)
children -孩子的要求设置。如果零长度,返回的结果将是sizerequirements默认实例。
public static void calculateTiledPositions(int allocated,
SizeRequirements total,
SizeRequirements[] children,
int[] offsets,
int[] spans)
allocated -总跨度要分配> = 0。
total -孩子的总请求。此参数是可选的,并且可能是空的。
children -每个组件的尺寸要求。
offsets -从0偏移量为每个孩子在时间分配(确定位置的跨度)。
spans -跨度分配给每个孩子使总目标跨度。
public static void calculateTiledPositions(int allocated,
SizeRequirements total,
SizeRequirements[] children,
int[] offsets,
int[] spans,
boolean forward)
allocated -总跨度要分配> = 0。
total -孩子的总请求。此参数是可选的,并且可能是空的。
children -每个组件的尺寸要求。
offsets -从0偏移量为每个孩子在时间分配(确定位置的跨度)。
spans -跨度分配给每个孩子使总目标跨度。
forward砖偏移从0增加如果真正的偏移从减少分配空间结束如果虚假。
public static void calculateAlignedPositions(int allocated,
SizeRequirements total,
SizeRequirements[] children,
int[] offsets,
int[] spans)
allocated -总跨度要分配> = 0。
total -孩子的总请求。
children -每个组件的尺寸要求。
offsets -从0偏移量为每个孩子在时间分配(确定位置的跨度)。
spans -跨度分配给每个孩子使总目标跨度。
public static void calculateAlignedPositions(int allocated,
SizeRequirements total,
SizeRequirements[] children,
int[] offsets,
int[] spans,
boolean normal)
allocated -总跨度要分配> = 0。
total -孩子的总请求。
children -每个组件的尺寸要求。
offsets -从0偏移量为每个孩子在时间分配(确定位置的跨度)。
spans -跨度分配给每个孩子使总目标跨度。
normal当真实,对准价值0.0f意味着左/上;如果为false,这意味着右/下。
public static int[] adjustSizes(int delta,
SizeRequirements[] children)
delta指定大小差别int
children - sizerequirements对象数组
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.