java - JCombobox editable enabled -


What is the difference between setEditable () and setEnabled () in jCombobox? Can Cambodia be editable, but not able and on the other side? What situation would you use?

Can you imagine a situation in which you setEnabled (false) with setEnabled (false)?

setEditable (boolean) determines if JComboBox < / Code> allows text entry in addition to choosing a value through the bridge, down.

setEnabled (boolean) determines if JComboBox is able to interact with at all. If it is not enabled, then it is displayed as a grade out.

A JComboBox can be a mixture of these properties -

  • SetEditable (true) + In addition to pulling down values ​​setEnabled (true) = JComboBox allows text input and users can interact with it.
  • setEditable (false) + setEnabled (true) = JComboBox Only values ​​can be selected from the pull down and Users can interact with it.
  • setEditable (true) + set-annexed (false) = JComboBox But the user can not interact with it.
  • setEditable (false) + setEnabled (false) = JComboBox only allows the value to select Drag down and the user can not interact with it.

A situation where you have JComboBox with setEnabled (false) and setEditable (true) Where you want JComboBox , which allows text input, but that form is in a position where the value of JComboBox is not applicable. You usually have an action that will call setEnabled (true) at JComboBox , once this will take effect.

For example, if you have something like a student housing form, then there may be a question on the form such as 'Do you need a parking space?' With a JCheckbox For a car brand there is a JComboBox and a JTextFied for license plate number You may have pre-populated with JComboBox normal car brands - Ford, Chevy, Toyota, Honda, etc. - but decided that he is Lamborghini (and the student is staying in the accommodation - yes, right ...). The price for the car brand and license plate number is not necessary unless the user chooses JCheckBox that they require parking space. You will add a listener in the JCheckBox Calling on setEnabled (true) JComboBox and JTextField was selected, and set-ended (false) when it was not.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -