cdox.edit
Class TextElementGenerator

java.lang.Object
  extended bycdox.edit.TextElementGenerator
All Implemented Interfaces:
CDCoverStandards

public class TextElementGenerator
extends java.lang.Object
implements CDCoverStandards

This class provides some useful methods for generation of text elements. See the description of the various static methods how they work.

Version:
July 5th 2002
Author:
Rutger Bezema, Andreas Schmitz

Field Summary
 
Fields inherited from interface cdox.edit.CDCoverStandards
ALL, CDBACK_SIDE, CDBACK_SIDE_SIZE, CDBACK_SIZE, CDBOOKLET, CDBOOKLET_SIZE, CDFRONT, CDFRONT_SIZE, CDSIDE_SIZE, CDX, GIF, JPG, PNG
 
Constructor Summary
TextElementGenerator()
           
 
Method Summary
static TextElement[] createMultipleStrings(Cover c, java.lang.String[] s, java.awt.Font f, int size, int yPos, boolean left, boolean bold, boolean italic, boolean underline)
           Creates a text element from multiple strings.
static void createSideString(Cover c, java.lang.String s)
          This method creates two text elements as side strings.
static TextElement createSingleString(Cover c, java.lang.String s, java.awt.Font f, int size, int yPos, boolean left, boolean bold, boolean italic, boolean underline)
           Creates a text element from a single string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextElementGenerator

public TextElementGenerator()
Method Detail

createSingleString

public static TextElement createSingleString(Cover c,
                                             java.lang.String s,
                                             java.awt.Font f,
                                             int size,
                                             int yPos,
                                             boolean left,
                                             boolean bold,
                                             boolean italic,
                                             boolean underline)

Creates a text element from a single string. The element will be centered on the cover according to the following rules:

If the string is empty, this method inserts no element at all. The font may be null, in which case new JLabel().getFont() will be used. If the size is lower than 6, 10 will be used.

Parameters:
c - the cover where the element will be added.
s - the string.
f - the desired font.
size - the desired font size.
yPos - the y starting position.
left - the mode (only relevant with booklets, see above).
bold - whether the text should be bold.
italic - whether the text should be italic.
underline - whether the text should be underlined.
Returns:
the text element that has already been added to the cover.

createMultipleStrings

public static TextElement[] createMultipleStrings(Cover c,
                                                  java.lang.String[] s,
                                                  java.awt.Font f,
                                                  int size,
                                                  int yPos,
                                                  boolean left,
                                                  boolean bold,
                                                  boolean italic,
                                                  boolean underline)

Creates a text element from multiple strings. The elements will be centered on the cover according to the following rules:

If the strings are empty, this method inserts no element at all. The font may be null, in which case new JLabel().getFont() will be used. If the size is lower than 6, 10 will be used.

Parameters:
c - the cover where the element will be added.
s - the strings.
f - the desired font.
size - the desired font size.
yPos - the y starting position.
left - the mode (only relevant with booklets, see above).
bold - whether the text should be bold.
italic - whether the text should be italic.
underline - whether the text should be underlined.
Returns:
the text elements that have already been added to the cover.

createSideString

public static void createSideString(Cover c,
                                    java.lang.String s)
This method creates two text elements as side strings.

Parameters:
c - the Cover. Must be a CDBACK_SIDE.
s - the string to add.