Editable JComboBox

Discussion in 'Java' started by Guest, Feb 16, 2005.

  1. Guest

    Guest Guest

    I have an editable JComboBox with about 10 values in list.
    It is inside JTable like this: (cbMaterials is the JComboBox)

    jTable.getColumnModel().getColumn(0).setCellEditor(new
    DefaultCellEditor(cbMaterials));


    I saw a strange thing that I cannon explain.

    We suppose the current value of cbMaterials is "apple"

    When I click with the mouse to JComboBox and then immediately click to
    another Combonent, JComboBox pass to setValueAt (of MyClassTableModel)
    the previous value ("apple").

    When I click with the mouse to JComboBox and then WITHOUT changes I
    press ENTER, JComboBox pass to setValueAt (of MyClassTableModel) the
    value: "".

    This not happen always but I dont understand why & when happens (!)
    (after a LOT of tests and debugging)

    So, I ask: Why?
    Guest, Feb 16, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KLD
    Replies:
    3
    Views:
    1,181
    Tony Morris
    Feb 15, 2004
  2. Jacques Chaurette

    using editable jcombobox

    Jacques Chaurette, Oct 2, 2005, in forum: Java
    Replies:
    7
    Views:
    5,883
    Ravindra Khyalia
    Sep 6, 2007
  3. Allen

    Editable JComboBox problems

    Allen, Oct 16, 2006, in forum: Java
    Replies:
    0
    Views:
    314
    Allen
    Oct 16, 2006
  4. @CL
    Replies:
    1
    Views:
    475
  5. Ben Phillips

    JComboBox: setting the editable text

    Ben Phillips, Oct 8, 2008, in forum: Java
    Replies:
    8
    Views:
    7,717
    Ben Phillips
    Oct 9, 2008
Loading...

Share This Page