I am saving items to JComboBox from a textfield(input) when a button is clicked. The user may give the input starting with lowercase but I want to change the first letter of the input to uppercase. How can I achieve this?
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.
Take the input. Create a new string consisting of the combination of two parts. The first part is the substring only consisting of the first character, which you then call toUpperCase() on, and the second part is the substring starting with the second character.
This should accomplish what you want.