megamek.client.ui.AWT
Class CamoChoiceListener

java.lang.Object
  extended by megamek.client.ui.AWT.CamoChoiceListener
All Implemented Interfaces:
java.awt.event.ItemListener, java.util.EventListener

public class CamoChoiceListener
extends java.lang.Object
implements java.awt.event.ItemListener

Helper class to handle camo selection. This class will update an ImageButton to show the selection, update a Player to use the selection, and (optionally) communicate the selection to the server through a Client. Created on January 24, 2004

Version:
1
Author:
James Damour

Constructor Summary
CamoChoiceListener(CamoChoiceDialog camoDialog, ImageButton button, java.awt.Color background, ChatLounge chat)
          Create a new camo selection listener that alerts a server.
CamoChoiceListener(CamoChoiceDialog camoDialog, ImageButton button, java.awt.Color background, Player player)
          Create a new camo selection listener that does not alert a server.
 
Method Summary
 void itemStateChanged(java.awt.event.ItemEvent event)
          Update the camo button when the selection dialog tells us to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CamoChoiceListener

public CamoChoiceListener(CamoChoiceDialog camoDialog,
                          ImageButton button,
                          java.awt.Color background,
                          ChatLounge chat)
Create a new camo selection listener that alerts a server.

Parameters:
camoDialog - - the CamoChoiceDialog that is being listened to.
button - - the ImageButton that gets updated.
background - - the default background Color for the button when a camo image is selected.
player - - the int ID of the player whose camo is updated.
sender - - the Client that sends the update.

CamoChoiceListener

public CamoChoiceListener(CamoChoiceDialog camoDialog,
                          ImageButton button,
                          java.awt.Color background,
                          Player player)
Create a new camo selection listener that does not alert a server.

Parameters:
camoDialog - - the CamoChoiceDialog that is being listened to.
button - - the ImageButton that gets updated.
background - - the default background Color for the button when a camo image is selected.
player - - the Player whose camo is updated.
Method Detail

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent event)
Update the camo button when the selection dialog tells us to.

Implements ItemListener.

Specified by:
itemStateChanged in interface java.awt.event.ItemListener
Parameters:
event - - the ItemEvent of the camo selection.