Package com.zerog.awt
Class ZGSimpleTextWrap
- java.lang.Object
- 
- java.awt.Component
- 
- com.zerog.awt.ZGSimpleTextWrap
 
 
- 
- All Implemented Interfaces:
- java.awt.image.ImageObserver,- java.awt.MenuContainer,- java.io.Serializable
 
 public class ZGSimpleTextWrap extends java.awt.ComponentZGSimpleTextWrap: Lightweight TextDisplay that automatically wraps text. Think of it as a kind of WrappingTextLabel.- Version:
- 0.8, 12 Jul 2000
- Author:
- M. Michael Acosta
- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected intbufstatic intCENTERprotected intdoubleBufstatic intLEFTprotected booleannewFontstatic intRIGHTprotected java.lang.Stringtextprotected java.awt.ColortextColorprotected java.util.VectortextVprotected intvSpace
 - 
Constructor SummaryConstructors Constructor Description ZGSimpleTextWrap()Creates a new TextDisplay Component, with the given text.ZGSimpleTextWrap(java.lang.String text)Creates a new TextDisplay Component, with the given text.ZGSimpleTextWrap(java.lang.String text, int hAlignment)Creates a new TextDisplay Component, with the given text.ZGSimpleTextWrap(java.lang.String text, int hAlignment, java.awt.Color controlTextColor)ZGSimpleTextWrap(java.lang.String text, java.awt.Color textColor)Creates a new TextDisplay Component, with the given text.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetAlignment()Gets the current hAlignment.java.lang.StringgetComponentID()java.awt.DimensiongetMaximumSize()java.awt.DimensiongetMinimumSize()java.awt.DimensiongetPreferredSize()java.awt.DimensiongetSize()intgetStringWidth(java.lang.String str, java.awt.FontMetrics fm)java.lang.StringgetText()voidpaint(java.awt.Graphics g1)Paints this component.intparseText()Parses the text into a vector of individual lines of text based on the current width of the component.voidsetAlignment(int hAlignment)Sets the current hAlignment.voidsetBounds(int x, int y, int width, int height)voidsetComponentID(java.lang.String component_id)voidsetSize(int width, int height)voidsetWidth(int width)Sets the width (around which text will be wrapped) for this component.voidupdate(java.awt.Graphics g)Updates the component.- 
Methods inherited from class java.awt.Componentaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
- 
 
- 
- 
- 
Field Detail- 
LEFTpublic static final int LEFT - See Also:
- Constant Field Values
 
 - 
CENTERpublic static final int CENTER - See Also:
- Constant Field Values
 
 - 
RIGHTpublic static final int RIGHT - See Also:
- Constant Field Values
 
 - 
textprotected java.lang.String text 
 - 
textVprotected java.util.Vector textV 
 - 
newFontprotected boolean newFont 
 - 
bufprotected int buf 
 - 
doubleBufprotected int doubleBuf 
 - 
vSpaceprotected int vSpace 
 - 
textColorprotected java.awt.Color textColor 
 
- 
 - 
Constructor Detail- 
ZGSimpleTextWrappublic ZGSimpleTextWrap() Creates a new TextDisplay Component, with the given text.
 - 
ZGSimpleTextWrappublic ZGSimpleTextWrap(java.lang.String text) Creates a new TextDisplay Component, with the given text.
 - 
ZGSimpleTextWrappublic ZGSimpleTextWrap(java.lang.String text, java.awt.Color textColor)Creates a new TextDisplay Component, with the given text.
 - 
ZGSimpleTextWrappublic ZGSimpleTextWrap(java.lang.String text, int hAlignment)Creates a new TextDisplay Component, with the given text.
 - 
ZGSimpleTextWrappublic ZGSimpleTextWrap(java.lang.String text, int hAlignment, java.awt.Color controlTextColor)
 
- 
 - 
Method Detail- 
setAlignmentpublic void setAlignment(int hAlignment) Sets the current hAlignment. Possible values areZGTextWrap.LEFT,ZGTextWrap.CENTER, andZGTextWrap.RIGHT.- Parameters:
- hAlignment- the hAlignment to be set.
- Throws:
- java.lang.IllegalArgumentException- if an improper value for- hAlignmentis given.
- See Also:
- com.zerog.util.ZGTextWrap#getAlignment
 
 - 
getAlignmentpublic int getAlignment() Gets the current hAlignment. Possible values areZGTextWrap.LEFT,ZGTextWrap.CENTER, andZGTextWrap.RIGHT.- See Also:
- com.zerog.util.ZGTextWrap#setAlignment
 
 - 
setWidthpublic void setWidth(int width) Sets the width (around which text will be wrapped) for this component.
 - 
updatepublic void update(java.awt.Graphics g) Updates the component. This method is called in response to a call to repaint. You can assume that the background is not cleared.- Overrides:
- updatein class- java.awt.Component
- Parameters:
- g- the specified Graphics window
- See Also:
- paint(java.awt.Graphics)
 
 - 
setBoundspublic void setBounds(int x, int y, int width, int height)- Overrides:
- setBoundsin class- java.awt.Component
 
 - 
getMinimumSizepublic java.awt.Dimension getMinimumSize() - Overrides:
- getMinimumSizein class- java.awt.Component
 
 - 
getSizepublic java.awt.Dimension getSize() - Overrides:
- getSizein class- java.awt.Component
 
 - 
getMaximumSizepublic java.awt.Dimension getMaximumSize() - Overrides:
- getMaximumSizein class- java.awt.Component
 
 - 
getPreferredSizepublic java.awt.Dimension getPreferredSize() - Overrides:
- getPreferredSizein class- java.awt.Component
 
 - 
parseTextpublic int parseText() Parses the text into a vector of individual lines of text based on the current width of the component. Returns an int representing the height of the component based on the number of lines to be displayed and the current font.
 - 
paintpublic void paint(java.awt.Graphics g1) Paints this component. This method is called when the contents of the component should be painted in response to the component first being shown or damage needing repair. The clip rectangle in the Graphics parameter will be set to the area which needs to be painted. For performance reasons, Components with zero width or height aren't considered to need painting when they are first shown, and also aren't considered to need repair.- Overrides:
- paintin class- java.awt.Component
- Parameters:
- g- The graphics context to use for painting.
 
 - 
setSizepublic void setSize(int width, int height)- Overrides:
- setSizein class- java.awt.Component
 
 - 
getStringWidthpublic int getStringWidth(java.lang.String str, java.awt.FontMetrics fm)
 - 
getTextpublic java.lang.String getText() 
 - 
getComponentIDpublic java.lang.String getComponentID() 
 - 
setComponentIDpublic void setComponentID(java.lang.String component_id) 
 
- 
 
-