Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 575427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:56:22+00:00 2026-05-13T13:56:22+00:00

I am .net C# programmer that wants to learn Java. I can connect DB,

  • 0

I am .net C# programmer that wants to learn Java. I can connect DB, getting and writing data with JDBC. But how can I fill JComboBox and set its DisplayMember “PersonelName” and ValueMember “PersonelID”?

In .NET there is related properties like DisplayMember, DataSource, ValueMember, I can show personel’s name with displaymember and when I am writing to data I can learn personnel’s id from valuemember property. But in Java there is no properties like this. How can I get PersonelID and show Personel Name in JCombobox in Java?

Would someone give me an example?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:56:23+00:00Added an answer on May 13, 2026 at 1:56 pm

    JComboBox constructor can take a ComboBoxModel as argument. DefaultComboBoxModel is a concrete implementation of the ComboBoxModel interface.

    So, if you have a Personel class:

    class Personel{
        String personelName;
        int personelId;
        //getters, setters
    
        //This will be your display member
        @Override
        public String toString(){
            return this.personelName;
        }
    }
    

    And supposing you obtained all personel via JDBC and have it stored in a new Vector, you can do:

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

    At runtime, you can getModel and setModel to access the JComboBox model. The display member will be Personel’s toString() method. The value member will be the actual object stored in the DefaultComboBoxModel vector, in this case a Personel instance.

    I suggest you take a look at the API documentation for ComboBoxModel and DefaultComboBoxModel.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 530k
  • Answers 530k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I don't think there's anything in the IDE that will… May 16, 2026 at 11:42 pm
  • Editorial Team
    Editorial Team added an answer Float them both left with a set width on each… May 16, 2026 at 11:42 pm
  • Editorial Team
    Editorial Team added an answer No, it's not possible to modify the URL of the… May 16, 2026 at 11:42 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am a Java programmer looking to learn .NET, particularly C# and F#, to
I want to learn C# and the .Net Framework as well. I have no
I have pretty big background of .net, and I've decided that i want to
I want to learn Java and Linux. Java itself (as a language) is not
As a programmer my first instinct is to start coding, but then again chapter
I want to make a website, but all I know is basic HTML and
I'm a long-time C++ programmer developing on Windows, and have been using Visual Studio
I suspect that I will soon exhaust the speed improving possibilities of threading on
I want to give access to certain data, in various databases on a single
I have a problem with different sound libraries... I use Visual Studio.NET and C#

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.