本文整理汇总了Java中org.jfree.util.UnitType.ABSOLUTE属性的典型用法代码示例。如果您正苦于以下问题:Java UnitType.ABSOLUTE属性的具体用法?Java UnitType.ABSOLUTE怎么用?Java UnitType.ABSOLUTE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.jfree.util.UnitType
的用法示例。
在下文中一共展示了UnitType.ABSOLUTE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Marker
/**
* Constructs a new marker.
*
* @param paint the paint (<code>null</code> not permitted).
* @param stroke the stroke (<code>null</code> not permitted).
* @param outlinePaint the outline paint (<code>null</code> permitted).
* @param outlineStroke the outline stroke (<code>null</code> permitted).
* @param alpha the alpha transparency.
*/
public Marker(Paint paint, Stroke stroke,
Paint outlinePaint, Stroke outlineStroke,
float alpha) {
if (paint == null) {
throw new IllegalArgumentException("Null 'paint' argument.");
}
if (stroke == null) {
throw new IllegalArgumentException("Null 'stroke' argument.");
}
this.paint = paint;
this.stroke = stroke;
this.outlinePaint = outlinePaint;
this.outlineStroke = outlineStroke;
this.alpha = alpha;
this.labelFont = new Font("SansSerif", Font.PLAIN, 9);
this.labelPaint = Color.black;
this.labelAnchor = RectangleAnchor.TOP_LEFT;
this.labelOffset = new RectangleInsets(UnitType.ABSOLUTE, 3.0, 3.0, 3.0, 3.0);
this.labelTextAnchor = TextAnchor.CENTER;
}
示例2: testSerialization
/**
* Serialize an instance, restore it, and check for identity.
*/
public void testSerialization() {
final RectangleInsets i1 = new RectangleInsets(
UnitType.ABSOLUTE, 1.0, 2.0, 3.0, 4.0
);
RectangleInsets i2 = null;
try {
final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
final ObjectOutput out = new ObjectOutputStream(buffer);
out.writeObject(i1);
out.close();
final ObjectInput in = new ObjectInputStream(
new ByteArrayInputStream(buffer.toByteArray())
);
i2 = (RectangleInsets) in.readObject();
in.close();
}
catch (Exception e) {
System.out.println(e.toString());
}
assertTrue(i1.equals(i2));
}
示例3: testEquals
/**
* Test the equals() method.
*/
public void testEquals() {
RectangleInsets i1 = new RectangleInsets(
UnitType.ABSOLUTE, 1.0, 2.0, 3.0, 4.0
);
RectangleInsets i2 = new RectangleInsets(
UnitType.ABSOLUTE, 1.0, 2.0, 3.0, 4.0
);
assertTrue(i1.equals(i2));
assertTrue(i2.equals(i1));
i1 = new RectangleInsets(UnitType.RELATIVE, 1.0, 2.0, 3.0, 4.0);
assertFalse(i1.equals(i2));
i2 = new RectangleInsets(UnitType.RELATIVE, 1.0, 2.0, 3.0, 4.0);
assertTrue(i1.equals(i2));
i1 = new RectangleInsets(UnitType.RELATIVE, 0.0, 2.0, 3.0, 4.0);
assertFalse(i1.equals(i2));
i2 = new RectangleInsets(UnitType.RELATIVE, 0.0, 2.0, 3.0, 4.0);
assertTrue(i1.equals(i2));
i1 = new RectangleInsets(UnitType.RELATIVE, 0.0, 0.0, 3.0, 4.0);
assertFalse(i1.equals(i2));
i2 = new RectangleInsets(UnitType.RELATIVE, 0.0, 0.0, 3.0, 4.0);
assertTrue(i1.equals(i2));
i1 = new RectangleInsets(UnitType.RELATIVE, 0.0, 0.0, 0.0, 4.0);
assertFalse(i1.equals(i2));
i2 = new RectangleInsets(UnitType.RELATIVE, 0.0, 0.0, 0.0, 4.0);
assertTrue(i1.equals(i2));
i1 = new RectangleInsets(UnitType.RELATIVE, 0.0, 0.0, 0.0, 0.0);
assertFalse(i1.equals(i2));
i2 = new RectangleInsets(UnitType.RELATIVE, 0.0, 0.0, 0.0, 0.0);
assertTrue(i1.equals(i2));
}
示例4: convertUponSet
@Override
public Object convertUponSet(Object value)
{
if (value == null)
{
return null;
}
return
UnitType.RELATIVE.toString().equals(value)
? UnitType.RELATIVE
: UnitType.ABSOLUTE.toString().equals(value)
? UnitType.ABSOLUTE : null;
}
示例5: testCreateAdjustedRectangleAbsolute
/**
* Some checks for the createAdjustedRectangle() method.
*/
public void testCreateAdjustedRectangleAbsolute() {
RectangleInsets i1 = new RectangleInsets(
UnitType.ABSOLUTE, 1.0, 2.0, 3.0, 4.0
);
Rectangle2D base = new Rectangle2D.Double(10.0, 20.0, 30.0, 40.0);
// no adjustment
Rectangle2D adjusted = i1.createAdjustedRectangle(
base, LengthAdjustmentType.NO_CHANGE, LengthAdjustmentType.NO_CHANGE
);
assertEquals(new Rectangle2D.Double(10.0, 20.0, 30.0, 40.0), adjusted);
// expand height
adjusted = i1.createAdjustedRectangle(
base, LengthAdjustmentType.NO_CHANGE, LengthAdjustmentType.EXPAND
);
assertEquals(new Rectangle2D.Double(10.0, 19.0, 30.0, 44.0), adjusted);
// contract height
adjusted = i1.createAdjustedRectangle(
base, LengthAdjustmentType.NO_CHANGE, LengthAdjustmentType.CONTRACT
);
assertEquals(new Rectangle2D.Double(10.0, 21.0, 30.0, 36.0), adjusted);
// expand width
adjusted = i1.createAdjustedRectangle(
base, LengthAdjustmentType.EXPAND, LengthAdjustmentType.NO_CHANGE
);
assertEquals(new Rectangle2D.Double(8.0, 20.0, 36.0, 40.0), adjusted);
// contract width
adjusted = i1.createAdjustedRectangle(
base, LengthAdjustmentType.CONTRACT, LengthAdjustmentType.NO_CHANGE
);
assertEquals(new Rectangle2D.Double(12.0, 20.0, 24.0, 40.0), adjusted);
// expand both
adjusted = i1.createAdjustedRectangle(
base, LengthAdjustmentType.EXPAND, LengthAdjustmentType.EXPAND
);
assertEquals(new Rectangle2D.Double(8.0, 19.0, 36.0, 44.0), adjusted);
// expand width contract height
adjusted = i1.createAdjustedRectangle(
base, LengthAdjustmentType.EXPAND, LengthAdjustmentType.CONTRACT
);
assertEquals(new Rectangle2D.Double(8.0, 21.0, 36.0, 36.0), adjusted);
// contract both
adjusted = i1.createAdjustedRectangle(
base, LengthAdjustmentType.CONTRACT, LengthAdjustmentType.CONTRACT
);
assertEquals(new Rectangle2D.Double(12.0, 21.0, 24.0, 36.0), adjusted);
// contract width expand height
adjusted = i1.createAdjustedRectangle(
base, LengthAdjustmentType.CONTRACT, LengthAdjustmentType.EXPAND
);
assertEquals(new Rectangle2D.Double(12.0, 19.0, 24.0, 44.0), adjusted);
}
示例6: RectangleInsets
/**
* Creates a new instance with the specified insets (as 'absolute' units).
*
* @param top the top insets.
* @param left the left insets.
* @param bottom the bottom insets.
* @param right the right insets.
*/
public RectangleInsets(final double top, final double left,
final double bottom, final double right) {
this(UnitType.ABSOLUTE, top, left, bottom, right);
}