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

  • Home
  • SEARCH
  • 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 7962021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:12:55+00:00 2026-06-04T05:12:55+00:00

My problem is a bit tricky. I am using an Editable JComboBox . It

  • 0

My problem is a bit tricky. I am using an Editable JComboBox. It may contain case sensitive items. For example, it may have Item1 and item1. So, these two items should be treated as different in my case.

But the problem is, these two items is treated as same. No matter which Items I have selected, it always select the first one (Item1). I’ve searched in Google, but didn’t find any solution. That’s why, I am here.

Code:

//loading of Items
jdcbmItemType = new javax.swing.DefaultComboBoxModel(ItemTypeHandler.getItemTypeComboData(MainFrame.companyId));

private void jcbItemTypeMouseReleased(MouseEvent evt)
{
    if (jcbItemType.getSelectedIndex() != -1)
    {
        loadItemTypeDetails(((ItemObject) jcbItemType.getSelectedItem()).getId());
    }
    else
    {
        resetFields();
    }
}

public static Vector<ItemObject> getItemTypeComboDataV(BigInteger companyId, BigInteger categoryId, boolean addFirstElement, TriState deleted) throws ExceptionWrapper, EJBException
{
    try
    {            
        return (Vector<ItemObject>)lookupItemTypeFacade().getItemTypeComboData(companyId, categoryId, addFirstElement, deleted);
    } catch (ExceptionWrapper exceptionWrapper)
    {
        throw exceptionWrapper;
    } catch (EJBException ejbEx)
    {
        throw ejbEx;
    } catch (Exception ex)
    {
        throw new ExceptionWrapper(ex.getMessage());
    }
}

ItemObject is a customClass where one field is BigInteger and another is String.

getItemTypeComboData is functioning properly. So, you can assume to get a list of ItemObject from here and it will nicely convert it to Vector<ItemObject>

jcbItemType.getSelectedIndex() always return the same index for Item1 and item1. But it returns different index for item2.

I know, it would be better if I can use itemStateChanged event. But in my case, I can’t use it. But my question is, MouseReleased and FocusLost works fine for different name string but not same string with different case. I am really stumbled.

Another way to ask the question:

Does MouseReleased or FocusLost event check for case-sensitive items?

How to resolve this problem?

Thanks.

  • 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-06-04T05:12:57+00:00Added an answer on June 4, 2026 at 5:12 am

    Here is my SSCCE and this works fine , If this is not what youre looking for, then post your SSCCE for better sooner help!


    import javax.swing.*;
    import java.awt.event.*;
    
    public class ComboBoxTest {
    
        JComboBox combo;
        JTextField txt;
    
        public static void main(String[] args) {
            new ComboBoxTest();
        }
    
        public ComboBoxTest() {
            String items[] = {"Item1", "item1"};
            JFrame frame = new JFrame("JComboBox Case-sensitivity Test");
            JPanel panel = new JPanel();
            combo = new JComboBox(items);
            combo.setEditable(true);
    
            txt = new JTextField(10);
            panel.add(combo);
            panel.add(txt);
            frame.add(panel);
            combo.addItemListener(new ItemListener() {
    
                @Override
                public void itemStateChanged(ItemEvent ie) {
                    String str = (String) combo.getSelectedItem();
                    txt.setText(str);
                }
            });
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(400, 100);
            frame.setVisible(true);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have run into a bit of a tricky problem in some C++ code,
My problem is a bit more complex than using the following simple JavaScript code:
My problem is a bit hairy, and I may be asking the wrong questions,
My problem is a bit complicated: I am writing in c#, asp.net and using
I have a bit of problem when trying to validate my page as HTML5.
I have a feeling my problem is a bit strange, but here goes... I
So this might be a bit tricky to demonstrate, since the problem only appears
I'm having a bit problem with reading argument value in haskell: I'm having options
This problem is a bit strange. Why is showed Is not null, if the
my problem is a bit similar to this : I want to retrieve rows

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.