|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
org.formaria.swing.animation.AnimationSurface
org.formaria.swing.FlowedTextComponent
public class FlowedTextComponent
A component that flows text around other components, child components and components that overlap this component. Assumes that the area within which the text is flowed is composed of rectangular blocks.
Copyright (c) Formaria Ltd., 2008, This software is licensed under the GNU Public License (GPL), please see license.txt for more details. If you make commercial use of this software you must purchase a commercial license from formaria.
$Revision: 1.23 $
| Nested Class Summary | |
|---|---|
protected class |
FlowedTextComponent.Attrib
A structure for holding references to the attributes of the string |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected float |
ascent
|
protected java.util.Hashtable |
attributedStrings
|
protected boolean |
clip
|
protected int |
cols
|
protected int |
colSpacing
|
protected int |
currentColumn
|
protected int |
deltaX
|
protected int |
deltaY
|
protected java.awt.geom.Area |
flowArea
|
protected int |
oH
|
protected int |
oW
|
protected int |
oX
|
protected int |
oY
|
| Fields inherited from class org.formaria.swing.animation.AnimationSurface |
|---|
animationContext, animator, antiAlias, autoStart, bimg, composite, currentProject, finished, imageType, increment, label, loopTime, oldH, oldW, position, rendering, sleepTime, startTime, texture, timingFraction |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.print.Printable |
|---|
NO_SUCH_PAGE, PAGE_EXISTS |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
FlowedTextComponent()
Create a new flowed text component |
|
| Method Summary | |
|---|---|
void |
applyState(java.awt.Graphics2D g2)
Apply the current state to the graphics rendering context |
void |
drawObjects(int w,
int h,
java.awt.Graphics2D g2)
All classes that extend JAnimationSurface must implement this routine... |
protected java.text.AttributedString |
getAttributedString(java.lang.String localCopy,
java.awt.Font font,
int[] lengths)
Get an AttribtedString for this component, converting the tags <b>, <i>, <u>, <sub>, <super>, <swap>, <justify>, <strike> to the proper internal form. |
boolean |
getClip()
Get the clip state |
int |
getColSpacing()
Get the column spacing |
int |
getNumColumns()
Get the number of columns into which the flow area is divided |
java.lang.String |
getText()
Get the label/text of the component. |
void |
init()
Attempts to load and reference the associated view/datastore. |
void |
reset(int w,
int h)
Adjust the settings for the next step. |
void |
setClip(boolean state)
Set the clip state |
void |
setCols(int numCols)
Set the number of columns |
void |
setColSpacing(int spacing)
Set the column spacing as the number of pixels between each column. |
void |
setNumColumns(int columns)
Set the number of columns in which to divide the flow area |
void |
setText(java.lang.String text)
Set the label/text of the component. |
void |
step(int w,
int h)
Adjust the settings for the next step. |
protected double |
wrapString(java.awt.Graphics2D g2,
java.lang.String text,
double currentPos,
double y,
java.awt.geom.Area[] columns)
Draw text that wraps within the flow area |
| Methods inherited from class org.formaria.swing.animation.AnimationSurface |
|---|
autoStart, begin, createBufferedImage, createGraphics2D, end, getAnimator, getAntiAlias, getAutoStart, getComposite, getImageType, getIncrement, getLoopTime, getRendering, getSleepTime, isAnimated, isFinished, isStarted, paintComponent, print, quoteReplacement, render, repeat, replace, reset, setAnimator, setAntiAlias, setAutoStart, setComposite, setImageType, setIncrement, setLoopTime, setRendering, setSleepTime, setTexture, start, stop, timingEvent |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
| Methods inherited from class java.awt.Container |
|---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected boolean clip
protected float ascent
protected java.awt.geom.Area flowArea
protected int oX
protected int oY
protected int oW
protected int oH
protected int deltaX
protected int deltaY
protected int cols
protected int colSpacing
protected int currentColumn
protected java.util.Hashtable attributedStrings
| Constructor Detail |
|---|
public FlowedTextComponent()
| Method Detail |
|---|
public void setNumColumns(int columns)
columns - the number of columns, if <1 a single flow area is usedpublic int getNumColumns()
public void setColSpacing(int spacing)
spacing - the column spacing in pixelspublic int getColSpacing()
public void setText(java.lang.String text)
setText in interface TextHoldersetText in class AnimationSurfacetext - the new text.public java.lang.String getText()
getText in interface TextHoldergetText in class AnimationSurfacepublic void init()
init in class AnimationSurface
public void reset(int w,
int h)
w - the widthh - the height
public void step(int w,
int h)
w - the widthh - the height
public void drawObjects(int w,
int h,
java.awt.Graphics2D g2)
drawObjects in class AnimationSurfacew - the widthh - the heightg2 - the graphics contextpublic void applyState(java.awt.Graphics2D g2)
g2 - the graphics context
protected double wrapString(java.awt.Graphics2D g2,
java.lang.String text,
double currentPos,
double y,
java.awt.geom.Area[] columns)
g2 - the graphics contexttext - the textcurrentPos - the current y offset for a new columny - the current y offset within the column for a new block of textcolumns - the area of the columns
protected java.text.AttributedString getAttributedString(java.lang.String localCopy,
java.awt.Font font,
int[] lengths)
localCopy - the text being renderedfont - the current fontlengths - on return contains the length of the text to be rendered - the argument should be a string[1]
public void setCols(int numCols)
numCols - the number of columnspublic void setClip(boolean state)
state - true to clip siblingspublic boolean getClip()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||