How would I programatically set the state of a JComboBox to be selected and show its content in the drop down?
How would I programatically set the state of a JComboBox to be selected and
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try setting the selected index using:
setSelectedItem(Object item)orsetSelectedIndex(int index)then call on yourJComboBoxinstance:If you’d like it to be visible for a certain period of time only just use a Swing
Timerto callsetPopupVisible(false);after a certain period of time has elapsed.References: