soc.client
Class SOCPlayerInterface.SOCPITextfieldListener

java.lang.Object
  extended byjava.awt.event.KeyAdapter
      extended bysoc.client.SOCPlayerInterface.SOCPITextfieldListener
All Implemented Interfaces:
java.util.EventListener, java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.TextListener
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.


Field Summary
private  SOCPlayerInterface pi
           
 
Constructor Summary
SOCPlayerInterface.SOCPITextfieldListener(SOCPlayerInterface spi)
           
 
Method Summary
 void focusGained(java.awt.event.FocusEvent e)
          Stub required for FocusListner.
 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
 

Field Detail

pi

private SOCPlayerInterface pi
Constructor Detail

SOCPlayerInterface.SOCPITextfieldListener

public SOCPlayerInterface.SOCPITextfieldListener(SOCPlayerInterface spi)
Method Detail

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

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)
Stub required for FocusListner.

Specified by:
focusGained in interface java.awt.event.FocusListener