edu.princeton.swing
public class PTextField extends javax.swing.JTextField implements ClipboardTarget
javax.swing.JTextField.AccessibleJTextFieldjavax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.DropLocation, javax.swing.text.JTextComponent.KeyBindingjavax.swing.JComponent.AccessibleJComponentaccessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT| Constructor and Description |
|---|
PTextField()
Constructs a new PTextField.
|
PTextField(javax.swing.text.Document doc,
java.lang.String text,
int columns)
Constructs a new PTextField.
|
PTextField(int columns)
Constructs a new PTextField.
|
PTextField(java.lang.String text)
Constructs a new PTextField.
|
PTextField(java.lang.String text,
int columns)
Constructs a new PTextField.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addActionListener(java.awt.event.ActionListener listener)
Adds a listener to monitor action events (enter key events) on the PTextField.
|
boolean |
canCopy()
Returns wheter or not the copy operation can be performed on this ClipboardTarget.
|
boolean |
canCut()
Returns wheter or not the cut operation can be performed on this ClipboardTarget.
|
boolean |
canPaste()
Returns wheter or not the paste operation can be performed on this ClipboardTarget.
|
boolean |
canSelectAll()
Returns wheter or not the selectAll operation can be performed on this ClipboardTarget.
|
java.lang.String |
getActionCommand()
Returns the action command associated with the enter key being pressed.
|
javax.swing.JPopupMenu |
getPopupMenu()
Gets the popup menu for this component.
|
protected void |
processFocusEvent(java.awt.event.FocusEvent e)
Intercept FocusEvents to notify the ClipboardTargetManager of the event.
|
protected void |
processKeyEvent(java.awt.event.KeyEvent e)
Intercept KeyEvents to send off ActionEvents when enter is pressed.
|
protected void |
processMouseEvent(java.awt.event.MouseEvent e)
Intercept MouseEvents to activate the popupMenu at the right time.
|
void |
removeActionListener(java.awt.event.ActionListener listener)
Removes a listener from this component.
|
void |
setActionCommand(java.lang.String actionCommand)
Sets the action command associated with the enter key being pressed.
|
void |
setEditable(boolean editable)
Override the setEditable() method to intercept any changes concerning the editable status of
the component.
|
void |
setEnabled(boolean enabled)
Override the setEnabled() method to intercept any changes concerning the enabled status of
the component.
|
void |
setPopupMenu(javax.swing.JPopupMenu popupMenu)
Sets the popup menu for this component.
|
actionPropertyChanged, configurePropertiesFromAction, createActionPropertyChangeListener, createDefaultModel, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, getUIClassID, isValidateRoot, paramString, postActionEvent, scrollRectToVisible, setAction, setColumns, setDocument, setFont, setHorizontalAlignment, setScrollOffsetaddCaretListener, 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, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, updateUI, viewToModel, writeaddAncestorListener, 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, 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, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, 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, transferFocusDownCycle, validate, validateTreeaction, 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, transferFocusBackward, transferFocusUpCycleclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcopy, cut, paste, selectAllpublic PTextField()
public PTextField(javax.swing.text.Document doc,
java.lang.String text,
int columns)
public PTextField(int columns)
public PTextField(java.lang.String text)
public PTextField(java.lang.String text,
int columns)
public void addActionListener(java.awt.event.ActionListener listener)
addActionListener in class javax.swing.JTextFieldlistener - The listener to add to this document. A null value will cause a
NullPointerException.public void removeActionListener(java.awt.event.ActionListener listener)
removeActionListener in class javax.swing.JTextFieldlistener - The listener to remove from this document. A null value will cause a
NullPointerException.public java.lang.String getActionCommand()
public void setActionCommand(java.lang.String actionCommand)
setActionCommand in class javax.swing.JTextFieldactionCommand - The action command to be associated with the enter key. If null is
passed, the text of the text field at the time of the event will be used.public boolean canCut()
canCut in interface ClipboardTargetpublic boolean canCopy()
canCopy in interface ClipboardTargetpublic boolean canPaste()
canPaste in interface ClipboardTargetpublic boolean canSelectAll()
canSelectAll in interface ClipboardTargetprotected void processKeyEvent(java.awt.event.KeyEvent e)
processKeyEvent in class javax.swing.JComponentprotected void processFocusEvent(java.awt.event.FocusEvent e)
processFocusEvent in class java.awt.Componentprotected void processMouseEvent(java.awt.event.MouseEvent e)
processMouseEvent in class javax.swing.JComponentpublic void setEnabled(boolean enabled)
setEnabled in class javax.swing.JComponentpublic void setEditable(boolean editable)
setEditable in class javax.swing.text.JTextComponentpublic javax.swing.JPopupMenu getPopupMenu()
public void setPopupMenu(javax.swing.JPopupMenu popupMenu)
popupMenu - The popup menu for the component. A null value indicates that this
component should not have a popup menu.