c# - Where can I find features in a jComboBox that are found in the .NET ComboBox? -


I am a pure C programmer today who wants to learn Java these days. I can connect DD, I am getting data with JDBC. How can I fill out JComboBox and set my DisplayMember "PersonelName" and ValueMember "PersonelID" .NET has related properties such as displaymember, datacours, welcome, I can show the name of the person with the displaymember and when I write data, I can learn the Intel ID from Valuemberg property. But there is no such kind of quality in Java. How can I get PersonelID in JCombobox in Java and show personal names? Can anyone give an example of Thanx?

JComboBox constructor can take combo box modals as a logic. DefaultComboBoxModel combobox is a solid implementation of the embedded interface.

Therefore, if you have a personal category:

  Category Personalel {String personelName; Int personelId; // getters, setters // this will be your display member @ override public string toString () {return to this.personelName; }}  

And understand that you have received all the person through JDBC and have stored it in a new vector, you can do this:

  DefaultComboBoxModel comboModel = new DefaultComboBoxModel (Personal); JComboBox myCombo = new JComboBox (comboModel);  

At runtime, you can access the model and set model to the JComboBox model. The display member will be Personel's toString () method. Original Member Default Cambodobox will be the actual object stored in the Module vector, in this case a personal example.

I recommend that you take a look at the API documentation and


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -