1

Possible Duplicate:
Values of JComboBox

I have a code like this:

import net.java.games.input.Controller;
import net.java.games.input.Controller.Type;
import net.java.games.input.ControllerEnvironment;

public class ControllerFinder
{
    public static void main(String[] args)
    {
        try
        {
            ControllerEnvironment ce = ControllerEnvironment.getDefaultEnvironment();
            Controller[] cs = ce.getControllers();
            for (int i = 0; i < cs.length; i++)
            {
                String name = cs[i].getName();
                Type type = cs[i].getType();
            }
        }
        catch (Exception exc)
        {
            System.err.println("No controller found");
        }
    }
}

How could I make a program that has a JComboBox and creates a new option in the

String[] {"...", "..."};

array for the JComboBox for each device found? Thanks! P.S. I am using JInput.

Community
  • 1
  • 1
  • I have reviewed that question, mine seems quite different. –  Dec 13 '12 at 00:07
  • Vincent Ramdhanie's answer works basically as-is for your problem, just use Controller instead of customer. – durron597 Dec 13 '12 at 00:58
  • @user1832583 Is your requirement to populate the array at runtime??and also make its length dynamic ie; a dynamic array that can grow and shrink ?? – KDjava Dec 13 '12 at 11:04

0 Answers0