Multiple selection in JComboBox

Hi, Folks!
I want to make my JComboBox to be multiple selected because there is a method called "getSelectedObjects()", but I don't know how to do it.
Can anyone help me figure out how to do this?
You help is much appreciated!
Qun He

Thanks a lot!
Qun
JComboBoxes can't have multiple selections. If you
read the API documentation for
JComboBox.getSelectedObjects() it says "Returns an
array containing the selected item." The only reason
the method is implemented is because JComboBox
implements the ItemSelectable interface.

Similar Messages

  • How to select multiple items in JComboBox

    Is it possible to select multiple items in a JComboBox
    if yes, then how to do?
    If no , then is there any other way to acheieve this ?

    Hi
    ComboBoxModel extends ListModel and not ListSelectionModel, so i think JComboBox does not provide multiple selection. But u can try customizing ur combo box.. may be its possible.. not very sure
    Shailesh

  • Multiple Selection with JCombo Box

    I want to make a multiple - selection JComboBox enables the user to select many items from JComboBox and copy items from one JComboBox to another.How can I do this?

    Hello,
    ComboBoxModel allows only single selection. It's better to use a JList instead because it isnt worthwhile the effort to create another multi-selection model.
    regards,
    Tim

  • Multiple Select in same Query

    I'm building a report based on a single table in APEX. The report requires the following.
    select user, project, count(start date ), project, count(end date) where date between 01-jan-07 01-feb-07
    (simplified to show the idea)
    basicaly a count of projects that started between two dates and the ones that ended between the same two dates relating to the user.
    I have writen the selects to do both parts and they work BUT is it posible to glue them together in a single statement?
    I tried to searching the forum on "multiple selects" but never realy got anything close.
    Is it possible to do this type of select? If so does it have a special name (so I can try a search on that name)
    Thanks
    Bjorn

    First of all, '11-MAY-06' and '19-MAY-06' are not dates, they are strings. This has some important disadvantages:
    1) Oracle has to implicitly convert them to a date, when they are being compared to a date column
    2) Your application will be NLS (National Language Support) dependent, so they might break when you change a setting
    3) When compared to a varchar2 or other string column, the comparison will give incorrect results. For example: 12-MAY-06 will be between 06-JAN-06 and 18-JAN-06
    Bottom line: convert those dates to real dates using the to_date function, or the date 'yyyy-mm-dd' variant.
    Back to your question, apparently you don't want to count the number of occurences of CON_ACTUAL_START and CON_SIGN_OFF, but you only want to count them when this date is between the two boundary values. So use the following:
    select mli_clo
         , count(case when con_actual_start between date '2006-05-11' and date '2006-05-19' then 1 end)
         , count(case when con_sign_off between date '2006-05-11' and date '2006-05-19' then 1 end)
    ...Regards,
    Rob.

  • How to get multiple selections from jsp page in my servlet

    Hello Everyone,
    I've a list that allows users to make multiple selections.
    <select name=location multiple="multiple">
        <option>
             All
        </option>
        <option>
             Hyd
        </option>
        <option>
             Dub
        </option>
        <option>
             Mtv
        </option>
      </select>I want to get the selections made by user in jsp page from my servlet, selections can be multiple too.
    ArrayList locList = new ArrayList();
    locList = request.getParameter("location");when I do so, I get compilation error as the request returns string type. How do I then get multiple selections made by the user.
    Please let me know.

    For those kind of basic questions it would help a lot if you just gently consult the javadocs and tutorials.
    HttpServletRequest API: [http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpServletRequest.html]
    Java EE tutorial part II: [http://java.sun.com/javaee/5/docs/tutorial/doc/]
    Coreservlet tutorials: [http://courses.coreservlets.com/Course-Materials/]

  • Get all the values from a multiple select in a multipart form

    Hi there!
    I am using a form with enctype="multipart/form-data" in order to upload files from the form.
    I have read this page: http://commons.apache.org/fileupload/using.html and everything works well for my form.
    The only problem is that I can't get all the values from a "multiple select" html object. I get only one value.
    Using servlets I have used this method:
    public java.lang.String[] getParameterValues(java.lang.String name) But now I have enctype="multipart/form-data" in my form and I can't use this way...
    Is there a way to get all the values of a multi-valued parameter?
    Thanks a lot!
    Stefano

    Hi
    I have got solution for this problem so, I am listing here logic
    assume tag name of html
    <select name="moption" multiple="multiple">
    iterate it in as
    String moption="";
    boolean cnt=true;
    while(itr.hasNext())
    FileItem fi=(FileItem)itr.next();
    if(fi.isFormField())
    if(fi.getFieldName().equals("moption"))
    if(cnt==true)
    moption=fi.getString();
    cnt=false;
    else
    moption=moption+","+fi.getString();
    If wants more help then mail me your problem
    at [email protected]
    Thanks!
    Anand Shankar
    Edited by: AnandShankar on 6 Nov, 2009 12:54 PM

  • All values from multiple select LOV

    Hi.
    Ik have a customize screen for a chart where a can select days. That works. But i want the standard value to be 'all days', so the user does not have to click all seven days. When i have combobox i use in the where clause:
    "and (fieldname = :variable or :variable = '%')"
    For a mutiple select i use IN:
    "and fieldname IN :variable"
    That would make:
    "and (fieldname IN :variable or :variable = '%')"
    This does not work for a multiple select LOV.
    Anu ID how i can make it work???

    Try the following:
    (:variable = '%' or
    :variable <> '%' and fieldname in :variable)

  • Struts: getting multiple selected values from a select element

    Hi Friends,
    I am a total newbie with struts,I have manage to run a simple login script,
    Now I was wonderingif there is a select box and user has the ability to select multiple values from it how do I get those values in the *Form class
    my select tag looks like this
    <html:select property="listboxValue" mulitple="mulitple">
    ...options--
    </html:select>
    in the ****Form extends ActionForm{....I have setter and getters for getting the value  from select box as below
    public void setListboxValue(String value){
    this.listboxValue = value;
    and the getter is
    public String getListboxValue(){
    return this.listboxValue ;
    please never mind the missing brackets and such.
    What I was hoping to get to work was something like this
    public void setListboxValue(String[] value){
    this.listboxValue = value;
    but that does not work...If I have the an array being passed,it seems like this method is no even envoked
    Please guide me
    Thanks

    I'm having trouble to get in the ActionForm all the selected values in my multiple select. I select all the values by setting to true the selected attribute of all the options in a javascript function. In the ActionForm the variable is String[]. I'm not getting any ClassCastException, but I only receive the first value selected (String array with just one element).
    Select definition:
    <html:select name="detalleConsultaForm" property="destinatarios" multiple="true" size="8" >
    Javascript function:
    function validalistarelacion(campo)
    {   if (campo.length < 1)
    alert("Campo sin valores");
    campo.select();
    return false;
    for (var i = 0; i < campo.length; i++)
    campo.options.selected = true;
    return true;
    ActionForm:
    String[] destinatarios;
    public String[] getDestinatarios() {
    return destinatarios;
    public void setDestinatarios(String[] destinatarios) {
    this.destinatarios = destinatarios;
    What I get:
    2006-03-30 12:54:19,899 [ExecuteThread: '10' for queue: 'weblogic.kernel.Default'] DEBUG BeanUtils - setProperty(es.tme.apl.mante
    nimientosPlanificados.form.DetalleConsultaForm@59def5, destinatarios, [2320])
    2006-03-30 12:54:19,899 [ExecuteThread: '10' for queue: 'weblogic.kernel.Default'] DEBUG ConvertUtils - Convert String[1] to class
    'java.lang.String[]'
    Thnx

  • RE: Getting multiple values from more than one multiple select popup window

    I have a button on a JSP of mine that when clicked creates a popup window (right now it is called popup.html) with a multiple select menu.
    My question is how do I get all the values selected from the menu into my JSP (sample.jsp) so that I can set each of the values for my bean.
    The other problem is that I have more than one select multiple menu.
    Please help if you can. Any advice or suggestions here would be greatly appreciated!
    Thank you!

    I realize that I can use request.getParameterValues to get the values selected from my html because I am passing them to the hidden inputs I have and then using the request.getParameterValues to get each of the values.
    MY PROBLEM IS WHAT IF I HAVE 4 MULTIPLE SELECTS??? How can I use the same html popup menu to get the values from the 4 different multiple selects????
    I look forward to your response.
    This code is from my JSP:
    <INPUT TYPE="TEXT" NAME="Field1" SIZE="15">
    <INPUT TYPE="hidden" name="F1Rad1">
    <INPUT TYPE="hidden" name="Permission">
    <input type=button name=choice onClick="window.open('optionPicker.html','popuppage','width=250,height=100');" value="Options"></TD>
    Here is my optionPicker.html code for the pop up menu:
    <html>
    <head>
    <script language="JavaScript">
    function sendValue(s)
    var boxSize= s.options[0].value;
    var restrict     = s.options[1].value;
    window.opener.document.addNewForm.F1Rad1.value = boxSize;
    window.opener.document.addNewForm.Permission.value = restrict;
    window.close();
    </script>
    </head>
    <body>
    <center>
    <form name=selectform>
    <select multiple name=selectmenu size="2">
    <option value="large">Large Text Input Area
    <option value="restrict">Restricted Access
    </select>
    <p></p>
    <input type=button value="Select Option(s) For Field" onClick="sendValue(this.form.selectmenu);">
    </form>
    </center>
    </body>
    </html>

  • Problem getting all parameters from multiple select

    I have a multiple select option box that's properly displaying all the values. I'm using getParameterValues() to retrieve all of the selections but it returns the string[] with only the first selection made.
    JSP:
    <select name="selectList" multiple="true" size="2">
    <option value="value1"> Select 1
    </option>
    <option value="value2"> Select 2
    </option>
    </select>Servlet:
    String[] subset = request.getParameterValues("selectList");I think all my code above is fine. Anything else that would cause getParameterValues() to only return the top selected item?
    Thanks!

    The HTML cod is written in incorrect syntax, the browser nor the Server will understand.
    If you write it in XHTML then the proper syntax is:
    <select name="selectList" multiple="multiple" >
    If you write it in plain old HTML then the proper syntax is:
    <select name="selectList" MULTIPLE >
    (I'm not sure about this HTML syntax, but definitely the XHTML syntax shown above is correct)

  • How to perform multiple selection from dropdown list

    Hi,
           I have developed one application in which i have taken one dropdownbyindex and entered some values in it, now i need to have multiple selection of entries, can any one please suggest how to do these
    Regards,
    Prasanna

    A drop-down list is by definition a 1-from-many selector.
    Armin

  • How to get multiple selected fields in list

    Hello all,
    I am trying to get multiple selected value from a list but i dont know how to get multiple selected fields from a list though AS3.
    Actually i want to pass the selected fields to php, so for that i need to get the selections and send to php.
    Thankx..

    i want to put the selected fields of list in an array through AS3....
    actually......i figured it out how to do that...........
    Its simple......use
    list.selectedItems[index]
    and to get the number of items selected......
    list.selectedItems.length
    simple.....

  • Report Using Multiple Select

    hi
    I want to display a report with Multiple Select List like
    http://apex.oracle.com/pls/apex/f?p=267:16:
    Thanks
    Edited by: 805629 on Jan 6, 2011 9:28 PM

    Did you ever get this answered???
    This is exactly what I am looking for!

  • Get Selections From ALV on Multiple Selection Mode

    Hi,
    How can i get values of selected rows from ALV that has selection '0..n' (multiple selection) ?
    Can somebody help me pls?
    Thanks.

    Hi Nurullah,
    Steps to make multiple rows selectable in ALV:
    1) Create the selection property of the node that you are binding to the DATA node as o..n
    2) Un-check the, "Initialization Lead Selection" checkbox for the node which you are using to bind to the DATA node
    3) In the WDDOINIT method specify the ALV's selection mode as MULTI_NO_LEAD. It is important that you set the selection mode to MULTI_NO_LEAD or else in the end you would be capturing 1 row lesser than the total number of rows the user has selected. This is because 1 of the rows would have the LeadSelection property & our logic wouldnt be reading the data for that row. Check the example code fragment as shown below:
    DATA lo_value TYPE REF TO cl_salv_wd_config_table.
      lo_value = lo_interfacecontroller->get_model( ).
      CALL METHOD lo_value->if_salv_wd_table_settings~set_selection_mode
        EXPORTING
          value = cl_wd_table=>e_selection_mode-MULTI_NO_LEAD.
    Steps to get the multiple rows selected by the user
    In order to get the multiple rows which were selected by the user you will just have to call the get_selected_elements method of if_wd_context_node. So as you can see its no different from how you would get the multiple rows selected by the user in a table ui element. First get the reference of the node which you have used to bind to the ALV & then call this method on it. Check the example code fragment below:
    METHOD get_selected_rows .
      DATA: temp TYPE string.
      DATA: lr_node TYPE REF TO if_wd_context_node,
                wa_temp  TYPE REF TO if_wd_context_element,
                ls_node1 TYPE wd_this->element_node_flighttab,
                lt_node1 TYPE wd_this->elements_node_flighttab.
      lr_node = wd_context->get_child_node( name = 'NODE_FLIGHTTAB' ).
    " This would now contain the references of all the selected rows
      lt_temp = lr_node->get_selected_elements( ).
        LOOP AT lt_temp INTO wa_temp.
    " Use the references to get the exact row data
          CALL METHOD wa_temp->get_static_attributes
            IMPORTING
              static_attributes = ls_node1.
          APPEND ls_node1 TO lt_node1.
          CLEAR ls_node1.
        ENDLOOP.
    ENDMETHOD.
    Hope this helps resolve your problem.
    Regards,
    Uday

  • Passing multiple select value from BI publisher to PL/SQL functions

    Hi - I have designed a report which pass parameters (Multi select) into a function to get the output result. When a single parameter value is passed to the function, report is being displayed. When multi select value is passed to the function it is returning the error `wrong number or types of arguments in call to 'F_PROCESS_WAVE_DATA'. When i checked the parameters passed to the function, i can see each multi select value is treated as different value and is assigned to different parameter in the function.
    Any help on passing the multi select parameter into function will be helpful.
    Regards,
    Vikram.

    All - Issue was resolved. I followed the following steps to resolve the issue
    1. Create a PL/SQL table type variable as VARCHAR2 in the database - Say as Larray
    2. Create PL/SQL type record and table for the record in database. Lrec, Ltable
    3. In BI report pass multiple select LOV variable as Larray(variable).
    4. In DB function, Parameter should be defined as LARRAY.
    5. Return PL/SQL table type Ltable from the function.
    Regards,
    Vikram.

Maybe you are looking for

  • Windows 8 iTunes not allowing "sync" with iPod

    New laptop with Windows 8. Downloaded iTunes software. Manage to upload songs from iPod. But after purchasing new music, could not sync back to iPod. The iPod icon is there but the option to "sync" under Devices is grayed out. Any ideas?  Thanks, Yvo

  • Footer not staying put

    I am not an expert at CSS, and I am sure that I have made a mess of things. My footer is as big as a browser window, but not as big as the webpage. I hope that makes sense? If I have a small little window open and scroll to the right to see the entir

  • Phone restarts when Camera is recording in flyout and back button is pressed.

    I am developing an app in which I have some tabs which are shown on every page. In one of screens I need to click a picture and I can't hide the tabs. So I created a flyout and put a captureElement and buttons to capture image in it. But when the cam

  • Safari 5.1.1 missing plug-in html5

    I just did the Lion OS 10.7.2 with Safari 5.1.1 When I attempt to watch the new video about iCloud on the Apple website, the video viewing screen is blank with "Missing Plug-In" or just 'HTML5" What plug-in could be missing? Think I figured this out.

  • Unable to read world of warcraft!!

    My MacBook is unable to read World of Warcraft cds! and many others!!! The drive just makes a lt of noise and then expels the cd.