Setting horizontal alignment of editable JComboBox text
When you're initialising your combo box, reach down into its editor component, cast the component into a JTextField, and 'go to town' with the rich UI settings now available:
JTextField editor =
(JTextField) getEditor().getEditorComponent();
editor.setHorizontalAlignment(JTextField.CENTER);
Written by Lindsay Bradford
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Java
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#