Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: SWT: How to return updated combo item after selectionlistener and save it to disk

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default SWT: How to return updated combo item after selectionlistener and save it to disk

    Hello my SWT friends

    I am confused with selectionlistener in Eclipse SWT.
    I want to save the updated combo items after it has been selected.
    But I cannot return value inside widgetSelected since it must be void.
    Then where to set AquiferStr = the updated items after selectionlistener is threw such as combo.getItem(combo.getSelectionIndex())


    //return changes items in combo2
    int rowNum=2;
    String[][]AquiferStr=new String[rowNum][rowNum];
    for (int i = 0; i < rowNum; i++) {
    //ERROR IN SAVE. Without widgetSelected CANNOT RETURN combo2.getItem(combo.getSelectionIndex())
    AquiferStr[i][0] = combo2.getItem(i);
    AquiferStr[i][1] = (String)combo2.getText();
    //AquiferStr[i][1] = (String) combo2.getItem(combo.getSelectionIndex());
    System.out.println("save int getItem"+combo2.getItem(i));
    }
    return AquiferStr;
    }

    I made my code based on this original snippet
    Sample Combo : ComboSWT JFace EclipseJava

    The snapshot looks like this
    code-snapshot.JPG
    saveComboSelected.JPG
    My code is also attached.

    Many thanks!

    Helen
    Attached Files Attached Files


Similar Threads

  1. How to save an updated JList to a text file after the GUI closes?
    By arob317 in forum What's Wrong With My Code?
    Replies: 8
    Last Post: February 22nd, 2013, 03:56 PM
  2. method to return the position of the smallest item in an array
    By izzahmed in forum Java Theory & Questions
    Replies: 5
    Last Post: November 4th, 2011, 04:18 AM

Tags for this Thread