Subversion Repositories wimsdev

Rev

Blame | Last modification | View Log | RSS feed

  1. package rene.gui;
  2.  
  3. import java.awt.Choice;
  4. import java.awt.event.ItemEvent;
  5. import java.awt.event.ItemListener;
  6.  
  7. class ChoiceTranslator implements ItemListener
  8. {   DoActionListener C;
  9.     String S;
  10.     public Choice Ch;
  11.     public ChoiceTranslator
  12.         (Choice ch, DoActionListener c, String s)
  13.     {   C=c; S=s; Ch=ch;
  14.     }
  15.     public void itemStateChanged (ItemEvent e)
  16.     {   C.itemAction(S,e.getStateChange()==ItemEvent.SELECTED);
  17.     }
  18. }
  19.  
  20. /**
  21. This is a choice item, which sets a specified font and translates
  22. events into strings, which are passed to the doAction method of the
  23. DoActionListener.
  24. @see jagoclient.gui.CloseFrame#doAction
  25. @see jagoclient.gui.CloseDialog#doAction
  26. */
  27.  
  28. public class ChoiceAction extends Choice
  29. {   public ChoiceAction (DoActionListener c, String s)
  30.     {   addItemListener(new ChoiceTranslator(this,c,s));
  31.         if (Global.NormalFont!=null) setFont(Global.NormalFont);
  32.                 if (Global.Background!=null) setBackground(Global.Background);
  33.     }
  34. }
  35.