Results 1 to 3 of 3
  1. #1
    hemanthjava is offline Member
    Join Date
    Dec 2007
    Rep Power

    Default JTable Combo Box Row Selection Problem

    I have a problem with my Table in the project. I have 10 Columns in the Table, the 4th and 10th column are significant to explain this problem.

    In the 10th column I have a combo box and in the 3rd Column I have a TextBox. The values for the Text Box is dependent directly on the values of the corresponding row Combo Box using some logical Lookup as shown in the enclosed if (row != -1) loop of the below function.

    Java Code:
    myComboofColumn9 = new TableCellCombo(detailTable) {
    			public void setSelectedItem(Object item) {
    				int row = detailTable.getSelectedRow();
                                    System.out.println("rowvalue is : "+row);
    				if (row != -1) {
    					TableCellValue value = (TableCellValue) (detailTable
    							.getValueAt(row, 9));
    					String id = value.getId();
    					Vector kQs = ResourceLOVS.getInstance().getKq();
    					Iterator iter = kQs.iterator();
    					LovObject lov;
    					while (iter.hasNext()) {
    						lov = (LovObject) (;
    						if (lov.getId().equals(id)) {
    							detailTable.setValueAt(new TableCellValue(lov
    									.getRule()), row, 3);
    The first time I select a myComboofColumn9 of a particular row my rowvalue is the correct Row. Lets say I selected the 2nd row. So it prints 1 (as row indexes start from 0)

    Now Lets say I just click on the rightmost part of the myComboofColumn9 of row 3 and not select anything (as in by clicking just the arrow and leaving it thereby combo just appears and disappears), setselected item is called this time printing 2 again and not 3. So my logic is run and Row 2 Text Box value is changed and not the 3rd.

    This goes on as I switch, every time selecting one row older. I suspect that because the older combo box is still highlighted. How do I make this work.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power


    Just another cross poster.
    Swing - JTable Combo Box Row Selection Problem


  3. #3
    hemanthjava is offline Member
    Join Date
    Dec 2007
    Rep Power


    Quote Originally Posted by Darryl.Burke View Post
    Just another cross poster.

    Mate. Its a doubt and I need help. I never got any answer from the Sun Java Forums.

Similar Threads

  1. creation of one combo box form another combo box
    By er.tyagigaurav in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 12-09-2008, 03:14 PM
  2. JTABLE problem
    By MaximInf in forum AWT / Swing
    Replies: 4
    Last Post: 06-21-2008, 10:45 AM
  3. JTable problem
    By robbertds1 in forum AWT / Swing
    Replies: 1
    Last Post: 05-20-2008, 06:34 PM
  4. Replies: 2
    Last Post: 05-15-2008, 10:15 AM
  5. Problem with JTable
    By Felissa in forum AWT / Swing
    Replies: 2
    Last Post: 07-04-2007, 09:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts