Merci,
J'ai un peu fouille le forum mais la je sèche un peu,
j'ai essaye plusieurs possibilite mais toute echoue.
J'ai F5 et F6 qui me fond défile des choix (j'ai créer un deuxième déffilement de choix ), ceci est fonctionnel .
A l'écran j'ai bien F5 = CHOIX1 par (exemple)
et F6 = CHOIX3 par exemple
et je voudrai que F8 me permette d'affiche et d'utilise le choix 1 ou le choix 3
ceci etant fait pour ne pas a avoir tout le temps a faire défile pour choisir.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| package r1bellu2b.norecoil;
import org.jnativehook.GlobalScreen;
import org.jnativehook.NativeHookException;
import org.jnativehook.keyboard.NativeKeyEvent;
import org.jnativehook.keyboard.NativeKeyListener;
import static r1bellu2b.norecoil.Main.Choix.CHOIX1;
public class KeyBoardListener implements NativeKeyListener {
public void nativeKeyTyped(NativeKeyEvent e) {
}
public void nativeKeyPressed(NativeKeyEvent e) {
if (e.getKeyCode() == NativeKeyEvent.VC_F5) {
ConfigManager.getInstance().cycleConfigs();
// Main.choix = Main.memoireChoix.getOrDefault(ConfigManager.getInstance().getCurrentConfig(), Main.Choix.CHOIX1);
}
if (e.getKeyCode() == NativeKeyEvent.VC_F6) {
ConfigManager2.getInstance().cycleConfigs();
// Main.choix = Main.memoireChoix.getOrDefault(ConfigManager.getInstance().getCurrentConfig(), Main.Choix.CHOIX1);
}
if (e.getKeyCode() == NativeKeyEvent.VC_F8) {
//c'est ici que je seche !!!!
Main.choix = Main.memoireChoix.getOrDefault(ConfigManager.getInstance().getCurrentConfig(), Main.Choix.CHOIX1);
}
if (e.getKeyCode() == NativeKeyEvent.VC_F7) { //VISEURS
Main.choix = Main.choix.next(CHOIX1);
Main.memoireChoix.put(ConfigManager.getInstance().getCurrentConfig(),Main.choix);
}
if (e.getKeyCode() == NativeKeyEvent.VC_F10) {
Main.Overlay = !Main.Overlay;
}
if (e.getKeyCode() == NativeKeyEvent.VC_F11) {
Main.enabled = !Main.enabled;
ConfigManager.getInstance().readConfigs();
}
if (e.getKeyCode() == NativeKeyEvent.VC_F12) {
try {
GlobalScreen.unregisterNativeHook();
Main.enabled = false;
Main.shooting = false;
MouseListener.executorService.shutdown();
System.exit(1);
} catch (NativeHookException e1) {
e1.printStackTrace();
}
}
}
public void nativeKeyReleased(NativeKeyEvent e) {
}
} |
j'ai essayé de faire un switch sur la ligne :
if (e.getKeyCode() == NativeKeyEvent.VC_F8) {
mais je n'es sur quoi ecrire
j'ai essaye ca mais sans succes
1 2 3 4 5 6 7 8
| if (e.getKeyCode() == NativeKeyEvent.VC_F8) {
switch (e.getKeyCode()) {
case KeyCode.VC_F5())
break;
case KeyCode.VC_F6())
} |
Merci
Fred
Partager