Skip to content

Instantly share code, notes, and snippets.

@bekwam
Created October 16, 2015 11:53
Show Gist options
  • Save bekwam/4386133492546a1f945c to your computer and use it in GitHub Desktop.
Save bekwam/4386133492546a1f945c to your computer and use it in GitHub Desktop.
JavaFX StringConverter for an Enum
cbType.setConverter( new StringConverter<SigningArgumentsType>() { // enum SigningArgumentsType; defined all caps
@Override
public String toString(SigningArgumentsType type) {
return StringUtils.capitalize(StringUtils.lowerCase(String.valueOf(type)));
}
@Override
public SigningArgumentsType fromString(String type) {
return Enum.valueOf(SigningArgumentsType.class, StringUtils.upperCase(type));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment