JTable - how to do multiple interval selections

Suppose if i have a 10 rows in the table.
By Default, How can i select multiple interval rows selection.
Like 2,5,7,8,10 rows has to be selected.
After loading i should be able to select different rows also.
How can I do it.

You can do that by using ListSelectionModel from the JTable by calling getSelectionModel()
Detail of the selection model can be found inside Java API

Similar Messages

  • How to handle multiple option selected in JSP?

    Hi ,
    Imagine in a jsp page we have 7 check boxes with 7 different option.
    When user selects each chk box data should be fetched from respective table.
    Scenario:
    User can select 1 or more option in jsp page,in osb how to query multiple tables dynamically for the user selected options without using if else in message flow/switch in XQuery as no of combinations will be more .
    Can any of you guide us on this?
    Edited by: Anitha R on Feb 21, 2011 6:21 AM

    Hi Anuj -
    Thanks for the response.
    I understand your point,but thing is-
    For 7 options if we create 7 BS and for single selection based on the option selected we can invoke the respective BS.
    But if user selects more than 1 option ,i need union response of 2 respective business service .How can we achieve this , Do we have option to combine result from 2 DB adapter/2 BS to single result in OSB?
    Current method i try to follow,we have a single db adapter configured to get union response for all 7 options from DB.based on the user option i need to filter data for each eg - meterid i have in my master collection..planned to write query transformation of response data as needed for option user selects.Is this a better approach?Will this cause any performance issue?Because in my XQuery for each master data i'll fetch other details from DB using fn:bea execute sql..
    Kindly suggest any better approach to follow.
    Waiting for your earliest response.

  • JList with Multiple interval Selection

    I am trying to get all the selections that I selected when
    a button is pressed. I just don't under how it works when the selection is not contiguous. if it was I just need the first and last selected but I don't know what to do with this situtation
    Duke dollars avaiable

    If your JList allows multiple sections then this:
    1.select first item
    2. hold sown the shift key
    3. select Nth item
    will select all the items between the first and the Nth.
    Holding down the Ctrl key will select individual items.
    To make your JList accept multiple selections you use setSelectionMode

  • JTable multiple interval selection behavior

    How do you force a JTable to behave as if the control key is always pressed, without the user actually holding down the control key?
    My desired result is to have the user be able to select multiple independent intervals, exactly like the behavior when the ctrl key is held down. But I do not want the selection cleared like when the ctrl key is released and a new interval is selected.

    I solved my problem by subclassing JTable to invert the toggle parameter sent by BasicTableUI.java in the event that control is depressed while making a selection.
    Now instead of using javax.swing.JTable I will use my Toggle inverted version below.
    import javax.swing.JTable;
    public class JTableToggle extends javax.swing.JTable {
        public JTableToggle(){
            super();
        public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) {
            // toggle is true in the case where the control key is pressed, i will invert that case.
            toggle = !toggle;
            super.changeSelection(rowIndex,columnIndex,toggle,extend);
    }

  • Anyone know how to measure multiple file selections in a finder window?

    Hello,
    I have a flash drive that holds 8gbs. I have an enormous folder of images I am going to start passing to my buddy on the flash drive. Anybody know how I can select multiple files and know how big the selection will be prior to dragging them to the 8gb drive?
    Thank!
    Kirk

    Shift-click or command-click to select them, and then press the Option, Command, and I keys; the information in the window will change as the selection changes.
    (52489)

  • Infopath 2010: How To Seperate Multiple Users Selected In People Picker With A Semicolon

    I've seen several posts on this forum about getting multiple user values in a people picker in Infopath to show up in a Sharepoint List.  Obviously, they merge which isn't all that useful if you want to use that data for a workflow. I followed
    Clayton Cobb's suggestion, and took a look at this blog which uses a
    no code solution, which is what i need. Everything for this blog works for me, but I do not need to use the UserProfile web service.
    I'm coming up just short though. I can successful select multiple users in my people picker, and as I do that, the text box populates itself separated by semicolons, but the same AccountId is repeated (of the 1st person selected in the people picker) instead
    of the unique value of each user.
    Here is my current result, with data fields shown
    Here is the result I would like to see. This way the text box gets upload into Sharepoint so I can use it in other places.
    Can someone please help me?  I'm very close.  Here is my function on the text box:
    eval(eval(Person, 'concat(/my:myFields/my:PersonTraveling/pc:Person/pc:AccountId, "; ")'), "..")
    XPath (advanced):
    xdMath:Eval(xdMath:Eval(/my:myFields/my:PersonTraveling/pc:Person, 'concat(/my:myFields/my:PersonTraveling/pc:Person/pc:AccountId, "; ")'), "..")

    Hi methitical,
    Please change your XPath (advanced) to
    xdMath:Eval(xdMath:Eval(/my:myFields/my:PersonTraveling/pc:Person, 'concat(pc:AccountId, "; ")'), "..")
    to make it work.
    Thanks & Regards,
    Emir
    Emir Liu
    TechNet Community Support

  • How to identify multiple checkbox selected in JSF

    Hi All,
    My scenorio is.
    I am diplaying records on page using <h:dataTable>
    I have one column in dataTable which contains checkboxes which I displayed as,
    <h:selectBooleanCheckbox id="abc" />
    Also I have button on page.
    I want to select 2 check boxes & then click onto button then that 2 records should get deleted.
    how to identify that 2 checkbox selected ?
    can anybody help ?
    Thanks
    Sandip

    Hi BalusC
    Thanks for your reply.
    Is there any other approach to do this ?
    because as per your approach my code will not work because you are using seperate bean.
    If i try to compare your code with my code then I have to do changes in my entity bean which is not possible.
    So is there any other way ,
    If I want select more than 1 checkbox & delete those records of selected checkboxes .
    i.e. I want to find which checkboxes selected on JSP page sothat I will get those selected value on Java side & will delete that record from java side.
    Please help.
    I am not finding any solution to this.
    If any code then it will be a great help for me.
    Thanks
    Sandip

  • JTables how to apply multiple cell renderers to a cell

    I have a complicated table with many different cell renderers depending on column type. (i.e check boxes, editable text fields, formatted fields, fields with icons etc..) Now I need to add the capability to color rows depending on a certain status value of a column. How can I add this capability since I already have renderers for the cells> Most examples I have seen for manipulating row colors simply extends DefaultCellRenderer for the entire table, but I already have renderers for these cells.

    Create an interface and make each renderer implement a method that colours in the background for you. Just an idea, haven't tried it myself

  • Disabling multiple row selection in JTable

    hi,
    I have a JTable and I want to disable the multiple row selection.
    I used
    getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);and this working fine with ctr+clicking on a row
    but if i am using shift key instead of Ctrl key multiple selection is possible....
    Any idea y?and how to resolve it??
    thnx
    ~neel

    Use table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);I don't know if it differs but I use it and I don't have the problems you describe. Might be a bug in your Java version?!
    Message was edited by:
    pholthuizen

  • 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.....

  • How to use multiple selection parameters in the data model

    Hi, after have looked all the previous threads about how to use multiple selection parameters , I still have a problem;
    I'm using Oracle BI Publisher 10.1.3.3.2 and I'm tried to define more than one multiple selection parameters inside the data template;
    Inside a simple SQL queries they work perfectly....but inside the data template I have errors.
    My data template is the following (it's very simple...I am just testing how the parameters work):
    <dataTemplate name="Test" defaultPackage="bip_departments_2_parameters">
    <parameters>
    <parameter name="p_dep_2_param" include_in_output="false" datatype="character"/>
    <parameter name="p_loc_1_param" include_in_output="false" datatype="character"/>
    </parameters>
    <dataTrigger name="beforeReport" source="bip_departments_2_parameters.beforeReportTrigger"/>
    <dataQuery>
    <sqlStatement name="Q2">
    <![CDATA[
    select deptno, dname,loc
    from dept
    &p_where_clause
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="G_DEPT" source="Q2">
    <element name="deptno" value="deptno"/>
    <element name="dname" value="dname"/>
    <element name="loc" value="loc"/>
    </group>
    </dataStructure>
    </dataTemplate>
    The 2 parameters are based on these LOV:
    1) select distinct dname from dept (p_dep_2_param)
    2) select distinct loc from dept (p_loc_1_param)
    and both of them have checked the "Multiple selection" and "Can select all" boxes
    The package I created, in order to use the lexical refence is:
    CREATE OR REPLACE package SCOTT.bip_departments_2_parameters
    as
    p_dep_2_param varchar2(14);
    p_loc_1_param varchar2(20);
    p_where_clause varchar2(100);
    function beforereporttrigger
    return boolean;
    end bip_departments_2_parameters;
    CREATE OR REPLACE package body SCOTT.bip_departments_2_parameters
    as
    function beforereporttrigger
    return boolean
    is
    l_return boolean := true;
    begin
    if (p_dep_2_param is not null) --and (p_loc_1_param is not null)
    then
    p_where_clause := 'where (dname in (' || replace (p_dep_1_param, '''') || ') and loc in (' || replace (p_loc_1_param, '''') || '))';
    else
    p_where_clause := 'where 1=1';
    end if;
    return (l_return);
    end beforereporttrigger;
    end bip_departments_2_parameters;
    As you see, I tried to have only one p_where_clause (with more than one parameter inside)....but it doesn't work...
    Using only the first parameter (based on deptno (which is number), the p_where_clause is: p_where_clause := 'where (deptno in (' || replace (p_dep_2_param, '''') || '))';
    it works perfectly....
    Now I don't know if the problem is the datatype, but I noticed that with a single parameter (deptno is number), the lexical refence (inside the data template) works.....with a varchar parameter it doesn't work....
    So my questions are these:
    1) how can I define the p_where_clause (inside the package) with a single varchar parameter (for example, the department location name)
    2) how can I define the p_where_clause using more than one parameter (for example, the department location name and the department name) not number.
    Thanks in advance for any suggestion
    Alex

    Alex,
    the missing thing in your example is the fact, that if only one value is selected, the parameter has exact this value like BOSTON. If you choose more than one value, the parameter includes the *'*, so that it looks like *'BOSTON','NEW YORK'*. So you need to check in the package, if there's a *,* in the parameter or not. If yes there's more than one value, if not it's only one value or it's null.
    So change your package to (you need to expand your variables)
    create or replace package bip_departments_2_parameters
    as
    p_dep_2_param varchar2(1000);
    p_loc_1_param varchar2(1000);
    p_where_clause varchar2(1000);
    function beforereporttrigger
    return boolean;
    end bip_departments_2_parameters;
    create or replace package body bip_departments_2_parameters
    as
    function beforereporttrigger
    return boolean
    is
    l_return boolean := true;
    begin
    p_where_clause := ' ';
    if p_dep_2_param is not null then
    if instr(p_dep_2_param,',')>0 then
    p_where_clause := 'WHERE DNAME in ('||p_dep_2_param||')';
    else
    p_where_clause := 'WHERE DNAME = '''||p_dep_2_param||'''';
    end if;
    if p_loc_1_param is not null then
    if instr(p_loc_1_param,',')>0 then
    p_where_clause := p_where_clause || ' AND LOC IN ('||p_loc_1_param||')';
    else
    p_where_clause := p_where_clause || ' AND LOC = '''||p_loc_1_param||'''';
    end if;
    end if;
    else
    if p_loc_1_param is not null then
    if instr(p_loc_1_param,',')>0 then
    p_where_clause := p_where_clause || 'WHERE LOC in ('||p_loc_1_param||')';
    else
    p_where_clause := p_where_clause || 'WHERE LOC = '''||p_loc_1_param||'''';
    end if;
    end if;
    end if;
    return (l_return);
    end beforereporttrigger;
    end bip_departments_2_parameters;
    I've written a similar example at http://www.oracle.com/global/de/community/bip/tipps/Dynamische_Queries/index.html ... but it's in german.
    Regards
    Rainer

  • How to use Multiple Single Option for selection in the Customer Exit

    Hi,
    How can we handle the multiple single values in the customer exit variable.
    I have a requirement which is as follows -
    Table A fiields -> Field Coach, Partner 2, Relation between PArtner 1 & Partner 2, Valid from, valid to date.
    Table B ->  Service Month, Start Date, End Date.
    Table C -> Billing Date, Execution Partner,cal month /year.
    For the Field coach in TABLE A, multiple Partner 2 are present.
    Report has to be built on Table C.
    User inputs the Service month and Field Coach . User can enter multiple field coach values.
    For the All the Field Coach values entered, corresponding Partner2's have to be found from Table A and to be passed to the Execution Partner in Table C.
    Now if we want to use customer exit variable on the field Execution Partner, how can we handle the Multiple Single selections in the customer exit.
    Thanks,
    Shubham

    Hi,
    While creating the variable you must have to specify multiple value.
    In customer exit
    write code multiple times and append the values.
    For example:
    when 'variable'.
    l_s_range - sign = 'I'.
    l_s_range - OPT = 'EQ.
    l_s_range - LOW = EXECUTION PARTNER 1.
    APPEND L_S_RANGE TO E_T_RANGE.
    l_s_range - sign = 'I'.
    l_s_range - OPT = 'EQ.
    l_s_range - LOW = EXECUTION PARTNER 2.
    APPEND L_S_RANGE TO E_T_RANGE.
    l_s_range - sign = 'I'.
    l_s_range - OPT = 'EQ.
    l_s_range - LOW = EXECUTION PARTNER 3.
    APPEND L_S_RANGE TO E_T_RANGE.
    Regards,
    Ranganath.

  • How to accept multiple attachments on selection screen?

    Hi All,
    I need to know how to accept multiple attachments on selection screen and send them as email to external system (outlook).
    Basically, my req is to send a common email with attachments to certain users. These users are displayed in ALV. User will select ALL or specific user from ALV and send an email with message entered on selection screen.
    I used text editor control to input message body. I need to know how to accept attachments and send them.
    Appreciate any inputs.
    Thanks,
    SKJ

    SAP uses a nifty little button called 'Object Services' on ME23N (top left) which you can use to attach documents to business objects.
    http://help.sap.com/saphelp_nw70/helpdata/EN/be/3fe63659241157e10000009b38f889/frameset.htm
    It's a complicated way of doing it but might give you extra functionality in the long run.

  • How to set a payload field value only once for multiple instances selected?

    The user needs to set a payload field value and then he can approve the task so the task can continue through the process, that's fine when the user selects one instance and sets the value in the task details section and then clicks the approve button, but how do we achieve the same behavior in a multiple way?, I mean the user can select multiple tasks in the workspace (in this case the details task page is not available and instead the following label appear "Multiple tasks selected") then if the user clicks the Actions drop down -> APPROVE he only gets the message "your request was processed successfully", so how can the user modify the payload field value only once for all the selected tasks so when he clicks APPROVE the value is populated in all the instances selected.
    Thanks,
    Carlos.

    In the action which displays the edit page just set the form idx value before displaying the jsp.

  • How to handle multiple selection in the Spark List control with checkbox as itemrenderer?

    Hi All,
    I am using checkbox as an ItemRenderer in spark list.
    I have a query.
    how to handle multiple selection in the Spark List control with checkbox as itemrenderer?
    how to retrieve the selected item label?
    Thank you in advance.

    Hi there, I'll tweak your code a little bit to something like this:
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                    layout="vertical">
        <mx:Script>
            <![CDATA[
                 import mx.events.ListEvent;
                 import mx.controls.CheckBox;
               [Bindable]
               private var mySelectedIndexes:ArrayCollection=new ArrayCollection();
                private function onChange(e:ListEvent):void
                   if(CheckBox(e.itemRenderer).selected){
                             mySelectedIndexes.addItem(e.rowIndex);
                   }else{
                                  mySelectedIndexes.removeItemAt(mySelectedIndexes.getItemIndex(e.rowIndex));     
                   chkList.selectedIndices=mySelectedIndexes.toArray();
            ]]>
        </mx:Script>
    <mx:ArrayCollection id="collection">
            <mx:Object label="Test A"/>
            <mx:Object label="Test B"/>
            <mx:Object label="Test C"/>
            <mx:Object label="Test D"/>
            <mx:Object label="Test E"/>
            <mx:Object label="Test F"/>
            <mx:Object label="Test G"/>
        </mx:ArrayCollection>
    <mx:List id="chkList" dataProvider="{collection}" itemRenderer="mx.controls.CheckBox"  itemClick="onChange(event);" allowMultipleSelection="true"/>
    </mx:Application>

Maybe you are looking for

  • IDOC scenarios

    Couple of things I don't understand I am doing a IDOC to File scenario On the R3 side I have created Partner Profile, Port, Logical System and RFC Destination and also a message type ON the XI side I have created a port and RFC destination. Now comes

  • Put a image from web on indesign with quality problem....

    Hello, sorry my english, but I'll try... I need use a lot of images from web, to make a document designed on indesign, and after try with all extension or formats, I mean, tif, png, pdf, jpg, psd, with different resolutions, 72, 150, 300, and differe

  • Does the RSS feeder built-in client work offline??...

    Hi everybody! Does anybody know if it is possible to work offline with the built-in Nokia's feeder client? Thanks in advance, Regards.

  • Confirmed new Features (feel free to add some)

    Builds on Master slides I think this was a BIG feature request in the past... From page 152 of the Keynote 3 manual: "You can add object builds to a master slide so that build effects appear on every slide you create using that master. For example, i

  • Increase in wait time of synchronous interface

    I am working on HTTP to proxy synchronous interface on PI 7.3 PI uses communication channel with SOAP receiver adapter over XI protocol Now I am facing below error in the interface while testing after 3minutes-       com.sap.engine.interfaces.messagi