<s> """<STR_LIT>""" <EOL> from java import applet , awt <EOL> from java . awt . event import ItemEvent <EOL> from pawt import GridBag <EOL> class ListDemo ( applet . Applet ) : <EOL> def fillList ( self , list , names ) : <EOL> list . actionPerformed = self . action <EOL> list . itemStateChanged = self . change <EOL> for name in names : <EOL> list . add ( name ) <EOL> def init ( self ) : <EOL> self . spanish = awt . List ( <NUM_LIT:4> , <NUM_LIT:1> ) <EOL> self . fillList ( self . spanish , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . italian = awt . List ( ) <EOL> self . fillList ( self . italian , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . output = awt . TextArea ( <NUM_LIT:10> , <NUM_LIT> , editable = <NUM_LIT:0> ) <EOL> bag = GridBag ( self ) <EOL> bag . add ( self . output , <EOL> fill = '<STR_LIT>' , weightx = <NUM_LIT:1.0> , weighty = <NUM_LIT:1.0> , <EOL> gridheight = <NUM_LIT:2> ) <EOL> bag . addRow ( self . spanish , fill = '<STR_LIT>' ) <EOL> bag . addRow ( self . italian , fill = '<STR_LIT>' ) <EOL> self . language = { self . spanish : '<STR_LIT>' , self . italian : '<STR_LIT>' } <EOL> def action ( self , e ) : <EOL> list = e . source <EOL> text = '<STR_LIT>' <EOL> self . output . append ( text % ( list . selectedItem , self . language [ list ] ) ) <EOL> def change ( self , e ) : <EOL> list = e . source <EOL> if e . stateChange == ItemEvent . SELECTED : <EOL> select = '<STR_LIT>' <EOL> else : <EOL> select = '<STR_LIT>' <EOL> text = '<STR_LIT>' <EOL> params = ( select , e . item , list . getItem ( e . item ) , self . language [ list ] ) <EOL> self . output . append ( text % params ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> import pawt <EOL> pawt . test ( ListDemo ( ) ) </s>
