Class HorizontalRule

java.lang.Object
  |
  +--AbstractBox
        |
        +--AbstractRigidBox
              |
              +--HorizontalRule
All Implemented Interfaces:
Box, RigidBox

public class HorizontalRule
extends AbstractRigidBox

A horizontal rule.


Fields inherited from class AbstractRigidBox
pen
 
Fields inherited from class AbstractBox
height, min_width, pref_width, width
 
Fields inherited from interface RigidBox
BOTH, LEFT, RIGHT
 
Constructor Summary
HorizontalRule()
          Creates a new horizontal rule.
 
Method Summary
 void doLayout(java.awt.Graphics g, javax.swing.JComponent c, int w)
          Makes the box update it's own width and height, and layout it's child-boxes.
 void drawAt(int x, int y, DocumentView v)
          Draws the box with it's upper-left corner at (x, y).
 int getMinimumWidth()
          A horizontal rule doesn't have a minimum width, as it will resize itself as the available width changes.
 int getPreferredWidth()
          A horizontal rule doesn't have a preferred width, as it will resize itself as the available width changes.
 boolean splitIsPossible(int w)
          Returns false, as a horizantal rule can't be split.
 
Methods inherited from class AbstractRigidBox
getLargestTail, getSmallestHead, splitHead, splitTail, trim
 
Methods inherited from class AbstractBox
getHeight, getWidth, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Box
getHeight, getWidth, toString
 

Constructor Detail

HorizontalRule

public HorizontalRule()
Creates a new horizontal rule.
Method Detail

doLayout

public void doLayout(java.awt.Graphics g,
                     javax.swing.JComponent c,
                     int w)
Description copied from interface: Box
Makes the box update it's own width and height, and layout it's child-boxes.
Overrides:
doLayout in class AbstractBox
Following copied from interface: Box
Parameters:
g - the graphics context. Some boxes, like TextFragments, need a graphics context before they can determine their width and height.
c - the component into which the box will be drawn. An ImageBox needs to know the component to calculate the width and height.
w - the width available for to the Box.

getMinimumWidth

public int getMinimumWidth()
A horizontal rule doesn't have a minimum width, as it will resize itself as the available width changes.
Overrides:
getMinimumWidth in class AbstractBox
Returns:
always 0, as a horizontal rule doesn't have a minimum width.

getPreferredWidth

public int getPreferredWidth()
A horizontal rule doesn't have a preferred width, as it will resize itself as the available width changes. A horizontal rule doesn't take require any horizontal space.
Overrides:
getPreferredWidth in class AbstractBox
Returns:
always 0, as a horizontal rule doesn't have a preferred width.

splitIsPossible

public boolean splitIsPossible(int w)
Returns false, as a horizantal rule can't be split.
Overrides:
splitIsPossible in class AbstractRigidBox
Returns:
always false.

drawAt

public void drawAt(int x,
                   int y,
                   DocumentView v)
Description copied from interface: Box
Draws the box with it's upper-left corner at (x, y).
Overrides:
drawAt in class AbstractBox
Following copied from interface: Box
Parameters:
v - the DocumentView that does the actual drawing.
x - the x-coordinate of the upper-left corner.
x - the y-coordinate of the upper-left corner.