Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    [J2ME] Errore settaggio evento

    Sapete dirmi dove sbaglio?

    codice:
    public void startApp() {
            //initialize();
            display = Display.getDisplay(this);               
    	//ottengo il display
            
            cmExit = new Command("Exit", Command.EXIT, 1);
            cmBack = new Command("Back", Command.BACK, 1);
            cmTerzo = new Command("Terzo", Command.SCREEN, 4);
            cmPrimo = new Command("Primo", Command.SCREEN, 2);        
            cmSecondo = new Command("Secondo", Command.SCREEN, 3);
    
        
    	form = new Form("Form");    
    	// creo il contenitore
            
            form.addCommand(cmExit);
    
            form.addCommand(cmPrimo);
            form.addCommand(cmSecondo);
            form.addCommand(cmTerzo);
            form.setCommandListener(this); 
    
            tbAction = new TextBox("TextBox", "Inserisci i tuoi dati", 25, 0);
            tbAction.addCommand(cmBack);
            tbAction.setCommandListener(this);           
    	StringItem sItem = new StringItem(null,"Applicazione fatta da Massimo");
    	//creo il componente
            
    	form.append(sItem);                               
    	//aggiungo il componente al contenitore
    	display.setCurrent(form);                         
    	//imposto come displayable corrente
    
        }
    L'errore è nella parte in neretto!

  2. #2
    Che errore ti da?

    Ciao.
    Si può vincere o perdere, l'importante è vincere o perdere da uomini...

    Neverland - Il mio Forum

  3. #3
    codice:
    HelloMidlet.java:62: setCommandListener(javax.microedition.lcdui.CommandListener) in javax.microedition.lcdui.Displayable cannot be applied to (hello.HelloMidlet)
            form.setCommandListener(this);
    
    HelloMidlet.java:66: setCommandListener(javax.microedition.lcdui.CommandListener) in javax.microedition.lcdui.Displayable cannot be applied to (hello.HelloMidlet)
            tbAction.setCommandListener(this);
    
    2 errors

  4. #4
    come ti dice il compilatore a quei due metodi devi passare un oggetto di tipo javax.microedition.lcdui.CommandListener quindi il this non va bene!

    Ciao.
    Si può vincere o perdere, l'importante è vincere o perdere da uomini...

    Neverland - Il mio Forum

  5. #5
    Non voleva l'oggetto, gli mancava l'interfaccia!me l'ero dimenticata.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.