key(s) dont磏 work after i change jre 1.3 to 1.5

i have a system that use key f8 and f12

when i change jre 1.3 to 1.5 they don磘 work

can anybody help me?

this.addKeyListener(new java.awt.event.KeyAdapter()

{

public void keyPressed(KeyEvent e)

{

this_keyPressed(e);

}

});

void this_keyPressed(KeyEvent e)

{

int ke = e.getKeyCode();

boolean control = e.isControlDown();

if(ke == KeyEvent.VK_F12)

{

Button_actionPerformed(null);

}

if(ke == KeyEvent.VK_F8)

{

try

{

(cardPanel.getPanel((String)sequenciaPanels.elementAt(index))).mais();

}

catch(Exception ex) {};

}

}

[678 byte] By [lamatiasa] at [2007-11-27 8:32:22]
# 1
Oh, yes! The ntroduction of the new KeyboadFocusManager class in 1.4 gave trouble to a number of applications. Have a look at http://java.sun.com/j2se/1.4.2/docs/api/java/awt/doc-files/FocusSpec.htmlYou will have to rewrite some part of your code.regardsJ鰎g
Joerg22a at 2007-7-12 20:28:12 > top of Java-index,Desktop,Core GUI APIs...
# 2

Don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags[/url] so the posted code retains its original formatting.

You should be using KeyEvents anyway. You should be using "Key Bindings". Read the Swing tutorial for more information:

http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html

camickra at 2007-7-12 20:28:12 > top of Java-index,Desktop,Core GUI APIs...
# 3

Thanks everybody

i rewrite de code :

KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(

new KeyEventDispatcher() {

public boolean dispatchKeyEvent(KeyEvent e) {

// This example converts all typed keys to upper case

if(e.getKeyCode() == KeyEvent.VK_ENTER)

System.out.println("ENTER");

if(e.getKeyCode() == KeyEvent.VK_F12){

System.out.println("f12");

}

if (e.getID() == KeyEvent.KEY_TYPED) {

e.setKeyChar(Character.toUpperCase(e.getKeyChar()));

}

// If the key should not be dispatched to the

// focused component, set discardEvent to true

boolean discardEvent = false;

return discardEvent;

}

});

lamatiasa at 2007-7-12 20:28:12 > top of Java-index,Desktop,Core GUI APIs...