B
biner.sebastien
Hello,
I am working on a little applet game. The applet reads the keys with
a keylistener.
I develop the Applet on Linux using appletviewer and/or Eclipse
(which uses appletviewer I think). When I start the applet this way, it
does not register the key I press. But if open the applet using Firefox
it works. I also tested the Applet with appletviewer on Windows XP and
Mac OsX10.3 and it works.
Has anybody experienced similar problem? Any hint of a solution? If
useful, I use Xandros linux version 3.
I put the code for the Applet at the end of this email if it may help
you help me.
Thanks for any help.
Sebastien.
*** start of code ***
import javax.swing.* ;
import java.awt.* ;
public class Ai1 extends JApplet {
PControle pcontrole ;
PDessin pdessin ;
PJeux pjeux ;
Container cp ;
boolean focus ;
public Vehicule1 v1 = new Vehicule1() ;
// methode init
public void init() {
// on met le focus sur l'applet et on ecoute le clavier
this.setFocusable(true) ;
this.requestFocus() ;
this.addKeyListener(new ecouteClavier(v1)) ;
// initialisation des panel
pdessin = new PDessin(Utilitaires.niPDessin,Utilitaires.njPDessin,v1)
;
pcontrole = new PControle() ;
pjeux = new PJeux(v1) ;
// ajout de panel a l'applet
cp=getContentPane() ;
cp.setLayout(new BoxLayout(cp,BoxLayout.X_AXIS)) ;
//cp.add(pdessin) ;
cp.add(pjeux) ;
cp.add(pcontrole) ;
} // fin init
} //fin Ai1
I am working on a little applet game. The applet reads the keys with
a keylistener.
I develop the Applet on Linux using appletviewer and/or Eclipse
(which uses appletviewer I think). When I start the applet this way, it
does not register the key I press. But if open the applet using Firefox
it works. I also tested the Applet with appletviewer on Windows XP and
Mac OsX10.3 and it works.
Has anybody experienced similar problem? Any hint of a solution? If
useful, I use Xandros linux version 3.
I put the code for the Applet at the end of this email if it may help
you help me.
Thanks for any help.
Sebastien.
*** start of code ***
import javax.swing.* ;
import java.awt.* ;
public class Ai1 extends JApplet {
PControle pcontrole ;
PDessin pdessin ;
PJeux pjeux ;
Container cp ;
boolean focus ;
public Vehicule1 v1 = new Vehicule1() ;
// methode init
public void init() {
// on met le focus sur l'applet et on ecoute le clavier
this.setFocusable(true) ;
this.requestFocus() ;
this.addKeyListener(new ecouteClavier(v1)) ;
// initialisation des panel
pdessin = new PDessin(Utilitaires.niPDessin,Utilitaires.njPDessin,v1)
;
pcontrole = new PControle() ;
pjeux = new PJeux(v1) ;
// ajout de panel a l'applet
cp=getContentPane() ;
cp.setLayout(new BoxLayout(cp,BoxLayout.X_AXIS)) ;
//cp.add(pdessin) ;
cp.add(pjeux) ;
cp.add(pcontrole) ;
} // fin init
} //fin Ai1