Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

HOw to make Jcombobox mandatory?  RSS feed

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am using JCOmboBox.I just want to indicate to the user that he should select anyone value.so i need to make Jcombobox as madatory field.is there anyway to do it?please give me suggesstions.

Thanks,
Raji
 
Rancher
Posts: 2940
19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe you can use the Combo Box Prompt.

This won't force the user to select anything but will give them a visual clue to select something.

Then when the user clicks on the "Save" button, you get the selected index of the combo box. If the value is 0, then you display a JOptionPane requesting the user to make a selection.

This approach can be used for any component. That is you can also check text fields to make sure text has been entered in required text fields.
 
Raji Raj
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply...but my requirement is to display * in combobox to indicate user that its a Mandatory field.

I will do all those validations while clicking save button.


is there any way to do display * in combobox?

Thanks.
 
Bartender
Posts: 2856
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can display the * in the label field, why have it in the combobox itself?
 
Amit Ghorpade
Bartender
Posts: 2856
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check your private messages.
 
Raji Raj
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in combox whether we will be able to do it or not?
Thanks i changed last name.
 
Sheriff
Posts: 21453
96
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raji Raj, please follow Amit's instructions:

Amit Ghorpade wrote:Please check your private messages.

 
Rob Camick
Rancher
Posts: 2940
19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For functionality like this you would generally add a JLabel beside the JComboBox with "*" as the text.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!