Jinput how to identify buttons and sliders in event queue

I used the code of the Getting Started Tutorial from this forum.

I only have one Problem i don’t get it on how i can identify my buttons and sliders in the event queue.

Here is my sample code trying to use comp.getIdentifier().getName()


package org.maxbit.drone.skyhawkone;

import net.java.games.input.Component;
import net.java.games.input.Controller;
import net.java.games.input.ControllerEnvironment;
import net.java.games.input.Event;
import net.java.games.input.EventQueue;
import net.java.games.input.Version;

public class PilotMain {

	public static void main(String[] args) {
		Controller[] controllers = ControllerEnvironment
				.getDefaultEnvironment().getControllers();
		if (controllers.length == 0) {
			System.out.println("Found no controllers.");
			System.exit(0);
		}

		for (int i = 0; i < controllers.length; i++) {
			System.out.println(i+": "+controllers[i].getName());
		}
		
		int i = 1;
		System.out.println(controllers[i].getName());
		
		Component[] components = controllers[i].getComponents();
		
		while (true) {
			controllers[i].poll();
			EventQueue queue = controllers[i].getEventQueue();

			Event event = new Event();
			while (queue.getNextEvent(event)) {
				Component comp = event.getComponent();
	
				float value = event.getValue();
				switch(comp.getIdentifier().getName()) {
				case "Pinkie":
					if(value == 1.0f)
						System.out.println("Trigger Flares!");
					break;
				case "Trigger":
					if(value == 1.0f)
						System.out.println("Focuse  Camera1");
					break;
				case "Unknown":
					if(value == 1.0f) {
						System.out.println("Trigger Camera1");
					}
					break;
				default:
					System.out.println(comp.getIdentifier().getName());
				}
//				if (comp.isAnalog()) {
//					;
//				} else {
//					if (value == 1.0f) {
//						System.out.println(comp.getName()+": ON");
//					} else {
//						System.out.println(comp.getName()+": OFF");
//					}
//				}
			}

			try {
				Thread.sleep(20);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}

The problem here is that Unknown isn’t unique also pov.
I am using a Saitek X52 Joystick.

Wish you all a nice day hope some one can help.
chee­rio from Austria :wink: