soc.client
Class SOCPlayerInterface.SOCPITextfieldListener
java.lang.Object
java.awt.event.KeyAdapter
soc.client.SOCPlayerInterface.SOCPITextfieldListener
- All Implemented Interfaces:
- java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.TextListener, java.util.EventListener
- Enclosing class:
- SOCPlayerInterface
private static class SOCPlayerInterface.SOCPITextfieldListener
- extends java.awt.event.KeyAdapter
- implements java.awt.event.TextListener, java.awt.event.FocusListener
Used for chat textfield setting/clearing initial prompt text
(TEXTINPUT_INITIAL_PROMPT_MSG).
It's expected that after the player sends their first line of chat text,
the listeners will be removed so we don't have the overhead of
calling these methods.
- Since:
- 1.1.00
- Author:
- jdmonin
Method Summary |
void |
focusGained(java.awt.event.FocusEvent e)
Clear the initial prompt message when textfield is entered or clicked on. |
void |
focusLost(java.awt.event.FocusEvent e)
If input text is cleared, and player leaves the textfield while it's empty,
show the prompt message unless they've already sent a line of chat. |
void |
keyPressed(java.awt.event.KeyEvent e)
If first keypress in initially empty field, clear that prompt message |
void |
textValueChanged(java.awt.event.TextEvent e)
If input text is cleared, and field is again empty, show the
prompt message unless player has already sent a line of chat. |
Methods inherited from class java.awt.event.KeyAdapter |
keyReleased, keyTyped |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
pi
private SOCPlayerInterface pi
SOCPlayerInterface.SOCPITextfieldListener
public SOCPlayerInterface.SOCPITextfieldListener(SOCPlayerInterface spi)
keyPressed
public void keyPressed(java.awt.event.KeyEvent e)
- If first keypress in initially empty field, clear that prompt message
- Specified by:
keyPressed
in interface java.awt.event.KeyListener
- Overrides:
keyPressed
in class java.awt.event.KeyAdapter
textValueChanged
public void textValueChanged(java.awt.event.TextEvent e)
- If input text is cleared, and field is again empty, show the
prompt message unless player has already sent a line of chat.
- Specified by:
textValueChanged
in interface java.awt.event.TextListener
focusLost
public void focusLost(java.awt.event.FocusEvent e)
- If input text is cleared, and player leaves the textfield while it's empty,
show the prompt message unless they've already sent a line of chat.
- Specified by:
focusLost
in interface java.awt.event.FocusListener
focusGained
public void focusGained(java.awt.event.FocusEvent e)
- Clear the initial prompt message when textfield is entered or clicked on.
- Specified by:
focusGained
in interface java.awt.event.FocusListener