Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

oracle.javatools.ui
Class ExtendedTextField

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JTextField
                      extended by oracle.javatools.ui.search.PromptedTextField
                          extended by oracle.javatools.ui.ExtendedTextField
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.Scrollable, javax.swing.SwingConstants

public final class ExtendedTextField
extends PromptedTextField

A custom text component for use where the contents of a text field may be considerably longer than the visible area of the text field, and where using a larger JTextArea is not suitable.

When the field has focus and its contents are too large to display: a popup window will appear containing a multi-line text area that shows the contents of the field. This text area is fully editable and will un-pop when either:
- the focus is lost (see below)
- the contents are deleted so they can all fit in the standard field.
- the user hits Esc, Enter or Tab

To prevent the extended area from automatically hiding when it loses focus:
- Mark an individual component with the "don't hide" constant: component.putClientProperty(ExtendedTextField.DONT_HIDE_COMPONENT_ON_FOCUS_CHANGE, Boolean.TRUE)
- or mark a whole window by putting the "don't hide" constant in it's rootPane: window.getJRootPane().putClientProperty(ExtendedTextField.DONT_HIDE_COMPONENT_ON_FOCUS_CHANGE, Boolean.TRUE)

Since:
11.0
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JTextField
javax.swing.JTextField.AccessibleJTextField
 
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.DropLocation, javax.swing.text.JTextComponent.KeyBinding
 
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
static java.lang.String DONT_HIDE_COMPONENT_ON_FOCUS_CHANGE
          Add this constant with Boolean.TRUE to a components client properties to prevent the extended text area from hiding when it loses focus to the component:
component.putClientProperty(ExtendedTextField.DONT_HIDE_COMPONENT_ON_FOCUS_CHANGE, Boolean.TRUE)
or use:
window.getJRootPane().putClientProperty(ExtendedTextField.DONT_HIDE_COMPONENT_ON_FOCUS_CHANGE, Boolean.TRUE)
to prevent the text area from hiding when a window gets focus
 
Fields inherited from class javax.swing.JTextField
notifyAction
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
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.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ExtendedTextField()
           
ExtendedTextField(boolean allowTabs)
          Create a ExtendedTextArea
 
Method Summary
 void addNotify()
           
 boolean canAllowBreaks()
          If false line breaks are filtered like in a standard text field and the default dialog action is called instead (JTextField.NotifyAction)
static java.lang.String getClipString(java.awt.FontMetrics fm, java.lang.String string, int availTextWidth)
           
 javax.swing.BoundedRangeModel getHorizontalVisibility()
           
 javax.swing.JTextArea getLargerTextArea()
           
 java.awt.Dimension getMinimumSize()
           
 java.awt.Dimension getPreferredSize()
           
protected  int getRowHeight()
           
protected  void paintComponent(java.awt.Graphics g)
           
protected  void processFocusEvent(java.awt.event.FocusEvent e)
           
 void removeNotify()
           
 void scrollRectToVisible(java.awt.Rectangle r)
           
 void setAllowBreaks(boolean allowBreaks)
          Determines whether the control allows inputing of line breaks ('\n', enter) like a text field (no - they are filtered and the default dialog action can be called instead) or like a text area (yes).
 void setBackground(java.awt.Color color)
           
 void setDocument(javax.swing.text.Document doc)
           
 void setFont(java.awt.Font font)
           
 void setForeground(java.awt.Color color)
           
 void setLargerAreaVisible(boolean visible)
           
 void setScrollOffset(int scrollOffset)
           
 void setText(java.lang.String text)
           
 
Methods inherited from class oracle.javatools.ui.search.PromptedTextField
getBaseDocument, getPrompt, getPromptForeground, isPromptVisible, setPrompt, setPromptForeground
 
Methods inherited from class javax.swing.JTextField
actionPropertyChanged, addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, createDefaultModel, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getScrollOffset, getUIClassID, isValidateRoot, paramString, postActionEvent, removeActionListener, setAction, setActionCommand, setColumns, setHorizontalAlignment
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
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, 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, 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, processHierarchyBoundsEvent, processHierarchyEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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
 

Field Detail

DONT_HIDE_COMPONENT_ON_FOCUS_CHANGE

public static final java.lang.String DONT_HIDE_COMPONENT_ON_FOCUS_CHANGE
Add this constant with Boolean.TRUE to a components client properties to prevent the extended text area from hiding when it loses focus to the component:
component.putClientProperty(ExtendedTextField.DONT_HIDE_COMPONENT_ON_FOCUS_CHANGE, Boolean.TRUE)
or use:
window.getJRootPane().putClientProperty(ExtendedTextField.DONT_HIDE_COMPONENT_ON_FOCUS_CHANGE, Boolean.TRUE)
to prevent the text area from hiding when a window gets focus

See Also:
Constant Field Values
Constructor Detail

ExtendedTextField

public ExtendedTextField()

ExtendedTextField

public ExtendedTextField(boolean allowTabs)
Create a ExtendedTextArea

Parameters:
allowTabs - If true tab will insert a tab ('\t') into the document and ctrl-tab will be required to move focus. If false tab act as focus traversal key (depending on look and feel).
Method Detail

addNotify

public void addNotify()
Overrides:
addNotify in class javax.swing.JComponent

removeNotify

public void removeNotify()
Overrides:
removeNotify in class javax.swing.text.JTextComponent

processFocusEvent

protected void processFocusEvent(java.awt.event.FocusEvent e)
Overrides:
processFocusEvent in class java.awt.Component

setDocument

public void setDocument(javax.swing.text.Document doc)
Overrides:
setDocument in class javax.swing.JTextField

setLargerAreaVisible

public void setLargerAreaVisible(boolean visible)

setForeground

public void setForeground(java.awt.Color color)
Overrides:
setForeground in class javax.swing.JComponent

setBackground

public void setBackground(java.awt.Color color)
Overrides:
setBackground in class javax.swing.JComponent

setFont

public void setFont(java.awt.Font font)
Overrides:
setFont in class javax.swing.JTextField

setText

public void setText(java.lang.String text)
Overrides:
setText in class javax.swing.text.JTextComponent

getLargerTextArea

public javax.swing.JTextArea getLargerTextArea()
Returns:
the text area contained in the popup window

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JTextField

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class javax.swing.JComponent

getRowHeight

protected int getRowHeight()

getHorizontalVisibility

public javax.swing.BoundedRangeModel getHorizontalVisibility()
Overrides:
getHorizontalVisibility in class javax.swing.JTextField

setScrollOffset

public void setScrollOffset(int scrollOffset)
Overrides:
setScrollOffset in class javax.swing.JTextField

scrollRectToVisible

public void scrollRectToVisible(java.awt.Rectangle r)
Overrides:
scrollRectToVisible in class javax.swing.JTextField

setAllowBreaks

public void setAllowBreaks(boolean allowBreaks)
Determines whether the control allows inputing of line breaks ('\n', enter) like a text field (no - they are filtered and the default dialog action can be called instead) or like a text area (yes).

Parameters:
allowBreaks -

canAllowBreaks

public boolean canAllowBreaks()
If false line breaks are filtered like in a standard text field and the default dialog action is called instead (JTextField.NotifyAction)

Returns:

paintComponent

protected void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class PromptedTextField

getClipString

public static java.lang.String getClipString(java.awt.FontMetrics fm,
                                             java.lang.String string,
                                             int availTextWidth)

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

Copyright © 1997, 2011, Oracle. All rights reserved.