src/horaris/MainList.java
changeset 9 9f8e342f193e
parent 5 2b51aa79357a
child 10 757b42639637
equal deleted inserted replaced
8:88f4defbb1db 9:9f8e342f193e
     1 package horaris;
     1 package horaris;
     2 
     2 
     3 import javax.microedition.lcdui.*;
     3 import javax.microedition.lcdui.*;
     4 import java.util.Hashtable;
     4 import java.util.Hashtable;
       
     5 import java.util.Vector;
     5 
     6 
     6 import ogdl.*;
     7 import ogdl.*;
     7 
     8 
     8 public class MainList implements CommandListener, Ekrano
     9 public class MainList implements CommandListener, Ekrano
     9 {
    10 {
    10 	private Graph list;
    11 	private Graph list;
    11 	private List mylist;
    12 	private List mylist;
    12 	private Command cmd_eliri;
    13 	private Command cmd_eliri;
       
    14 	private Command cmd_about;
    13 	private Main main;
    15 	private Main main;
    14 	private Hashtable table;
    16 	private Hashtable table;
    15 
    17 
    16 	public MainList(Main _main)
    18 	public MainList(Main _main)
    17 	{
    19 	{
    26 		/* Show the Titles (they're also in the hashtable) */
    28 		/* Show the Titles (they're also in the hashtable) */
    27 		for (int i=0; i < list.size(); i++)
    29 		for (int i=0; i < list.size(); i++)
    28 			mylist.append(list.get(i).get(0).getName(), null);
    30 			mylist.append(list.get(i).get(0).getName(), null);
    29 
    31 
    30 		cmd_eliri = new Command("Sortir", Command.BACK, 0);
    32 		cmd_eliri = new Command("Sortir", Command.BACK, 0);
       
    33 		cmd_about = new Command("Programa", Command.HELP, 0);
    31 
    34 
    32 		mylist.addCommand(cmd_eliri);
    35 		mylist.addCommand(cmd_eliri);
       
    36 		mylist.addCommand(cmd_about);
    33 		mylist.setCommandListener(this);
    37 		mylist.setCommandListener(this);
    34 		System.err.println("Setting screen");
    38 		System.err.println("Setting screen");
    35 		main.display.setCurrent(mylist);
    39 		main.display.setCurrent(mylist);
    36 	}
    40 	}
    37 
    41 
    62 
    66 
    63 			dosiero = (String) table.get(mylist.getString(mylist.getSelectedIndex()));
    67 			dosiero = (String) table.get(mylist.getString(mylist.getSelectedIndex()));
    64 			System.err.println("Loading file " + dosiero);
    68 			System.err.println("Loading file " + dosiero);
    65 
    69 
    66 			loadHoraro(dosiero);
    70 			loadHoraro(dosiero);
       
    71 		} else if (c == cmd_about)
       
    72 		{
       
    73 			Vector str = new Vector();
       
    74 			str.addElement("Programa \"Horaris\"");
       
    75 			str.addElement("Llicència GPL 1.2");
       
    76 			str.addElement("Autor: Lluís Batlle i Rossell");
       
    77 			ShowText st = new ShowText(str, this);
    67 		}
    78 		}
    68 	}
    79 	}
    69 
    80 
    70 	private void loadHoraro(String dosiero)
    81 	private void loadHoraro(String dosiero)
    71 	{
    82 	{