cancel
Showing results for 
Search instead for 
Did you mean: 

Keylistener for a mobile AWT application

Former Member
0 Kudos

Hello!

I'm developing a mobile AWT application and I need a keylistener. When I'm testing the app as a Java app the keylistener is working well, but in the mobile infrastructure and at the PDA it doesn't work. any ideas?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I've solved the problem! The panel didn't get the focus and so the keylistener didn't work!

Former Member
0 Kudos

hi jo!

i'm using jdk1.3.1

here a code example:


public class PrintingMenuPanel extends BUBPanel implements KeyListener  {

	public PrintingMenuPanel() {
		addKeyListener(this);
		Panel container = new Panel();
		container.setLayout(new GridLayout(2,1,3,3));
		container.add(new Button("1 - Aus Fertingsaufgrag", this, "1"));
		container.add(new Button("2 - Aus Bestellung", this, "2"));
		
		setLayout(new BorderLayout());
		add(container, BorderLayout.NORTH);
		
	}

	public void actionPerformed(ActionEvent ae) {
		if(ae.getActionCommand().equalsIgnoreCase("1"))
			getRootPanel().showPrintingContractMenuPanel();
		if(ae.getActionCommand().equalsIgnoreCase("2"))
			getRootPanel().showPrintingOrderMenuPanel();
	}

	public void keyPressed(KeyEvent e) {
		System.out.println(e.toString());		
	}

	public void keyReleased(KeyEvent e) {
		System.out.println(e.toString());		
	}

	public void keyTyped(KeyEvent e) {
		System.out.println(e.toString());		
	}
}

Former Member
0 Kudos

hi markus,

which version of jdk are you using?

can you post your keylistener implementation?

regards

jo