Back to index

wims  3.65+svn20090927
ChoiceAction.java
Go to the documentation of this file.
00001 package rene.gui;
00002 
00003 import java.awt.Choice;
00004 import java.awt.event.ItemEvent;
00005 import java.awt.event.ItemListener;
00006 
00007 class ChoiceTranslator implements ItemListener
00008 {   DoActionListener C;
00009     String S;
00010     public Choice Ch;
00011     public ChoiceTranslator
00012         (Choice ch, DoActionListener c, String s)
00013     {   C=c; S=s; Ch=ch;
00014     }
00015     public void itemStateChanged (ItemEvent e)
00016     {   C.itemAction(S,e.getStateChange()==ItemEvent.SELECTED);
00017     }
00018 }
00019 
00028 public class ChoiceAction extends Choice
00029 {   public ChoiceAction (DoActionListener c, String s)
00030     {   addItemListener(new ChoiceTranslator(this,c,s));
00031         if (Global.NormalFont!=null) setFont(Global.NormalFont);
00032               if (Global.Background!=null) setBackground(Global.Background);
00033     }
00034 }