Java tutorial
//package com.java2s; import javax.swing.JComboBox; public class Main { public static Object getSelectedValue(JComboBox cb, Object[] val) { int selIndex = cb.getSelectedIndex(); if (selIndex == -1) return null; return val[selIndex]; } }