JTable: HOW TO INSERT ROWS AND DATA?

I have one JFrame on screen and inside of this i have a JTable, the question is how to insert rows and data into the JTable?

[http://java.sun.com/docs/books/tutorial/uiswing/components/table.html]
In future, please post Swing questions to the [Swing Forum.|http://forums.sun.com/forum.jspa?forumID=57]
In short, your TableModel is probably a DefaultTableModel . Study its API.

Similar Messages

  • How to insert rows & columns into a jTable???

    helloo there...
    How to insert rows & columns into a jtable???
    your reply is greatly appreciated....
    -=samer=-

    Yes!thanks...
    But what i want is how to set the number of rows and the number of columns...and i don't know how to setColumns and rows....any idea?
    the user will input number of rows and columns in a jtextfield....
    Please rply...

  • Insert row and delete row in a table control

    Hi Experts,
    I am using a table control in module pool programming, How can I Insert row and delete row in a table control?
    Thanks in Advance....

    Santhosh,
    Iam using this code..
    FORM fcode_delete_row
                  USING    p_tc_name           TYPE dynfnam
                           p_table_name
                           p_mark_name   .
    -BEGIN OF LOCAL DATA----
      DATA l_table_name       LIKE feld-name.
    data: p_mark_name type c.
      FIELD-SYMBOLS <tc>         TYPE cxtab_control.
      FIELD-SYMBOLS <table>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <wa>.
      FIELD-SYMBOLS <mark_field>.
    -END OF LOCAL DATA----
      ASSIGN (p_tc_name) TO <tc>.
    get the table, which belongs to the tc                               *
      CONCATENATE p_table_name '[]' INTO l_table_name. "table body
      ASSIGN (l_table_name) TO <table>.                "not headerline
    delete marked lines                                                  *
      DESCRIBE TABLE <table> LINES <tc>-lines.
      LOOP AT <table> ASSIGNING <wa>.
      access to the component 'FLAG' of the table header                 *
        ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
    if <MARK_FIELD> = 'X'.
        PERFORM f_save_confirmation_9101.
        IF gv_answer EQ '1'.
          DELETE <table> INDEX syst-tabix.
          IF sy-subrc = 0.
            <tc>-lines = <tc>-lines - 1.
          ENDIF.
          ELSE.
          ENDIF.
        ENDIF.
      ENDLOOP.
    in this code   ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
    if <MARK_FIELD> = 'X'.
    this code is not working...

  • How to design rows and columns in sapscript layout

    Hi friends,
    Please let me know how to design rows and columns in sapscript layout with example?
    Thanks,
    Yogesh

    Hi friends,
    Please let me know how to design rows and columns in sapscript layout with example?
    Thanks,
    Yogesh

  • How to insert one table data into multiple tables by using procedure?

    How to insert one table data into multiple tables by using procedure?

    Below is the simple procedure. Try the below
    CREATE OR REPLACE PROCEDURE test_proc
    AS
    BEGIN
    INSERT ALL
      INTO emp_test1
      INTO emp_test2
      SELECT * FROM emp;
    END;
    If you want more examples you can refer below link
    multi-table inserts in oracle 9i
    Message was edited by: 000000

  • How to delete documents and data off of iphone 4s

    Im trying to free up some room on my phone. I got rid of some apps and movies and did what i can but when i plug my phone in there is more Documents & data then i have as apps and music. i just want to get ride of some documents that are saved in my phone but  dont now hot to delete them.

    Document & Data on iPhone is junks files including browser history, cookies, logs, caches of photos and videos, database files stored by your apps. You’ll notice that some apps while being very small themselves have accumulated a lot of data. An example of this is shown in the image below, you see that the Facebook app is 109 MB whereas the Documents & Data stored is 1.2 GB. This 1.2 GB is what goes into your “Other” data.
    These apps on iPhone don’t provide a way to delete Documents and Data, uninstalling and reinstalling the app is not the best option here. With the help of CleanMyPhone or PhoneClean you can delete the documents and data on iPhone without deleting the app itself.
    Resource: http://www.fireebok.com/resource/how-to-delete-documents-and-data-on-iphone.html

  • How to invoke functions and data type( ex. sflight structure ) that is in t

    Hi,experts,
    I create a funcion(zz_test) that return sflight table type data. I need to invoke the function in the Webdynpro for java application.
    I think I would import the funtion to local.
    But I don't know how to import the function and the data type using SAP NetWeaver Developer Studio?
    But I don't know how to invoke functions and data type( ex. sflight structure ) that is in the R/3 in the WDJ?
    Do you give me some hints?
    Thanks a lot!
    Best regards,
    tao

    Hi Wang Tao,
    For achieving this you need to user Adaptive RFC models.
    This link explains you on the same :
    http://help.sap.com/saphelp_nw70/helpdata/EN/6a/11f1f29526944e8580c5e59333d96d/frameset.htm
    Thanks
    Namrata

  • How to freeze row and column in JTable

    Hi,
    I need to freeze first two rows and columns in a large JTable. I found ways to freeze either a row or a column, but not both at the same time.
    Can any of you help ?
    Found this code which allows freezing a col. Similar method can be used to freeze column
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JViewport;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.JTableHeader;
    import javax.swing.table.TableModel;
    public class FrozenTablePane extends JScrollPane{
    public FrozenTablePane(JTable table, int colsToFreeze){
    super(table);
    TableModel model = table.getModel();
    //create a frozen model
    TableModel frozenModel = new DefaultTableModel(
    model.getRowCount(),
    colsToFreeze);
    //populate the frozen model
    for (int i = 0; i < model.getRowCount(); i++) {
    for (int j = 0; j < colsToFreeze; j++) {
    String value = (String) model.getValueAt(i, j);
    frozenModel.setValueAt(value, i, j);
    //create frozen table
    JTable frozenTable = new JTable(frozenModel);
    //remove the frozen columns from the original table
    for (int j = 0; j < colsToFreeze; j++) {
    table.removeColumn(table.getColumnModel().getColumn(0));
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    //format the frozen table
    JTableHeader header = table.getTableHeader();
    frozenTable.setBackground(header.getBackground());
    frozenTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    frozenTable.setEnabled(false);
    //set frozen table as row header view
    JViewport viewport = new JViewport();
    viewport.setView(frozenTable);
    viewport.setPreferredSize(frozenTable.getPreferredSize());
    setRowHeaderView(viewport);
    setCorner(JScrollPane.UPPER_LEFT_CORNER, frozenTable.getTableHeader());
    }

    Hi,
    I need to freeze first two rows and columns in a large JTable. I found ways to freeze either a row or a column, but not both at the same time.
    Can any of you help ?
    Found this code which allows freezing a col. Similar method can be used to freeze column
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JViewport;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.JTableHeader;
    import javax.swing.table.TableModel;
    public class FrozenTablePane extends JScrollPane{
    public FrozenTablePane(JTable table, int colsToFreeze){
    super(table);
    TableModel model = table.getModel();
    //create a frozen model
    TableModel frozenModel = new DefaultTableModel(
    model.getRowCount(),
    colsToFreeze);
    //populate the frozen model
    for (int i = 0; i < model.getRowCount(); i++) {
    for (int j = 0; j < colsToFreeze; j++) {
    String value = (String) model.getValueAt(i, j);
    frozenModel.setValueAt(value, i, j);
    //create frozen table
    JTable frozenTable = new JTable(frozenModel);
    //remove the frozen columns from the original table
    for (int j = 0; j < colsToFreeze; j++) {
    table.removeColumn(table.getColumnModel().getColumn(0));
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    //format the frozen table
    JTableHeader header = table.getTableHeader();
    frozenTable.setBackground(header.getBackground());
    frozenTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    frozenTable.setEnabled(false);
    //set frozen table as row header view
    JViewport viewport = new JViewport();
    viewport.setView(frozenTable);
    viewport.setPreferredSize(frozenTable.getPreferredSize());
    setRowHeaderView(viewport);
    setCorner(JScrollPane.UPPER_LEFT_CORNER, frozenTable.getTableHeader());
    }

  • How to inserted cells and keep formatting, copy formulas.

    Hi- I used to use Excel in the late 90's and am using Appleworks 6.2.9. Here are my problems that I cannot solve:
    I have an invoice with borders and SUM formulas. How do I insert new cells while maintaining both?
    With Excel I could click on a cell with a SUM formula, then drag down a few rows and release, which would copy the formulas into those cells. I cannot find a way to do this simply.
    Any light you can shed would be greatly appreciated. I'm trying to save money on programs and use what I have.
    iMac G5   Mac OS X (10.3.9)  
    iMac G5   Mac OS X (10.3.9)  

    Great, thanks, that helped w/ the autofill.
    I still need advice on inserting cells that have the same borders and would be entered into the total columns in my invoice. The idea would be to be able to add rows, drop the data down, and not have to reformat any of the SUM cells or borders.
    Thanks!

  • How to display rows of data into different columns?

    I'm new to SQL and currently this is what I'm trying to do: 
    Display multiple rows of data into different columns within the same row
    I have a table like this:
        CREATE TABLE TRIPLEG(
            T#              NUMBER(10)      NOT NULL,
            LEG#            NUMBER(2)       NOT NULL,
            DEPARTURE       VARCHAR(30)     NOT NULL,
            DESTINATION     VARCHAR(30)     NOT NULL,
            CONSTRAINT TRIPLEG_PKEY PRIMARY KEY (T#, LEG#),
            CONSTRAINT TRIPLEG_UNIQUE UNIQUE(T#, DEPARTURE, DESTINATION),
            CONSTRAINT TRIPLEG_FKEY1 FOREIGN KEY (T#) REFERENCES TRIP(T#) );
        INSERT INTO TRIPLEG VALUES( 1, 1, 'Sydney', 'Melbourne');
        INSERT INTO TRIPLEG VALUES( 1, 2, 'Melbourne', 'Adelaide');
    The result should be something like this:
    > T#  | ORIGIN  | DESTINATION1  |  DESTINATION2 
    > 1   | SYDNEY  | MELBORUNE     | ADELAIDE
    The query should include the `COUNT(T#) < 3` since I only need to display the records less than 3. How can I achieve the results that I want using relational views???
    Thanks!!!

    T#
    LEG#
    DEPARTURE
    DESTINATION
    1
    1
    Sydney
    Melbourne
    1
    2
    Melbourne
    Adelaide
    1
    3
    Adelaide
    India
    1
    4
    India
    Dubai
    2
    1
    India
    UAE
    2
    2
    UAE
    Germany
    2
    3
    Germany
    USA
    On 11gr2, you may use this :
      SELECT t#,
             REGEXP_REPLACE (
                LISTAGG (departure || '->' || destination, ' ')
                   WITHIN GROUP (ORDER BY t#, leg#),
                '([^ ]+) \1+',
                '\1')
        FROM tripleg
        where leg#<=3
    GROUP BY t#;
    Output:
    1 Sydney->Melbourne->Adelaide->India
    2 India->UAE->Germany->USA
    Cheers,
    Manik.

  • How to insert Adobe Form Data in the SAP backend?

    Hi there,
    I am very new to Adobe Forms. I am supposed to come up with a working scenario of inserting few form fields into the SAP backend. Is this done through a BAPI call? Or is there any other way for this to achieve?
    I have downloaded trial version of Adobe LifeCycle Designer. But I don't know how to integrate this with the SAP system. Is there anything else that I need to install in my system?
    Is there a document on how to configure all the installations for both local machine and the server (if any)?
    Please help.....
    [I went through the forum for this, but I did not get anything]
    Warm regards,
    Deepak

    hi,
    in the livecycle designer under libary tab u have webdynpro tab--->choose submit to sap button and place it in the adobe form ur designing. u can use this button to trigger the code that u have written in webdynpro java.
    for eg if u have
    a value node details
    and under that two value attr fname,lname
    import the model (Insertdata---it has two import param fname and lname)u need for updating the data to r3 system.
    in the ctrller have a method submit.Here write the code to insert fname and lname into the db.
    IPrivateMyForm.IDetailsElement elem = wdContext.nodeDetails().currentDetailsElement();
    Insertdata_Input input = new Insertdata_Input();
    wdContext.nodeInsertdata_Input().bind(input);
    input.setFname(elem.getFname());
    input.setLname(elem.getLname());
    try
    wdContext.currentInsertdata_InputElement().modelObject().execute();
    wdContext.nodeOutput().invalidate();
    catch (Exception ex)
    { ex.printStackTrace();}
    ul bind details to the datasource.
    when u edit ur interactive ui element these attr(fname and lname) vl be visible under dataview tab u can drag and drop them to the form
    now add submit to sap button in ur form.
    this button correspond to the onactionSubmit dat u have written in the ctrller.
    so wen u click this the data vl be inserted
    Regards
    Jay

  • How to display rows of data in JSP?

    Hi,
    I am learning Servlet and JSP. There is an exercise which requires us to access a database from a Servlet and display the retrieved data in a JSP.
    Now I am ok with the database connection. So how to display the data using some kind of loop?
    Regards

    They're called ResultSets and they are returned when you execute a query from a Statement. The next() method will tell you whether or not you have another row of data to read.

  • How to hide rows without data or all zero?

    Hi.experts:
        I have define a query that using query designer,and I have defined structure for both row and column,and then I have a free chatacteristic,such as 0MATERIAL,if I navigate by material then in each row,the material looks like read all the master data and displayed in the result area.
         How can  I hide these row without data.(or to say all with zero).where to using supress zero etc to avoid this?
         Your quick response is highly appreciated!!Thanks in advance.
    Best Regards
    Martin Xie

    Hi,
    you have the option of suppress zeroes in the properties of the queries where you can give the option whether you want to supress the rows or columns as well which conatains zeroes.
    Thanks
    Ajeet

  • WMS did not transfer SO text row and data availability

    I tested and saw WMS did not transfer sales order Text Row type data to Delivery and Invoice.  How can I add it to Delivery note then will transfer to Invoice?  I will have couple rows to match each item in each SO.  
    Not sure WMS will store Serial number data in their database only since I did not see the shipped Serial number information in SAP now.  Is this normal for WMS software for the Text Row Type be dropped and data only stored in their database.

    Dear Lily,
    I am not sure about the issue.
    First, I would like to ask you what WMS stands for and what it does.
    Second, are you speaking about 2 different issues:
    - the text row is not copied from sales orders to deliveries and to invoices
    - serial number selection not saved?
    Please, give us a clear scenario that we can test and try to reproduce.
    Marcella Rivi
    SAP Business One Forums Team

  • Duplicate rows and data across multiple pages.

    My form has 12 pages (each page = 1 month). With a loop, the pages are hidden until the corresponding button is clicked and it becomes visible (Thanks Assure Dynamics for a great solution to a very long form).
    In Month 1, I have a table with a repeating row. What I would like to do is copy the repreating row and it's data to Month 2. Then I would like to have the table from Month 2, duplicate to Month 3, Month 3 to Month 4 and so on.
    I have been able to get the row from Month 1 to duplicate in Month 2 on the exit event of each cell in the row, however, when you are in Month 2 and do not change a cell which was created in Month 1, the data does not duplicate into the next month (Month 3). Instead of on the exit event of the cell(field), I thought placing it on a button would work but it is not.
    This is what I used on the exit event in the table for Month 1:
    xfa.resolveNode("Month2.Performancegoals2.updates.details[" + this.parent.index + "]").projectName.rawValue = this.rawValue;
    I also thought instead of using a table and a repeating row, I could place the information in a repeating subform but I am still stuck with how to copy the subform and its completed data to the next month.
    I am really stuck and have been looking for hours for a solution. Can anyone help, I am out of time for the deadline of this form.?

    Hi,
    Firstly,you must do the count of the table.
    frmTableBlock.tblTableMonth2._rowItem.count = frmTableBlock.tblTableMonth1._rowItem.count
    frmTableBlock.tblTableMonth12._rowItem.count = frmTableBlock.tblTableMonth1._rowItem.count
    And write the code which is do you want to copy the data Month1 to month12.
    I hope
    S,Candy

Maybe you are looking for

  • Gamma shift

    hello - I'm wondering the best way to deal with the gamma shift problem in Premiere (Mac). Clips appear differently delending on where you're viewing them, for example in the Program viewer colours are more saturated then when you open up the title w

  • Formulas and updating fields

    I have a PDF document that has a bunch of forms to calculate mileage, etc. I have entered formulas into "total" fields, but once i fill in the other fields, the "total" number does not update. Is there a secret trick to making the number automaticall

  • I am not receiving an e-mail to verifie my new password

    Had to change my password I am not receiving an e-mail to verifie my new password now I can't get on to I Tunes to buy any thing Keeps telling me it is not verified but it has let me sign on here Help me plz someone :(

  • Issue with GP getting into Erroneous State

    Hi Experts I have an issue with GP Process getting into Erroneous State. We have a series of steps in the Guided Procedure Process. The process instance passes a few of the initial steps in the procedure and getting struck at a particular step and le

  • How do I move bookmarks imported from internet explorer from the folder so they show when I click Bookmarks

    The imported bookmarks are in a folder whereas if I create a new bookmark in Firefox it just appears when I click bookmarks. How please can I move the IE ones over?