dsto.dfc.swing.controls
Class IconTextField

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by dsto.dfc.swing.controls.IconTextField
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, ComboBoxEditor

public class IconTextField
extends JPanel
implements ComboBoxEditor

TextField-like control with an icon display for showing an appropriate icon to the left of the text. Implements the ComboBoxEditor interface so it can be used in a combo box.

Version:
$Revision$
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  boolean actionOnLoseFocus
           
protected  GridBagLayout gridBagLayout1
           
protected  JLabel iconLabel
           
protected  dsto.dfc.swing.controls.IconTextField.MyTextField textField
           
 
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.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
IconTextField()
           
 
Method Summary
 void addActionListener(ActionListener l)
           
 boolean getActionOnLoseFocus()
           
 int getColumns()
           
 Component getEditorComponent()
           
 Icon getIcon()
           
 Object getItem()
           
 String getText()
           
 boolean isEditable()
           
 void removeActionListener(ActionListener l)
           
 void requestFocus()
           
 void selectAll()
           
 void setActionOnLoseFocus(boolean newValue)
          Control whether action event is posted when editor loses focus (false by default).
 void setColumns(int newValue)
           
 void setEditable(boolean newValue)
           
 void setFont(Font newFont)
           
 void setIcon(Icon newValue)
           
 void setItem(Object anObject)
           
 void setText(String newValue)
           
protected  void textEdited()
          Called when the text field is edited.
protected  void textEditFinished()
          Called when the user has finished editing the text field.
 void updateIcon()
          Override this to update the icon to match the current state of the control.
 void updateUI()
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, 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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, 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, 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

actionOnLoseFocus

protected boolean actionOnLoseFocus

gridBagLayout1

protected GridBagLayout gridBagLayout1

iconLabel

protected JLabel iconLabel

textField

protected dsto.dfc.swing.controls.IconTextField.MyTextField textField
Constructor Detail

IconTextField

public IconTextField()
Method Detail

updateUI

public void updateUI()
Overrides:
updateUI in class JPanel

setFont

public void setFont(Font newFont)
Overrides:
setFont in class JComponent

setText

public void setText(String newValue)

getText

public String getText()

getColumns

public int getColumns()

setColumns

public void setColumns(int newValue)

setEditable

public void setEditable(boolean newValue)

isEditable

public boolean isEditable()

requestFocus

public void requestFocus()
Overrides:
requestFocus in class JComponent

setActionOnLoseFocus

public void setActionOnLoseFocus(boolean newValue)
Control whether action event is posted when editor loses focus (false by default). This enables "auto commit" of values when the user changes focus but can cause problems where selections from the drop down list fail have any effect, possibly due to some sort of swing bug.


getActionOnLoseFocus

public boolean getActionOnLoseFocus()

getIcon

public Icon getIcon()

setIcon

public void setIcon(Icon newValue)

updateIcon

public void updateIcon()
Override this to update the icon to match the current state of the control.


textEdited

protected void textEdited()
Called when the text field is edited. Subclasses may choose to override this. Default is to clear the displayed icon.

See Also:
textEditFinished()

textEditFinished

protected void textEditFinished()
Called when the user has finished editing the text field.

See Also:
textEdited()

getEditorComponent

public Component getEditorComponent()
Specified by:
getEditorComponent in interface ComboBoxEditor

setItem

public void setItem(Object anObject)
Specified by:
setItem in interface ComboBoxEditor

getItem

public Object getItem()
Specified by:
getItem in interface ComboBoxEditor

selectAll

public void selectAll()
Specified by:
selectAll in interface ComboBoxEditor

addActionListener

public void addActionListener(ActionListener l)
Specified by:
addActionListener in interface ComboBoxEditor

removeActionListener

public void removeActionListener(ActionListener l)
Specified by:
removeActionListener in interface ComboBoxEditor


Copyright © 2008 Commonwealth of Australia