Compiere Looks 1.2.1

org.compiere.swing
Class CText

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JScrollPane
                          |
                          +--org.compiere.swing.CText
All Implemented Interfaces:
Accessible, CEditor, ImageObserver, MenuContainer, ScrollPaneConstants, Serializable

public class CText
extends JScrollPane
implements CEditor

Compiere TextArea - A ScrollPane with a JTextArea. Manages visibility, opaque and color consistently

Version:
$Id: CText.java,v 1.7 2003/04/29 09:22:54 jpedersen Exp $
Author:
Jorg Janke
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.JScrollPane
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport
 
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 javax.swing.ScrollPaneConstants
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CText()
          Constructs a new TextArea.
CText(Document doc)
          Constructs a new JTextArea with the given document model, and defaults for all of the other arguments (null, 0, 0).
CText(Document doc, String text, int rows, int columns)
          Constructs a new JTextArea with the specified number of rows and columns, and the given model.
CText(int rows, int columns)
          Constructs a new empty TextArea with the specified number of rows and columns.
CText(JTextArea textArea)
          Create a JScrollArea with a JTextArea
CText(String text)
          Constructs a new TextArea with the specified text displayed.
CText(String text, int rows, int columns)
          Constructs a new TextArea with the specified text and number of rows and columns.
 
Method Summary
 void addFocusListener(FocusListener l)
           
 void addInputMethodListener(InputMethodListener l)
           
 void addKeyListener(KeyListener l)
           
 void addMouseListener(MouseListener l)
           
 void append(String text)
           
 Color getBackground()
           
 int getCaretPosition()
           
 int getColumns()
           
 String getDisplay()
          Return Display Value
 Color getForeground()
           
 InputMethodRequests getInputMethodRequests()
           
 int getRows()
           
 String getText()
           
 Object getValue()
          Return Editor value
 boolean isEditable()
           
 boolean isMandatory()
          Is Field mandatory
 boolean isReadWrite()
          Is it possible to edit
 void setBackground(boolean error)
          Set Background based on editable / mandatory / error
 void setBackground(Color color)
           
 void setCaretPosition(int pos)
           
 void setColumns(int cols)
           
 void setEditable(boolean edit)
           
 void setForeground(Color color)
           
 void setInputVerifier(InputVerifier l)
           
 void setLineWrap(boolean wrap)
           
 void setMandatory(boolean mandatory)
          Set Editor Mandatory
 void setOpaque(boolean isOpaque)
           
 void setReadWrite(boolean rw)
          Enable Editor
 void setRows(int rows)
           
 void setText(String text)
          Set Text
 void setValue(Object value)
          Set Editor to value
 void setWrapStyleWord(boolean word)
           
 
Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setInputMap, setMaximumSize, setMinimumSize, setNextFocusableComponent, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addHierarchyBoundsListener, addHierarchyListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, 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
 
Methods inherited from interface org.compiere.swing.CEditor
setVisible
 

Constructor Detail

CText

public CText()
Constructs a new TextArea. A default model is set, the initial string is null, and rows/columns are set to 0.


CText

public CText(String text)
Constructs a new TextArea with the specified text displayed. A default model is created and rows/columns are set to 0.

Parameters:
text - the text to be displayed, or null

CText

public CText(int rows,
             int columns)
Constructs a new empty TextArea with the specified number of rows and columns. A default model is created, and the initial string is null.

Parameters:
rows - the number of rows >= 0
columns - the number of columns >= 0
Throws:
IllegalArgumentException - if the rows or columns arguments are negative.

CText

public CText(String text,
             int rows,
             int columns)
Constructs a new TextArea with the specified text and number of rows and columns. A default model is created.

Parameters:
text - the text to be displayed, or null
rows - the number of rows >= 0
columns - the number of columns >= 0
Throws:
IllegalArgumentException - if the rows or columns arguments are negative.

CText

public CText(Document doc)
Constructs a new JTextArea with the given document model, and defaults for all of the other arguments (null, 0, 0).

Parameters:
doc - the model to use

CText

public CText(Document doc,
             String text,
             int rows,
             int columns)
Constructs a new JTextArea with the specified number of rows and columns, and the given model. All of the constructors feed through this constructor.

Parameters:
doc - the model to use, or create a default one if null
text - the text to be displayed, null if none
rows - the number of rows >= 0
columns - the number of columns >= 0
Throws:
IllegalArgumentException - if the rows or columns arguments are negative.

CText

public CText(JTextArea textArea)
Create a JScrollArea with a JTextArea

Parameters:
textArea -
Method Detail

setMandatory

public void setMandatory(boolean mandatory)
Set Editor Mandatory

Specified by:
setMandatory in interface CEditor
Parameters:
mandatory - true, if you have to enter data

isMandatory

public boolean isMandatory()
Is Field mandatory

Specified by:
isMandatory in interface CEditor
Returns:
true, if mandatory

setReadWrite

public void setReadWrite(boolean rw)
Enable Editor

Specified by:
setReadWrite in interface CEditor
Parameters:
rw - true, if you can enter/select data

isReadWrite

public boolean isReadWrite()
Is it possible to edit

Specified by:
isReadWrite in interface CEditor
Returns:
true, if editable

setBackground

public void setBackground(boolean error)
Set Background based on editable / mandatory / error

Specified by:
setBackground in interface CEditor
Parameters:
error - if true, set background to error color, otherwise mandatory/editable

setBackground

public void setBackground(Color color)
Overrides:
setBackground in class JComponent

getBackground

public Color getBackground()
Overrides:
getBackground in class Component

setForeground

public void setForeground(Color color)
Overrides:
setForeground in class JComponent

getForeground

public Color getForeground()
Overrides:
getForeground in class Component

setValue

public void setValue(Object value)
Set Editor to value

Specified by:
setValue in interface CEditor
Parameters:
value - value of the editor

getValue

public Object getValue()
Return Editor value

Specified by:
getValue in interface CEditor
Returns:
current value

getDisplay

public String getDisplay()
Return Display Value

Specified by:
getDisplay in interface CEditor
Returns:
displayed String value

setText

public void setText(String text)
Set Text

Parameters:
text -

getText

public String getText()

append

public void append(String text)

setColumns

public void setColumns(int cols)

getColumns

public int getColumns()

setRows

public void setRows(int rows)

getRows

public int getRows()

setCaretPosition

public void setCaretPosition(int pos)

getCaretPosition

public int getCaretPosition()

setEditable

public void setEditable(boolean edit)

isEditable

public boolean isEditable()

setLineWrap

public void setLineWrap(boolean wrap)

setWrapStyleWord

public void setWrapStyleWord(boolean word)

setOpaque

public void setOpaque(boolean isOpaque)
Overrides:
setOpaque in class JComponent

addFocusListener

public void addFocusListener(FocusListener l)
Overrides:
addFocusListener in class Component

addMouseListener

public void addMouseListener(MouseListener l)
Overrides:
addMouseListener in class Component

addKeyListener

public void addKeyListener(KeyListener l)
Overrides:
addKeyListener in class Component

addInputMethodListener

public void addInputMethodListener(InputMethodListener l)
Overrides:
addInputMethodListener in class Component

getInputMethodRequests

public InputMethodRequests getInputMethodRequests()
Overrides:
getInputMethodRequests in class Component

setInputVerifier

public void setInputVerifier(InputVerifier l)
Overrides:
setInputVerifier in class JComponent

Compiere Looks 1.2.1

Copyright (c) 1999-2003 ComPiere, Inc. - Author: Jorg Janke