35

I'd like to create a JComboBox that handles the selection of any Enum given to it. For that I need a method to retrieve all the available values of the Enum passed to the JComboBox. As I don't know the specific Enum I can't call EnumType.values(). I could think of some complicated solutions where supported Enums would have to implement some interface I define, but I guess I am missing a simpler, more general solution. What is the way I should go?

Brad Mace
  • 27,194
  • 17
  • 102
  • 148
Se Norm
  • 1,715
  • 5
  • 23
  • 40

1 Answers1

50

Class.getEnumConstants()

irreputable
  • 44,725
  • 9
  • 65
  • 93