HorizontalRuleFormat

Inheritance: java.lang.Object

public class HorizontalRuleFormat

Represents horizontal rule formatting.

To learn more, visit the Working with Shapes documentation article.

Examples:

Shows how to insert a horizontal rule shape, and customize its formatting.


 Document doc = new Document();
 DocumentBuilder builder = new DocumentBuilder(doc);
 Shape shape = builder.insertHorizontalRule();

 HorizontalRuleFormat horizontalRuleFormat = shape.getHorizontalRuleFormat();
 horizontalRuleFormat.setAlignment(HorizontalRuleAlignment.CENTER);
 horizontalRuleFormat.setWidthPercent(70.0);
 horizontalRuleFormat.setHeight(3.0);
 horizontalRuleFormat.setColor(Color.BLUE);
 horizontalRuleFormat.setNoShade(true);

 Assert.assertTrue(shape.isHorizontalRule());
 Assert.assertTrue(shape.getHorizontalRuleFormat().getNoShade());
 

Methods

MethodDescription
getAlignment()Gets the alignment of the horizontal rule.
getColor()Gets the brush color that fills the horizontal rule.
getHeight()Gets the height of the horizontal rule.
getNoShade()Indicates the presence of 3D shading for the horizontal rule.
getWidthPercent()Gets the length of the specified horizontal rule expressed as a percentage of the window width.
setAlignment(int value)Sets the alignment of the horizontal rule.
setColor(Color value)Sets the brush color that fills the horizontal rule.
setHeight(double value)Sets the height of the horizontal rule.
setNoShade(boolean value)Indicates the presence of 3D shading for the horizontal rule.
setWidthPercent(double value)Sets the length of the specified horizontal rule expressed as a percentage of the window width.

getAlignment()

public int getAlignment()

Gets the alignment of the horizontal rule.

Remarks:

The default value is HorizontalRuleAlignment.LEFT.

Examples:

Shows how to insert a horizontal rule shape, and customize its formatting.


 Document doc = new Document();
 DocumentBuilder builder = new DocumentBuilder(doc);
 Shape shape = builder.insertHorizontalRule();

 HorizontalRuleFormat horizontalRuleFormat = shape.getHorizontalRuleFormat();
 horizontalRuleFormat.setAlignment(HorizontalRuleAlignment.CENTER);
 horizontalRuleFormat.setWidthPercent(70.0);
 horizontalRuleFormat.setHeight(3.0);
 horizontalRuleFormat.setColor(Color.BLUE);
 horizontalRuleFormat.setNoShade(true);

 Assert.assertTrue(shape.isHorizontalRule());
 Assert.assertTrue(shape.getHorizontalRuleFormat().getNoShade());
 

Returns: int - The alignment of the horizontal rule. The returned value is one of HorizontalRuleAlignment constants.

getColor()

public Color getColor()

Gets the brush color that fills the horizontal rule.

Remarks:

This is a shortcut to the Fill.getColor() / Fill.setColor(java.awt.Color) property.

The default value is java.awt.Color#getGray().getGray().

Examples:

Shows how to insert a horizontal rule shape, and customize its formatting.


 Document doc = new Document();
 DocumentBuilder builder = new DocumentBuilder(doc);
 Shape shape = builder.insertHorizontalRule();

 HorizontalRuleFormat horizontalRuleFormat = shape.getHorizontalRuleFormat();
 horizontalRuleFormat.setAlignment(HorizontalRuleAlignment.CENTER);
 horizontalRuleFormat.setWidthPercent(70.0);
 horizontalRuleFormat.setHeight(3.0);
 horizontalRuleFormat.setColor(Color.BLUE);
 horizontalRuleFormat.setNoShade(true);

 Assert.assertTrue(shape.isHorizontalRule());
 Assert.assertTrue(shape.getHorizontalRuleFormat().getNoShade());
 

Returns: java.awt.Color - The brush color that fills the horizontal rule.

getHeight()

public double getHeight()

Gets the height of the horizontal rule.

Returns: double - The height of the horizontal rule.

getNoShade()

public boolean getNoShade()

Indicates the presence of 3D shading for the horizontal rule. If true , then the horizontal rule is without 3D shading and solid color is used.

Remarks:

The default value is false .

Examples:

Shows how to insert a horizontal rule shape, and customize its formatting.


 Document doc = new Document();
 DocumentBuilder builder = new DocumentBuilder(doc);
 Shape shape = builder.insertHorizontalRule();

 HorizontalRuleFormat horizontalRuleFormat = shape.getHorizontalRuleFormat();
 horizontalRuleFormat.setAlignment(HorizontalRuleAlignment.CENTER);
 horizontalRuleFormat.setWidthPercent(70.0);
 horizontalRuleFormat.setHeight(3.0);
 horizontalRuleFormat.setColor(Color.BLUE);
 horizontalRuleFormat.setNoShade(true);

 Assert.assertTrue(shape.isHorizontalRule());
 Assert.assertTrue(shape.getHorizontalRuleFormat().getNoShade());
 

Returns: boolean - The corresponding boolean value.

getWidthPercent()

public double getWidthPercent()

Gets the length of the specified horizontal rule expressed as a percentage of the window width.

Returns: double - The length of the specified horizontal rule expressed as a percentage of the window width.

setAlignment(int value)

public void setAlignment(int value)

Sets the alignment of the horizontal rule.

Remarks:

The default value is HorizontalRuleAlignment.LEFT.

Examples:

Shows how to insert a horizontal rule shape, and customize its formatting.


 Document doc = new Document();
 DocumentBuilder builder = new DocumentBuilder(doc);
 Shape shape = builder.insertHorizontalRule();

 HorizontalRuleFormat horizontalRuleFormat = shape.getHorizontalRuleFormat();
 horizontalRuleFormat.setAlignment(HorizontalRuleAlignment.CENTER);
 horizontalRuleFormat.setWidthPercent(70.0);
 horizontalRuleFormat.setHeight(3.0);
 horizontalRuleFormat.setColor(Color.BLUE);
 horizontalRuleFormat.setNoShade(true);

 Assert.assertTrue(shape.isHorizontalRule());
 Assert.assertTrue(shape.getHorizontalRuleFormat().getNoShade());
 

Parameters:

ParameterTypeDescription
valueintThe alignment of the horizontal rule. The value must be one of HorizontalRuleAlignment constants.

setColor(Color value)

public void setColor(Color value)

Sets the brush color that fills the horizontal rule.

Remarks:

This is a shortcut to the Fill.getColor() / Fill.setColor(java.awt.Color) property.

The default value is java.awt.Color#getGray().getGray().

Examples:

Shows how to insert a horizontal rule shape, and customize its formatting.


 Document doc = new Document();
 DocumentBuilder builder = new DocumentBuilder(doc);
 Shape shape = builder.insertHorizontalRule();

 HorizontalRuleFormat horizontalRuleFormat = shape.getHorizontalRuleFormat();
 horizontalRuleFormat.setAlignment(HorizontalRuleAlignment.CENTER);
 horizontalRuleFormat.setWidthPercent(70.0);
 horizontalRuleFormat.setHeight(3.0);
 horizontalRuleFormat.setColor(Color.BLUE);
 horizontalRuleFormat.setNoShade(true);

 Assert.assertTrue(shape.isHorizontalRule());
 Assert.assertTrue(shape.getHorizontalRuleFormat().getNoShade());
 

Parameters:

ParameterTypeDescription
valuejava.awt.ColorThe brush color that fills the horizontal rule.

setHeight(double value)

public void setHeight(double value)

Sets the height of the horizontal rule.

Parameters:

ParameterTypeDescription
valuedoubleThe height of the horizontal rule.

setNoShade(boolean value)

public void setNoShade(boolean value)

Indicates the presence of 3D shading for the horizontal rule. If true , then the horizontal rule is without 3D shading and solid color is used.

Remarks:

The default value is false .

Examples:

Shows how to insert a horizontal rule shape, and customize its formatting.


 Document doc = new Document();
 DocumentBuilder builder = new DocumentBuilder(doc);
 Shape shape = builder.insertHorizontalRule();

 HorizontalRuleFormat horizontalRuleFormat = shape.getHorizontalRuleFormat();
 horizontalRuleFormat.setAlignment(HorizontalRuleAlignment.CENTER);
 horizontalRuleFormat.setWidthPercent(70.0);
 horizontalRuleFormat.setHeight(3.0);
 horizontalRuleFormat.setColor(Color.BLUE);
 horizontalRuleFormat.setNoShade(true);

 Assert.assertTrue(shape.isHorizontalRule());
 Assert.assertTrue(shape.getHorizontalRuleFormat().getNoShade());
 

Parameters:

ParameterTypeDescription
valuebooleanThe corresponding boolean value.

setWidthPercent(double value)

public void setWidthPercent(double value)

Sets the length of the specified horizontal rule expressed as a percentage of the window width.

Parameters:

ParameterTypeDescription
valuedoubleThe length of the specified horizontal rule expressed as a percentage of the window width.