当前位置: 首页>>代码示例>>Java>>正文


Java UnitType.ABSOLUTE属性代码示例

本文整理汇总了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;
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:33,代码来源:Marker.java

示例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)); 
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:25,代码来源:RectangleInsetsTest.java

示例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));
    
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:39,代码来源:RectangleInsetsTest.java

示例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;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:13,代码来源:UnitTypeFieldHandler.java

示例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);
    
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:65,代码来源:RectangleInsetsTest.java

示例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);   
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:12,代码来源:RectangleInsets.java


注:本文中的org.jfree.util.UnitType.ABSOLUTE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。