How to select a row in JTable for right mouse click ?

Hi All,
I need to select a row on JTable for right mouse click ?
Can any one help me ?
Thanks a lot.
Seelam.

Got solution...
tabel.addRowSelectionInterval(..) works.
thanks.

Similar Messages

  • How to select a row in Jtable at runtime

    how to select a row in Jtable at runtime.

    use
    setRowSelectionInterval(int fromRowIndex, int toRowIndex);example if your table has 10 rows then u want to select the rows from 4 to 8 then use
    setRowSelectionInterval(3, 7);if you want to select just one row for example 5 then use
    setRowSelectionInterval(5, 5);

  • How to select a row in JTable

    Hello,
    I have a problem selecting a row in a JTable.
    I use
    mytable.getSelectionModel().setSelectionInterval(row, row);
    to select a row, but after that this row is only highlighted. After calling this method I cannot change the selection using the arrow keys.
    Can anybody give me a hint, how I can get the row selected, so that I can use the arrow keys immediately after selecting the row?
    Any help is welcome.
    Thanks,
    Fritz

    Hello,
    I got the solution:
    final int pRow = row;
    final int pCol = column;
    final JTable myTable = mytable;
    SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    myTable.requestFocusInWindow();
    myTable.changeSelection(pRow, pCol, true, true);

  • How can I add a popup for right mouse click for anywhere on application?

    I have never used popup menus before but need to add on to my application.
    This is a swing application with several pages that are basically panels that are added and removed as needed.
    I need to have a popup menu that appears anywhere on the application when the right mouse button is clicked,
    no matter which component the cursor is over.
    I have been able to add one for a specific panel, but that is not what needs to be done, since there are dozens
    of separate panels in the application.
    Could someone point me to an example of how to make the popup active for anywhere on the application?
    Thanks.

    You are correct, I have not yet read the tutorial you suggested. I will do so tomorrow and try to move farther up the learning curve.
    My response was intended to acknowledge your reply and let you know where I am in trying to resolve this issue.
    You are also correct in that creating a popup may be a simple task, but, like I stated in my original post, I have never used popups in the past.
    And, like I said, things that are second nature for someone who uses certain components are not always intuitive for people who have not.
    I did do some research before posting my question, but all the examples I found were related to popups tied to a specific panel.
    I am able to create that, but the problem I ran into was that I needed to have a popup menu that was application general, not panel specific.
    It was not obvious to me how to do that and none of the examples I found explained how to do that.
    Hence, my question to the forum, hoping that someone who has gone through this exercise would impart knowledge to help me resolve this issue.
    It is not uncommon for persons to post examples or direct one to web sites that specifically address the issues in question.
    That is what I was hoping for, but I am not adverse to doing follow-up research on leads that are provided.
    My main issue is trying to figure out how to find a parent component (or panel) for the popup.
    You stated that I should be able to get that from the event listener.
    I'm not sure how to do that, but hopefully one of the event listener get methods will provide that information
    Hopefully, I will be able to resolve this with the feedback you provided, but if necessary, I will post code for a simple example to illustrate my problem.
    Thanks again for the feedback.

  • How to select first row of JTable by default

    Hi,
    I have a JTable with 5 rows.
    When the software starts, none of the rows are selected.
    I wish to keep the first row selected by default.
    How do I do it?
    I couldnt find any method like setSelectedRow() !!!
    Does anyone have a sample code plz?
    Thanks.
    Anuj

    couldnt find any method like
    setSelectedRow()You need to use getSelectionModel() first.
    Another way is to use:
    table.changeSelection(0, 0, false, false);

  • Please help with script for right-mouse click on 3D objects

    Hi!
    I have PDF file with two simple 3d objects (for example with two cube).
    I need to make script that when user right-click to first cube, a PDF file (c:\a.pdf) opening (or c:\b.pdf for second one) in new windows. How to make it? Thank you so much!

    Hi,
    please check SDK sample 22 Right-Click, there is everything you need.
    First catch RightClickEvent, then create the menu entry when beforeAction = true, and when beforeAction = false you have to remove it again (otherwise you will receive an error when rightclicking again).
    Regards
    Sebastian

  • Wait for a mouse click

    Really need help with this one. I'm writing a program to simulate a Risk game and I need to write a method to make two countries neighbors, which would be done by adding each the neighbor country to each country's neighbor's array. To do this, I will need to click on the country, click on the map and then click on the other country. My method gets the country's name but how do I tell it to wait for a mouse click before trying to get the second country's name???? I've tried everything but to no avail. Any help would be appreciated.

    Some object has to be made a mouse listener for the components that are representing countries (I guess there are multiple of these) and the map.
    It should have a variable to represent first country clicked on - a variable that is initially null. It will need another variable to store the information it obtains from the click on the map (location, or whatever). It responds more or less as follows:
    Cick on country:
    Is firstCountry null?
        If so make firstCountry the country that was clicked on and finish
        If not, do we have mapInfo?
            If so use firstCountry, the country that was clicked on and mapInfo to update the neightbour list. Then make mapInfo and firstCountry null. Then finish.
            If not, just finish (because we are waiting for a click on the map).
    Click on map:
    Is firstCountry null?
        If so, just finish (because we are waiting to start the process with a click on a country).
        If not, extract the information from the map and place in mapInfo. Then finish.
    As you can see "waiting" in a GUI is quite a complex business - nothing really pauses, rather it continues as usual until an event of the right "type" occurs. The listener maintains enough "state" (information) to know what it is listening for and to remember necessary information that it has heard and will use later.
    This is somewhat general. It is difficult to be more specific unless you post some code. It should not be pages of GUI code - just enough to illustrate the task of three clicks and an action.

  • How to Select  a Row in a JTable, on a right mouse click?

    Hi all!
    I need to know the Row index in a JTable, on a right mouse click?
    Executing following code, I get the "Column Number" on a mouse click
    TableColumnModel columnModel = tableView.getColumnModel();
    int viewColumn = columnModel.getColumnIndexAtX(e.getX());
    int columnIdx = tableView.convertColumnIndexToModel(viewColumn);
    Dows any body know the code that gets "rowIdx" on a mouse e.getY() method??
    Hope early response!

    int row = table.rowAtPoint( e.getPoint() );
    int column = table.columnAtPoint( e.getPoint() );

  • How to lock a row by using 'for update'?

    how to lock a row by using 'for update'?

    Hi,
    SELECT * FROM <TABLE> WHERE <PK_COLUMN>=<VALUE> FOR UPDATE NOWAITThis will help in locking the row with the primary key value that you provide
    cheers
    VT

  • How to select a row in datagrid by checking the check box in that row

    how to select a row in datagrid by checking the check box in that row.
    Im using <html:checkbox> tag, and also a VO which is in request scope. i wanna display the values in the VO in a row and corresponding to this i want a checkbox..
    Thanx in advance
    Message was edited by: me
    Hemanth@SA
    Message was edited by:
    Hemanth@SA

    Hello,
    I got the solution:
    final int pRow = row;
    final int pCol = column;
    final JTable myTable = mytable;
    SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    myTable.requestFocusInWindow();
    myTable.changeSelection(pRow, pCol, true, true);

  • Urgent :  how to select the rows in the ALV Grid Control

    How to select the rows in the ALV Grid control,
    I am facing the situation where i need to select the row/rows in the Grid control and then to lock the entries,
    If anyone have the solution please help me out
    <b>Its very Urgent</b>

    Hi Bharath,
    Go through this hope u can understand.
    SEL_MODE. Selection mode, determines how rows can be selected. Can have the following values:
    A Multiple columns, multiple rows with selection buttons.
    B Simple selection, listbox, Single row/column
    C Multiple rows without buttons
    D Multiple rows with buttons and select all ICON
    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.
    Reward points if helpful.
    Thanks
    Naveen khan

  • How to select multiple row in ALV report

    Hi friends,
    1. How to select multiple row in ALV report
                   ( How to set tab in ALV report and want to select multiple line.)
    Thanking you.
    Subash

    Hi Sahoo,
    If you are using the class CL_GUI_ALV_GRID. In methods SET_TABLE_FOR_FIRST_DISPLAY.
    in layout structure you will find field SEL_MODE
    pass :
    LS_LAYOUT-SEL_MODE = 'A'.
    In PAI.
      CALL METHOD GRID->GET_SELECTED_ROWS
        IMPORTING
          ET_INDEX_ROWS = T_ROWS
          ET_ROW_NO     = T_ROWID.
    Hope these will solve your problem.
    Regards,
    Kumar M.

  • How do I delete rows in Numbers for iPad?

    I am new to numbers for iPad. How do I delete rows in Numbers for iPad? I am able to delete the data in the rows/cells but I can't delete/move up the rows so I can move data in it's place.

    I havn't got Numbers so I can't check it, but is what is on this page any help http://help.apple.com/numbers/ipad/1.4/#tan72717a35 ?

  • I am using FireFox 4. Where is the "Bookmark All Tabs-" feature. I would like to save my Tabs for a later session. The selection is not on the menu when I right-mouse click or go to the Bookmarks feature of the Menu.

    Missing "Bookmark All Tabs…" feature which was in previous versions of FireFox 3.x. If you right-mouse click on a neutral part of the Browser window, there would be choice of "Bookmark this page" or "Bookmark All Tabs…". I have been unable to find it either in the sub-menu or the BOOKMARK selection from the Menu Bar.

    What do you mean by Tabs sub-menu is it right-clicking on a tab ?
    I know that "ctrl-shift-D" still work.
    I know that a right-click on a tab gives the "Bookmark all Tabs" function.
    But I would like to see it back in the Bookmarks menu. (which is its logical place)
    Because today the choice only disappeared from the menu as it is still reachable through keyboard shortcut or through mouse right-click on a tab
    but tomorrow it will totally disappear and personally I don't want that as this is one of my favorite functionality.
    Tank you for your understanding !

  • Diable "open dialog box" on right mouse click so I can use l mouse to advance to next slide and r mouse click to "go back."  How in PP 2010 for mac????

    I do presentations in PP10.  I am new to macair, and used to Windows.  HOW DO I DISABLE THE "OPEN DIALOG BOX ON RIGHT CLICK"?  I would like to use L mouse to advance slide, and R mouse to go back.  The default is to use R mouse to open dialog box.  I can disable this by unchecking the box in "advanced" on the PC.  How do I do it with the Mac????
    Thanks
    hacmd

    Hi Rod,
    As originally stated in my opening post, the SWF is to be inserted into an Articulate '13 slide (what I called an aggregator originally - I tried not to bring them up since I don't want the chatter about "There's your problem - using Articulate"! ).
    Recall that posting this published file to our LMS did not allow right-mouse click functionality as the flash player menu just gets in the way.
    If I insert the captivate 6 files into Articulate as a Web Object (referencing the entire folder with html, htm and assets, and then posted to our LMS, and it DOES allow RM click operations in both IE and FF (although no sound on the Captivate slide in FF). But this is not what we want to do as this introduces 2 navigation controls (the Captivate one and the Articulate Player).
    Why must anything be posted to a web server for this functionality to work?
    I am able to go into the Captivate 6's published folder, and launch the Captivate demonstration by simply double clicking on the index.html file and this works great in both FF and IE after changing the security settings for flash.
    Again - I can not believe I am the only one out there trying to use the right-mouse click feature to do a software simulation by embedding the Captivate SWF into an Articulate '13 project.

Maybe you are looking for

  • My Book won't show up on harddrive

    I unplugged the My Book from my Mac OS X 10.6.2. I got a message that said to eject the disk before unplugging. I replugged in the My Book and it showed up on the hard drive. Then I ejected it because I wanted to see it I could plug it into the Airpo

  • PS module data selection question.

    Hi Experts, We are developing a custom interface in SAP R4.5 version to pull the project information from SAP. We need Cost elements (WBS element), Actual hours, Plan hours, Actual amount and Plan amount to be pulled from SAP system with Project or W

  • Effects Scroll motion

    Hi all; I am missing the Scroll Motion tab under the Effecrs button. I have installed Muse CC, no upgrades available, so its not that. Any ideas? Thanks Maarten

  • Can I try CC without Updating my CS6?

    I know I can install both CS6 and CC, but I'm still unsure about how the trial works.  I've downloaded the Creative Cloud "downloader" (whatever you call it) which tells me what's already installed and what can be installed.  Under "Installed Apps" i

  • Solaris 11 AutoInstaller service profile for ssh to enable root logins?

    Hi Guys, I have got a basic system configuration profile that sets various things for my newly installed solaris 11 client. I was curious if anyone has a xml service configuration declaration I could use that configures the ssh service to allow remot