Class Break
java.lang.Object
|
+--AbstractBox
|
+--AbstractRigidBox
|
+--Break
- All Implemented Interfaces:
- Box, RigidBox
- public class Break
- extends AbstractRigidBox
A linebreak. This is an invisible box with a height of 0 pixels.
The width is equal to whatever it can get. This means that there
will never be room for this on a line, unless it's the only box on
that line. And when it's places on a line it doesn't leave a gap
to the line above, as it has a height of 0 pixels.
Constructor Summary |
Break()
Constructs a new linebreak. |
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()
The minimum width of the break. |
int |
getPreferredWidth()
The preferred width of the break. |
boolean |
splitIsPossible(int w)
Reports wether or not a split is possible. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Break
public Break()
- Constructs a new linebreak. The height is initialized to 0
pixels.
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()
- The minimum width of the break.
- Overrides:
getMinimumWidth
in class AbstractBox
- Returns:
- always 0 pixes, as a break doesn't take up any space.
This ensures that breaks won't affect the calculations made in
places like
tables
and so on.
getPreferredWidth
public int getPreferredWidth()
- The preferred width of the break.
- Overrides:
getPreferredWidth
in class AbstractBox
- Returns:
- always 0 pixels, as a break doesn't take up any space.
This ensures that breaks won't affect the calculations made in
places like
tables
and so on.
splitIsPossible
public boolean splitIsPossible(int w)
- Reports wether or not a split is possible.
- Overrides:
splitIsPossible
in class AbstractRigidBox
- Returns:
- always false, as a break can't be splitted.
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.