Updating the particular row and column in a JTable

Hi,
I have a JTable which is having fixed number of columns. When i am trying to update a particular cell in the table
during programm execution i am not able to do it.
I am getting the row number and column number correctly. But when i am going to set the data it is not setting at the same row. It is setting some other row according to the m_index (according to the sorting).
i am doing :
JTableModel model = (JTableModel) m_TablePan.getTableModel();
model.setValueAt(savedData, row, column);

See the convertXxxIndexToView and convertXxxIndexToModel methods.
db
Edited by: Darryl.Burke -- wrong methods suggested
Edit2: Evidently lipumama doesn't follow up on many questions posted.
One for the blacklist.

Similar Messages

  • I need to take elements from within 2 nested for loops and place them in an array at the specific row and column that I need.

    I have tried intializing an array and replacing elements by specifying a particular row, and column, but in the end I get an array with only one element replaced, and I suspect that it is because as the for loops are running through their iterations each time the array is re-initializing. I have a simple vi that I will post below, it is not the exact situation that I have but is a good place for me to get some understanding. I have the row and column indexes being driven by the inner and outer loop iterations, which gives me the pattern I need. I am using the inner iterations as array elements. How do I set this up so that it works and d
    oes keep re-initializing my array.
    Attachments:
    Untitled.vi ‏26 KB

    I have fixed a number of things in your vi.
    You were right in thinking that the array was continuously re-initialized. To avoid this, use a shift register (right-click the loop border), which will pass the updated array into the next iteration.
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    your_vi.vi.zip ‏13 KB

  • How to make a particular row and column field editable in ALV

    Hi Experts,
    I have a requirement to make a particular row and column field editable in ALV output. Like i need to make 2nd row - 4th column editable of ALV output.
    Kindly help me out to solve this.
    Any help would be appreciated.
    Thanks,
    Ashutosh

    Hi Ashutosh,
    please check below, explained by some experts.
    In the below link  editing two columns MOD_RANK and TECH_RANK.
    These two columns will be in edit mode once after selecting the required record
    Editing single cell in a row of ALV table
    And also look for more info
    http://scn.sap.com/thread/884976

  • How to set the Selected row and Column in JTable

    Hi,
    i have a problem like the JTable having one Method getSelectedRow() and getSelectedColumn to know the Selected row and Column but if i want to explicitly set the Selected Row and Column,then there is no such type of Methods.If anybody has any solution then i will be thankful to him/her.
    Praveen K Saxena

    Is that what you're looking for? :myTable.getSelectionModel().setSelectionInterval(row, row);
    myTable.getColumnModel().getSelectionModel().setSelectionInterval(column, column);

  • Suppressing  the total row and column in OLAP datagrid

    I have created an OLAPDatagrid and everything looks fine
    except that I don't want to show the '(All)' row and column in the
    grid. Is there a way to suppress them?
    Thanks,
    Fred

    Instead of using members() in the query use children() for
    the attribute/hierarchy.

  • Searching for a string in the xml present in a particular row and column.

    Hi All,
    We have a table in which in one of the column a complete payload xml is getting stored.
    Is there any way to search for a particular string in the stored xml of a particular row?
    Thanks in Advance,
    Bob

    Here is a simple example of what Blu is saying
    I have create a table temp_dept like this
    SQL> desc temp_dept
    Name                          Null?    Type
    DEPTNO                                 NUMBER
    DNAME                                  VARCHAR2(10)
    LOC                                    VARCHAR2(8)
    EMP_XML                                XMLTYPE
    I have loaded employee detail from emp table into emp_xml as xml data. here is a sample
    SQL> select * from temp_dept;
        DEPTNO DNAME      LOC      EMP_XML
            10 ACCOUNTING NEW YORK <?xml version="1.0"?>
                                   <ROWSET>
                                    <ROW>
                                     <EMPNO>7782</EMPNO>
                                     <ENAME>CLARK</ENAM
            20 RESEARCH   DALLAS   <?xml version="1.0"?>
                                   <ROWSET>
                                    <ROW>
                                     <EMPNO>7369</EMPNO>
                                     <ENAME>SMITH</ENAM
            30 SALES      CHICAGO  <?xml version="1.0"?>
                                   <ROWSET>
                                    <ROW>
                                     <EMPNO>7499</EMPNO>
                                     <ENAME>ALLEN</ENAM
    Now i can convert the emp_xml into a table and query like this
    SQL> select d.deptno
      2       , d.dname
      3       , d.loc
      4       , e.*
      5    from temp_dept d
      6       , xmltable
      7         (
      8              '/ROWSET/ROW' passing d.emp_xml
      9              columns empno          number        path 'EMPNO'
    10                    , ename          varchar2(100) path 'ENAME'
    11                    , job            varchar2(100) path 'JOB'
    12                    , mgr            number        path 'MGR'
    13                    , hiredate       varchar2(100) path 'HIREDATE'
    14                    , sal            number        PATH 'SAL'
    15                    , com            number        PATH 'COM'
    16         ) e
    17  /
        DEPTNO DNAME      LOC           EMPNO ENAME      JOB               MGR HIREDATE          SAL     COM
            10 ACCOUNTING NEW YORK       7782 CLARK      MANAGER          7839 09-JUN-81        2450          0
            10 ACCOUNTING NEW YORK       7839 KING       PRESIDENT             17-NOV-81        5000          0
            20 RESEARCH   DALLAS         7369 SMITH      CLERK            7902 02-APR-81        2975          0
            20 RESEARCH   DALLAS         7566 JONES      MANAGER          7839 02-APR-81        2975          0
            20 RESEARCH   DALLAS         7788 SCOTT      ANALYST          7566 19-APR-87        3000          0
            20 RESEARCH   DALLAS         7876 ADAMS      CLERK            7788 23-MAY-87        1100          0
            30 SALES      CHICAGO        7499 ALLEN      SALESMAN         7698 20-FEB-81        1600        300
            30 SALES      CHICAGO        7521 WARD       SALESMAN         7698 22-FEB-81        1250        500
            30 SALES      CHICAGO        7654 MARTIN     SALESMAN         7698 28-SEP-81        1250       1400
            30 SALES      CHICAGO        7698 BLAKE      MANAGER          7839 01-MAY-81        2850          0
            30 SALES      CHICAGO        7844 TURNER     SALESMAN         7698 08-SEP-81        1500          0
    11 rows selected.
    SQL>
    You can apply filter for the necessary value that you are searching.

  • Is it possible to switch the rows and columns?

    Is it possible to switch the rows and columns of a table? The reason I ask is that it would be easier for me to input the data with the number at the top of a column and the fields going down. But it would be easier to read the data with the number on the left and the fields going to the right. Is it possible to switch a table in this way?

    mahongue wrote:
    Is it possible to switch the rows and columns of a table? The reason I ask is
    that it would be easier for me to input the data with the number at the top
    of a column and the fields going down. But it would be easier to read the
    data with the number on the left and the fields going to the right. Is it
    possible to switch a table in this way?
    It sounds to me as though you wish to transpose a table so that the original is changed from rows to columns and from columns to rows, as in the following:
    Table 1
        A   B   C
    ========
    1   o   p   q
    2   r   s   t
    3   u   v   w
    Table 2
        A   B   C
    ========
    1   o   r   u
    2   p   s   v
    3   q   t   w
    You are right - it would be nice to have a menu item to magically transpose a selected block of cells. But there isn't one. So...
    One way to solve this is to use the index() and transpose() functions to accomplish row and column cell transposition. If you are going to use a 1:1 cell correspondence and change the header columns and rows also, you can use this:
       =INDEX(TRANSPOSE(Table # :: <range>),ROW(),COLUMN())
    where Table # and <range> is substituted as in the following fashion:
       =INDEX(TRANSPOSE(Table 1 :: $A$1:$C$3),ROW(),COLUMN())
    Create a second table. Copy the modified formula above with the appropriate substitutions, select the range you wish to have your transposition inserted into (must match the transposed cell dimensions of the original range), paste the forumula and voila! the cells will be transposed.
    Cautions:
    o The target table must match the swapped cell length and width dimension. For example, if the original data range is 6 columns wide by 4 rows deep, then the corresponding table or range to hold the transposition must be 4 columns wide by 6 rows deep.
    o If your transposed data block is to be offset from the origin of the new table, then you will need to include a subtractive offset into your cell formula, since in the transpose() function the data in the master data range is referenced from its position with the master range, not its cell position in the table. Such an offset is necessary because this example formula uses the target row and column numbers to arrive at indexed positions.
    For example, if the new data range is to be offset one column to the right and one row below from the target table's origin then you must subtract (-1) from the cell and from the column references in the formula:
      Example:
      =INDEX(TRANSPOSE(Table 3 :: $B$2:$D$4),ROW()-1,COLUMN()-1)
    If someone has a better solution I'd be glad to hear of it.

  • Hi, how can i break the value for a row and column once i have converted the image to the array?????​??

    Hi, I would like to know how can i break the value for a row and column once i have converted the image to the array. I wanted to make some modification on the element of the array at a certain position. how can i do that?
    At the moment (as per attachhment), the value of the new row and column will be inserted by the user. But now, I want to do some coding that will automatically insert the new value of the row and the column ( I will use the formula node for the programming). But the question now, I don't know how to split the row and the column. Is it the value of i in the 'for loop'? I've  tried to link the 'i' to the input of the 'replace subset array icon' , but i'm unable to do it as i got some error.
    Please help me!
    For your information, I'm using LABView 7.0.

    Hi,
    Thanks for your reply.Sorry for the confusion.
    I manage to change the array element by changing the row and column value. But, what i want is to allow the program to change the array element at a specified row and column value, where the new value is generated automatically by the program.
    Atatched is the diagram. I've detailed out the program . you may refer to the comments in the formula node. There are 2 arrays going into the loop. If a >3, then the program will switch to b, where if b =0, then the program will check on the value of the next element which is in the same row with b but in the next column. But if b =45, another set of checking will be done at a dufferent value of row and column.
    I hope that I have made the problem clear. Sorry if it is still confusing.
    Hope you can help me. Thank you!!!!
    Attachments:
    arrayrowncolumn2.JPG ‏64 KB

  • How can I make Numbers respect the row and column locks in an Excel workbook opened in Numbers???

    I have a Windows server app that generates Excel workbooks to be emailed to political campaign volunteers to be loaded into Numbers on an iPad, edited, then emailed back to be posted to the server database.  There are two problems encountered:
    1.  The Excel workbook has the first row (column headings) and first column (route identifier) of cells locked, so that they will not scroll off the screen, but Numbers doesn't respect the locks, so when the user scrolls horizontally or vertically, the column headings and/or the route identifier scroll off the screen.
    2.  The Excel workbook has pop-up "tool-tip" type comments in certain column headings in order to provide the user with the acceptable entries for those columns, but Numbers does not respect those.  When the user touches any of the commented column heading cells, a context menu appears instead of the comment.
    What must I do in the Excel workbook sheets, or what settings can be made in Numbers to correct the above?

    I imported a Numbers '09 file into Numbers on the iPad.  All comments were removed during import. Frozen header row and column were retained.
    Thank you for your responses I must ask, however, when you refer to "importing" the Excel file, are you referring to a two step process whereby the Excel file is first converted by some other process into Numbers format, then opened in the Numbers application - which is what I have to do in my PC application to generate the Excel file, and reverse that process to convert the Excel back into my database format - or are you simply referring to opening the file in Numbers as "importing" it?  And please excuse any ignorance, as I'm not at all familiar with Apple's terminologies.  In fact, I don't own an iPad myself, but rather I have to depend on one of my clients to do the testing for me.
    I imported an XLSX file into Numbers on the iPad.  The file used "freeze panes" to "freeze" the first column and row. Only warning on import was that it changed fonts. It imported without the first row and column frozen and with no comments. Nothing I can do about the missing comments but it was a simple matter to turn the first column & row into headers and freeze them.
    Unfortunately this would not be an efficient  solution, since the end users are, for the most part, elderly political campaign volunteers who are fairly computer illiterate.  These workbooks are actually canvassing lists - known as walklists.  Their purpose is for the volunteers to interview voters, record the results of the interviews, and post the results to a database, which provides the campaigns with valuable strategizing capabilities.  Also, these workbooks have multiple pages - as many as 10 or more.  and from what I infer from the above, the setting changes would have to be made on each page.
    My whole intent in developing this iPad/Tablet methodology was to significantly reduce volunteer's work - which is a recruitment benefit - and eliminate paper.  While the latter would be accomplished, the former would not, and in fact would tend to increase it.  It's necessary to keep the first row - column headings - and the first column - the route identifier - from scrolling off the page, so that the volunteer won't have to keep scrolling up and down and right and left to know what the data are.
    Conclusion: Comments are not supported on the iPad version of Numbers.  Frozen headers are not imported from Excel but can be recreated easily.
    I was previously directed to the Apple website  http://www.apple.com/ipad/from-the-app-store/apps-by-apple/numbers.html which extols the wonders of the Numbers application.  About halfway down the page there's a section regarding, "Sliders steppers and pop-ups".  The web page states that pop-ups can be set up but, being a marketing site, gives no indication whatsoever as to how it's done.  I was hoping someone could tell my if there's any way to carry them over from an Excel file.

  • JTable - Swapping the Rows and Columns

    This issue was raised in the Java Programming forum. Received initially as a weird requirement, it now seems that it is more common than you might think. Under it's original title it was "JTable - Limitation or Not?"
    I introduced the topic here so that the thread perspective can include more experienced Swing developers.
    The JTable in it's default layout is intended to hold database tables with records in rows. But what if you want records in columns?
    Some have said why? Just accept the row layout. Others have said use a customised form. Both reasonable views. Despite this, others report that the inherrited power of the JTable is worth leveraging and they have been doing it for years. Albeit with messy code in certain cases.
    This is a clear candidate for a popular derived component. If the existing JTable were renamed as a JTableRecordPerRow I am describing a JTableRecordPerColumn. The corresponding Table Model must naturally have a getRowClass method and no getColumnClass method.
    Java is good at seperating data from display issues so essentially this is only a display issue. The data representation is unaffected.
    While this may be so, the TableModel for a JTable makes the link from the display to the data so it must have knowledge about cell type to trigger the correct cell editor for example.
    I think it is fair to say that the standard JTable has not be designed with alternative row/column or column/row displays in mind. Hence a single getColumnClass method. However implementing a Table model which exchanges columns for rows is a good start. This leaves a few loose ends where editting is concerned.
    While this may not be an ideal topic for anyone just learning Swing I have been encouraged to consider the general case within the limitations of the cell types normally supported by the default Table model.
    I would have a guess that this is an established component in many private Java libraries already.
    Views and experience on this topic extremely welcome.

    It appears to me that while interchanging the rows and columns of a JTable is not trivial it is still worthwhile as a workhorse component.
    Perhaps the original design could have allowed for an aternative layout manager of somekind but this could easily have made description of records/rows and fields/columns confusing.
    I will probably get this summary wrong but I aill attempt to collate the neatest approach as I see it. Criticisms or shorter steps welcome. My thanks to the original contributors traceable from this thread.
    In the descriptions below a distinction is made between the normal internal data model representation of a row, called "mrow", and the displayed form "row".
    Only the TableModel need be changed.
    1 Use row 0 to show the headers by a)disabling the normal TableHeader renderer b)setting the cell renderer for column 0 to the default renderer used by the TableHeader and c)using the getValueAt method to return mcol header values for the row entries.
    2 For other row, col values to getValueAt return the value at mcol, mrow where mcol==row-1 & mrow==col.
    3 Create a new getCellClass(col,row) method to return the class where mrow==0 and mcol==row-1. Note that I am only trying to immitate the common use of of a database record per mrow here.
    4 Override a)getCellRenderer and b)getCellEditor to use getCellClass
    Four steps with seven parts seems worth it to me.
    The power of Swing!
    Many thanks to all.

  • Hyperion Reports - Row and Column templates

    <p>Sorry if this may be a bit basic but we are new to Hyperionreports. Currently we are going through a redesign process and washoping to get some viewpoints on the benefits of using row andcolumn templates within reports. I am looking at this option butgetting frustrated by the limitations around formatting, etc</p><p> </p><p>Are there any views out there on the preferred options. We havea particular style in design we need to include which is becomingdifficult when we use row and column templates</p>

    it may also worth cross checking below form doc:
    a.If your row and column template contains formulas with external references (for
    example, to cells outside of the selected row and column template), you are prompted
    to modify those formulas before saving the row or column template.
    Note: You can save a row and column template that contains cell formulas, as these can
    be discarded. For more information, see step 9.c on page 115.
    b. If a secondary database connection was specified within the row and column template,
    a dialog box displays prompting you to continue saving the template. If you save the
    template, the secondary database connection you specified in the row and column
    template is discarded. The primary database connection is then used for the row and
    column template.
    c. If unsupported properties are found, an Information dialog box presents a list of
    properties to discard before saving the template. For example, if the row and column
    template contains a cell formula, you can choose to save the template without the
    formula or not save the template.

  • Assigning Header Row and Column

    I've imported a couple of very large spreadsheets from Excel. Can I assign the first row and columns as headers or do I need to click on the "Add top row for column names" or the corresponding row names button and then cut and paste my existing first row and column?

    I'm surprised.
    I worked heavily on a sheet in which I uses several formula entered in the header cells, it works flawlessly under 10.5.5 as well as under 10.4.11.
    How have you updated Mac OS to 10.5.5?
    Did you used the "Software Updater" available in the Apple menu or did you downloaded a combo updater?
    I never use the first formula which as far as I know apply patches on patches applyed on patches applyed on patches…
    I always download a combo updater which make a cleaner job.
    http://www.apple.com/support/downloads/macosx1055update.html
    Yvan KOENIG (from FRANCE mercredi 1 octobre 2008 19:03:43)

  • How do I delete multiple rows and columns in an image?

    I am looking into how digital SLRs extract video data from a CMOS sensor. To give an example, the GH1 from Panasonic can record video at 1920 x 1080 from a 12 MPixel sensor that, say, is 4000 horizontal x 3000 vertical. How they do that seems to be not in the public domain, but there have been a few guesses (see http://www.dvxuser.com/V6/showthread.php?t=206797 and http://luminous-landscape.com/forum/index.php?showtopic=38713).
    One approach would be to simply read every second row of sensor pixels (1500 rows read from the original 3000) and once you have those in memory, delete every second column (2000 columns left). You would end up with a 2000 x 1500 image which could then be resampled to 1920 x 1080.
    I'd like to simulate what the camera appears to be doing, by generating a 4000 x 3000 test image and then asking Photoshop CS4 to delete the appropriate rows and columns. It may not necessarily be every second row; the Canon 5DMk11 appears to read every third row, so I may need to delete two out of every three rows.
    Can Photoshop do that sort of thing? If so, how?

    Thanks for the suggestions. Yes, I did take a detailed look at your images, but they weren't 100% convincing because it wasn't clear just what was happening. And Adobe's explanation, after reading it again, explains nothing at all to someone who doesn't know how Nearest Neighbor works.
    But you are correct -- Nearest Neighbor does effectively delete pixels. I proved it with the attached 6 x 6 image of coloured pixels (the tiny midget image right after this full stop -- you'll have to go to maximum zoom in PS to see it).
    These are the steps to delete every second row and then every second column.
    1. Select Image > Image Size.
    2. Set Pixel Dimensions > Height to half the original (in this case set to 3 pixels).
    3. Set Resample Image to Nearest Neighbor.
    4. Click OK and the image shoould now consist of three vertical white strips and three vertical Green-Red-Blue stripes.
    5. Repeat steps 1-4, but this time set Pixel Dimensions > Width to half the original (in this case set to 3 pixels). The image should now consist of three horizontal stripes Green-Red-Blue.
    Just to make sure the method worked for every third pixel, I repeated the above steps but with 2 pixels instead of 3 and obtained the correct White-Green, White-Green pattern.
    I resampled the Height and Width separately for the test so that I could see what was happening. In a real example, the height and width can be changed at the same time in the one step, achieving the same results as above.
    Finally, how to explain how Nearest Neighbor works in the simple cases described above?
    Division by 2
    In the case of an exact division by two (pixels numbered from top leftmost pixel), only the even numbered rows and columns remain. To put it a different way, every odd numbered row and column are deleted.
    Division by 3
    Only rows and columns 2, 5, 8, 11... remain.
    Division by N
    Only rows and columns 2, 2+N, 2+2N, 2+3N... remain.
    To put it simply, a resample using Nearest Neighbor (using an exact integer multiple) keeps every Nth row and column, starting from number two. The rest are deleted.

  • Setting cursor to appropriate row and column in JTextArea

    Hi
    this is kranthi from Hyd
    iam unable to point out the cursor to the appropriate row and column in the JTextArea
    are there any methods to do so
    plz help me

    Yup, look at setCaretPosition(int pos)

  • Get current row and column in JEditorPane

    Hi,
    I have a JEditorPane and I want to show the current row and column according to the caret position
    can anyone please assist ?
    Thanks,
    Dekel

    JEditorPane was designed to display HTML which may not have a great concept of row column once you start adding tables and other fancy stuff. If you only have text data then I would use a JTextArea or JTextPane, they are easier to work with.
    I want to show the current row and column according to the caret positionCheck out this posting:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=608220

Maybe you are looking for