ButtonGroup multiple selection not possible.

Hey Guys,
I have been trying to add a Buttongroup where i can select more than 1 JCheckBox. does anyone know how i can modify the code below so that i can select more than just one JCheckBox in the group?
ButtonGroup GroupPreferences = new ButtonGroup();
GroupPreferences.add(PreQ1);
GroupPreferences.add(PreQ2);
GroupPreferences.add(PreQ3);
GroupPreferences.add(PreQ4);
GroupPreferences.add(PreQ5);
GroupPreferences.add(PreQ6);
GroupPreferences.add(PreQ7);
GroupPreferences.add(PreQ8);
GroupPreferences.add(PreQ9);
if (PreQ1.isSelected()){
...etc.
Thank you
max

I have managed to get it to work using your method just modified it a bit.
checkBoxes = new JCheckBox[10];
        for (int i = 0; i < checkBoxes.length; i++)
            checkBoxes[i] = new JCheckBox("Preference");
            Questionnaire.add(checkBoxes);
size = checkBoxes[i].getPreferredSize();
if (i == 0){checkBoxes[i].setBounds(725, 70, 100, 15);}
if (i == 1){checkBoxes[i].setBounds(725, 110, 100, 15);}
if (i == 2){checkBoxes[i].setBounds(725, 150, 100, 15);}
if (i == 3){checkBoxes[i].setBounds(725, 190, 100, 15);}
if (i == 4){checkBoxes[i].setBounds(725, 230, 100, 15);}
if (i == 5){checkBoxes[i].setBounds(725, 270, 100, 15);}
if (i == 6){checkBoxes[i].setBounds(725, 310, 100, 15);}
if (i == 7){checkBoxes[i].setBounds(725, 350, 100, 15);}
if (i == 8){checkBoxes[i].setBounds(725, 390, 100, 15);}
checkBoxes[i].setSelected(false);
checkBoxes[i].addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED)
numSelected++;
if (numSelected == MAX_SELECTIONS_ALLOWED)
for (int i = 0; i < checkBoxes.length; i++)
checkBoxes[i].setEnabled(checkBoxes[i].isSelected());
else
numSelected--;
for (int i = 0; i < checkBoxes.length; i++)
checkBoxes[i].setEnabled(true);

Similar Messages

  • JFileChooser Multiple selection not working on Mac using apple, command key

    I am using Java 1.4 webstart on Mac machine.
    The code is :
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setFileSelectionMode(2);
    fileChooser.setMultiSelectionEnabled(true);
    Once the File dialog opens I have problems in selecting random multiple files. Apple key or command key is used for random selection on Mac. When using either of these keys multiple selection is not possible. Whereas I am able to select files using the shift key by which row selection is possible.
    If this is not a bug and some code changes are to be done it would be fine if somebody can help me out in this.
    If this is a bug in Java 1.4 and is this fixed in Java 1.5?

    All EIDE / ATA (Parallel) devices (drives, opticals) allowed for two such drives or devices on one bus. The old style was "master" and "Slave" but CS is a "smart" approach, however, the master or only device must be on the end position. Also, the end connector will be black, the middle (slave) is gray.
    Eject sends signal to master
    To eject the "slave" device you use a modifier key.

  • JFileChooser Multiple selection not working on Mac using apple key

    I am using Java 1.4 webstart on Mac machine.
    The code is :
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setFileSelectionMode(2);
    fileChooser.setMultiSelectionEnabled(true);
    Once the File dialog opens I have problems in selecting random multiple files. Apple key is used for random selection on Mac. When using the apple key multiple selection is not possible. Whereas I am able to select files using the command key by which row selection is possible.
    If this is not a bug and some code changes are to be done it would be fine if somebody can help me out in this.
    If this is a bug in Java 1.4 and is this fixed in Java 1.5?

    All EIDE / ATA (Parallel) devices (drives, opticals) allowed for two such drives or devices on one bus. The old style was "master" and "Slave" but CS is a "smart" approach, however, the master or only device must be on the end position. Also, the end connector will be black, the middle (slave) is gray.
    Eject sends signal to master
    To eject the "slave" device you use a modifier key.

  • VT04 - multiple selection variants possible?

    Hello,
    When we create shipments "manually" via VT01n, we have 2 different selection variants to add deliveries onto the shipments:
    - one variant which selects all deliveries without route schedule also those for which the goods issue date is in the future
    - one variant which selects all deliveries with route schedule and where the goods issue date of delivery is set on "Today" or in the past
    There is no way to "combine" these 2 variants into 1 variant, because we would miss some deliveries that way
    We want to use transaction VT04/VT07 to automatically create these shipments.
    But in the selection screen of VT04, you can only set one selection variant (field is not "multiple selectable) to add deliveries and there is no option to set the 2 selection variants we have created above
    Are there any other options?
    Thanks for your help.
    Kr,
    Alexander
    Edited by: Alexander Vilain on Jan 21, 2011 12:11 PM

    Hi Alexander,
    They way I interpret your question is, when you use VT01N you have the option of grouping deliveries into one shipment i.e . multiple deliveries into one shipment.
    Based on that understanding :
    Did you try to use transportation chain option in VT04 to group deliveries.
    Click on the "Create Transportation Chain "
    And use " Multiple grouping criteria and data options " as required by you.
    You can have same shipping type for example truck and group the deliveries as main, preliminary legs etc.
    There needs to lot of testing to make sure deliveries are picking up correct and later VT07 to schedule batch job
    Let me know if this helps.
    Thanks
    Naga Yarramsetty

  • Multipl selection not working in Select Options, NO-EXTENSION not specified

    Hi,
    My code for the selection screen is as given below:
    data: v_bukrs type ekko-bukrs.
    select-options: s_one    for v_bukrs default '1234',
                    s_two    for ekko-lifnr,
                    s_three  for ekko-ekgrp.
    select-options: s_last   for ekko-llief no intervals.
    However, when I execute my program, all for select-options show Multiple selection icon. When I click on the icon for multiple selection, it is not processed.
    I tried to debug and find out but to no avail. Also I have searched extensively over SDN, but have not found any solution for my problem.
    Kindly help with relevant solution.
    Regards,
    Smruthi

    Hi Anurag and Vinod,
    Thanks for your replies.
    The FM - SELECT_OPTIONS_RESTRICT has not been used in my program.
    The issue is however, resolved. There was an error in the selection screen events, that was triggering the disabling.
    Regards,
    Smruthi

  • Multiple Selection not working on List Box Properties/Option Screen

    When I select multiple selection on the List Box Properties/Options tab, I get no difference from the single selection default. It still highlights only the last of the multiple entries (like a single selection) and displays only the last entry. Is there something else I need to do?
    Thanks for your help.

    To select multiple items, you need to hold down the Ctrl key when clicking additional items.

  • Multiple Selection not Grouped into a Single Get Info Window

    It used to be that when I selected a group of files and choose "Get Info", the file information is shown in a single windoid as a multiple selection. This allows you to, for example, lock all the files at once. Now when I select multiple files and choose "Get Info" I always get a separate windoid for each one popping up all over my screen.
    Why? And how do I switch it back?
    Thanks in advance!

    If you are checking on info for 10 or less files then it will open individual info windows. 11 or more will open a single info window showing the combined info for those files. But there are ways to get the one window for less then files which has been said already.

  • Data list multiple selection not working?

    I set up a data list and checked the 'allow multiple selection' option in the component properties. However, the list still only allowed one selection at a time (clicking on a different item would deselect the other one). Am I missing something or is this just a bug? I'm using Beta 2. In general, I'm really enjoying playing with it and I'm looking forward to the full version.
    Thanks!
    Alicia

    Oh, of course. Thanks. I guess I'm really trying to use the data list in a non-traditional way. I want a series of items that can individually (and independently) be toggled on and off. I actually tried to do this by making a data list with a toggle button as the repeating item. It generally worked, but I got some weird behavior with items outside the clipping area.

  • Return Order Creation with Multiple Lines not possible - EHP3

    Hi Experts,
    We are facing an issue while creating Return Orders with external reference billing document post upgrade from CRM 7.0 to EHP3.
    While we select multiple line items from the external reference billing document and Create a return order(BT120H_CPL/NewComplEF ), the very first line item gets repeated instead of all the line items getting copied to the subsequent view(BT120H_CPL/ItemList ).
    Please help.
    Thanks,
    Rohit

    I hope you have tried.If not can you  please try with  below qualifier
    '015' Billing Document Number of Invoicing Party
    Provide the billing document EEDK02-BELNR.
    Also give qualifier at item level
    E1EDP02 : use Qualifier =15
    Provide the Billing document number at E1EDP02_BELNR and item at ZEILE.
    I am not sure what is error you are getting when you are referencing billing document.If something STD Idoc  is not working as you expected use your custom logic to bring the data when you are posting the Idoc.
    I have not worked on sales order process,But I have worked on Purchase Order creation process.
    Please let me know the error ,If i know the error i will defiantly help you.

  • Return Order Creation with Multiple Lines not possible - 7.0 to EHP3

    Hi Experts,
    We are facing an issue while creating Return Orders with external reference billing document post upgrade from CRM 7.0 to EHP3.
    While we select multiple line items from the external reference billing document and Create a return order, the very first line item gets repeated instead of all the line items getting copied to the subsequent view(BT120H_CPL/ItemList ).
    Please help.
    Thanks,
    Rohit

    >>. But is it possible in PI 7.0?
    Just few cents..
    Test using SOAPUI or  XMLSPY and use that same WSDL URL in the target URL of Communication channel. Just to make sure you use the right endpoint.
    or
    You can specify the method name as  soap action dynamically using udf in mapping and see how it behaves.

  • J1injv multiple selection not available

    While doing J1INJV transactions it is not allowing the select more than one line item.  Is there any solutions for this.
    N Ram Mohan

    Hi Ram,
    Please note that the Multiple Line selection is only confined to
    "amount correction" and NOT for "tax code correction"
    If you choose amount correction,you can select multiple line items
    by applying the note 1039027.
    This means that if you are going for tax code correction,you can
    select only one line at a time.
    Hope this clarifies the issue.
    Regards,
    Abhisek

  • 'Exlude from Selection' not possible

    Hi Friends
    I'm trying to use 'Exlude from Selection' for filters or variables with slect options in BI 7000
    for values defined as 'contains pattern'.
    I.e. I just want to exlude e.g. values beginning with XYZ from selection.
    It' stiill possible to define a string like 'XYZ' with symbol foer contains pattern, but there is
    no way to exclude it from selection in context menu or with red icon (both are greyes out).
    We are on SP 19, Gui 7100 OL 14.
    Thanks in advance
    Jioe

    Hi Rakesh,
    thanks for reply, I was afraid of this kind of answer
    ..just another useful feature not longer available in BEx. My expectation to a new release up to now was , that processes shouldbe faster, easier and more convienent for users. Thanks to all developers who make work so much more efficient for us customers in such an impressive way....
    Best regards
    Joe

  • Template Selection Not possible whicle creating Project Structure

    Hi All,
    When I am creating a new Project, I am unable to select the template are created in teh system. The field does not display any values.
    Do reply with your valuable answers.
    Thanks & Regards,
    Stephen

    Hi
    First create a template in templates view of cProjects
    this template is based on project type... Means you can have different templates  for different project types..
    Then select the project type for which you have created template, then only they will be visible in dropdown...
    Niranjan
    Award points if useful

  • Syncing iPhone with selected groups: selection not possible

    I'm trying to sync only a part of my address book to my iPhone 4, but iTunes did not sync the group named iPhone (the group was created in the iPhone, but was empty). Then I've created a new group called "Mobil" in the address book with 300 or so contacts. But now iTunes is not able to see this group (as shown in the screen shot below).
    Any hints from an experienced sync expert? Should I look for some third party apps to sync properly?

    Mac OS X 10.6.7
    Contact application is Apples Address Book 5.0.3
    Here's the screenshot (didn't upload the first time)

  • Multiple selection in DISPLAY only ALV GRID

    Hi,
    I would like to make the rows of the ALV Grid Display only at the same time I would like to make multiple selection possible.
    Multiple selection is possible by giving EDIT = 'X' at the layout level. But then if we give EDIT = ' ' at the fieldcatalogue level or no_input = 'X' at the layout level it is still in Editable mode. Kindly help me.
    Thanks

    Hi,
    Setting and getting selected rows (Columns) and read line contents
    You can read which rows of the grid that has been selected, and dynamic select rows of the grid using methods get_selected_rows and set_selected_rows. There are similar methods for columns.
    Note that the grid table always has the rows in the same sequence as displayed in the grid, thus you can use the index of the selected row(s) to read the information in the rows from the table. In the examples below the grid table is named gi_sflight.
    Data declaration:
    DATA:
    Internal table for indexes of selected rows
    gi_index_rows TYPE lvc_t_row,
    Information about 1 row
    g_selected_row LIKE lvc_s_row.
    Example 1: Reading index of selected row(s) and using it to read the grid table
      CALL METHOD go_grid->get_selected_rows
        IMPORTING
          et_index_rows = gi_index_rows.
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      IF l_lines = 0.
        CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
             EXPORTING
                  textline1 = 'You must choose a valid line'.
        EXIT.
      ENDIF.
      LOOP AT gi_index_rows INTO g_selected_row.
         READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
        ENDIF.
      ENDLOOP.
    Example 2: Set selected row(s).
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      IF l_lines > 0.
        CALL METHOD go_grid->set_selected_rows
            exporting
              it_index_rows = gi_index_rows.
      ENDIF.
    Make an Exception field ( = Traffic lights)
    There can be defined a column in the grid for display of traffic lights. This field is of type Char 1, and can contain the following values:
    1 Red
    2 Yellow
    3 Green
    The name of the traffic light field is supplied inh the gs_layout-excp_fname used by method set_table_for_first_display.
    Example
    TYPES: BEGIN OF st_sflight.
            INCLUDE STRUCTURE zsflight.
    TYPES:  traffic_light TYPE c.
    TYPES: END OF st_sflight.
    TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
    DATA: gi_sflight TYPE tt_sflight.
      Set the exception field of the table
        LOOP AT gi_sflight INTO g_wa_sflight.
          IF g_wa_sflight-paymentsum < 100000.
            g_wa_sflight-traffic_light = '1'.
          ELSEIF g_wa_sflight-paymentsum => 100000 AND
                 g_wa_sflight-paymentsum < 1000000.
            g_wa_sflight-traffic_light = '2'.
          ELSE.
            g_wa_sflight-traffic_light = '3'.
          ENDIF.
          MODIFY gi_sflight FROM g_wa_sflight.
        ENDLOOP.
      Name of the exception field (Traffic light field)
        gs_layout-excp_fname = 'TRAFFIC_LIGHT'.
      Grid setup for first display
        CALL METHOD go_grid->set_table_for_first_display
          EXPORTING i_structure_name = 'SFLIGHT'
                                  is_layout               = gs_layout
          CHANGING  it_outtab                 = gi_sflight.
    Color a line
    The steps for coloring a line i the grid is much the same as making a traffic light.
    To color a line the structure of the  table must include a  Char 4 field  for color properties
    TYPES: BEGIN OF st_sflight.
            INCLUDE STRUCTURE zsflight.
          Field for line color
    types:  line_color(4) type c.
    TYPES: END OF st_sflight.
    TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
    DATA: gi_sflight TYPE tt_sflight.
    Loop trough the table to set the color properties of each line. The color properties field is
    Char 4 and the characters is set as follows:
    Char 1 = C = This is a color property
    Char 2 = 6 = Color code (1 - 7)
    Char 3 = Intensified on/of = 1 = on
    Char 4 = Inverse display = 0 = of
         LOOP AT gi_sflight INTO g_wa_sflight.
          IF g_wa_sflight-paymentsum < 100000.
            g_wa_sflight-line_color    = 'C610'.
          ENDIF.
          MODIFY gi_sflight FROM g_wa_sflight.
        ENDLOOP.
    Name of the color field
    gs_layout-info_fname = 'LINE_COLOR'.
    Grid setup for first display
    CALL METHOD go_grid->set_table_for_first_display
          EXPORTING i_structure_name = 'SFLIGHT'
                                 is_layout                = gs_layout
          CHANGING  it_outtab                 = gi_sflight.
    Refresh grid display
    Use the grid method REFRESH_TABLE_DISPLAY
    Example:
    CALL METHOD go_grid->refresh_table_display.
    ALV Grid Control with column and row selection
    Selecting and Deselecting Rows
    Use
    Depending on where the ALV grid control is used, there are various methods for selecting and deselecting cells and rows:
    If no pushbuttons are displayed on the left edge of the list:
    You can only select one row at a time.
    You can select multiple rows.
    If pushbuttons are displayed on the left edge of the list:
    You can select several rows or individual cells.
    You can select several rows as well as several cells or individual cells.
    Procedure
    If no pushbuttons are displayed on the left edge of the list, you select a row by clicking an entry in the row.
    If pushbuttons are displayed on the left edge of the list, you select a row by clicking the pushbutton on the relevant row.
    In this case, you select the relevant cell by selecting the entry in the row.
    In both cases:
    To select several rows, press the Shift button and choose the cells as described above.
    Adjacent rows:
    Select a row, choose Shift or Control, and select the desired rows,
    or
    Choose Shift, and select the first and the last of the desired rows,
    or
    Select a row, keep the mouse button pressed, and pass over the desired rows.
    Rows that are not adjacent:
    Select a row, choose Control, and select the desired rows.
    All rows:
    You can only select all rows at once if pushbuttons are displayed on the left side of your list. To select all rows, choose .
    To deselect individual rows, press the Ctrl button and click the relevant row.
    Result
    The selected cells have an orange background. The position of your cursor is indicated with a yellow background.

Maybe you are looking for