How can i update data in JTable at run time ?

i am trying to build a client/server architecture for conducting quizzes & online tests.. My client will return a object to the server after the test is over, which contains details about the participant, his score and other details. i am putting the incoming object to an Vector. I'll create a new thread each time for the incoming connection and insert the object to the Vector.. Now, please tell me tat, how can i update my table automatically at run time so tat, my table is updated whenever a new object is entered into vector..
here is my code for the table..
public class MyTableModel extends AbstractTableModel {
    String columNames[] = { "ID", "NAME", "COLLEGE", "SCORE", "CELL" };
    /** Creates a new instance of MyTableModel */
    public MyTableModel() {
        Main.List = new Vector();
        SetDefaultData();
    public int getRowCount() {
        return Main.List == null ? 0 : Main.List.size();
    public int getColumnCount() {
        return columNames.length;
    public String getColumnName(int column) {
        return columNames[column];
    public boolean isCellEditable(int row,int col) {
        return false;
    public Object getValueAt(int rowindex, int columnindex) {
        if(rowindex < 0 || rowindex >= getRowCount())
            return "";
        Student row = (Student)Main.List.elementAt(rowindex);
        switch (columnindex)
            case 0 : return row.id;
            case 1 : return row.name;
            case 2 : return row.college;
            case 3 : return row.score;
            case 4 : return row.cell;
        return "";
    public String getTitle() {
        return "Student Table";
    private void SetDefaultData() {
        Main.List.removeAllElements();
        Main.List.addElement(new Student("CS041","Keerthivasan M","MNM",95,"9884326321"));
        Main.List.addElement(new Student("CS012","Arun M","MNM",90,"9884825780"));
        Main.List.addElement(new Student("CS019","Balaji S","MNM",79,"9841742068"));
        Main.List.addElement(new Student("CS005","Anand R","MNM",89,"9884130727"));
        Main.List.addElement(new Student("CS045","Manish J","MNM",55,"9841624625"));
        Main.List.addElement(new Student("CS013","Mangal S","MNM",5,"9841961742"));
}

In the future Swing related questions should be posted in the Swing forum.
how can i update my table automatically at run time so tat, my table is
updated whenever a new object is entered into vector..You don't update the Vector directly. You should be creating a method in your TableModel, called "addRow(...)". This method will do two things:
a) add the Student object to the Vector
b) invoke the fireTableRowsInserted(..) method of AbstractTableModel. This will cause the table to be repainted.

Similar Messages

  • How can we update data in LDAP server using PL/SQL.

    Hi,
    How can we update data in LDAP server using PL/SQL program.
    Is there any sample code for refrence.
    Thanks,
    Tarun

    Hi Justin,
    Thanks for your help. You got my correct requirements.
    Tim's example returning all the attributes of current user which is admin user. Please correct me if I am wrong.
    I have the following information:
    the admin user and password,server info , port and ldap_base for admin.
    I have uid and password for regular user, I am trying find the ldap_base for regular user, which may be different from adminuser.
    Please help me.
    Thanks,
    Edited by: james. on Jan 12, 2009 5:39 PM

  • How can i update data in okc_k_items and csi_item_instances tables?

    How can i update data in okc_k_items and csi_item_instances tables?
    by EBS .
    Thanks.

    For csi_item_instances table, you can use the following API:
    CSI_ITEM_INSTANCE_PUB.UPDATE_ITEM_INSTANCE
    For okc_k_items, try using the following API:
    OKC_CONTRACT_ITEM_PUB.UPDATE_CONTRACT_ITEM
    Hope this helps!

  • HT3275 how can i retrieve information from  time machine if my computer has less storage capacity? How can I access data that is on my time machine but can not be copied to a computer with less storage capacity? I used to have 180 GB, now I have 128 GB.

    how can i retrieve information from  time machine if my computer has less storage capacity? How can I access data that is on my time machine but can not be copied to a computer with less storage capacity? I used to have 180 GB, now I have 128 GB.

    Plug an external drive into the computer and use that to expand data onto.
    http://pondini.org/TM/16.html

  • How can i see Log information of Report Run Time?

    Hi Gurus,
    How can i see Log information of Report Run Time?, till now i am counted report run time manually. Is there any way i can see the workbook running time in log information?.
    Thanks & Regards
    Vikram

    There could be a few things -
    At one time, you needed to run a separate script to create the tables. I'm not sure that is still the case. If you check the Administrators guide, look into the chapter that deals with the EUL Status Workbooks.
    If you are not logged on as the eul owner, you may not have select privileges, or you may need to qualify the table with the schema (if there is no synonym) - select * from <eul_owner>.EUL5_QPP_STATS;
    If you are on 4i, the table is EUL4_QPP_STATS

  • How can i update data of DSO and Cube using ABAP??

    Hello Experts
    I have a requrement in which i need to update/ delete data from DSO and cube based on certain keys using ABAP.
    Please let me know how can i modify contets of cube or active table of DSO.
    Thanks
    Sudeep

    Hi
    I have requirement such that i need to update certain key figures in DSO after certain time.
    for eg. say record with key a is loaded to DSO and currospoding key figure was loaded with value 10
    after few days because of certain parameters changing in system i need to modify key figure value.
    currently i am doing same using 1 self transformation i.e. by loading same data again in same DSO.
    Amount of data is very huge and causing performance issues in system.
    now A is not key but i need to modify record for few combinations which apperar multiple times in DSO.
    Same DSO data is loaded into Cube regularly.
    I may need to update data after gap of few weeks as well.
    This design will be used as template and needto keep whole logic generic.
    So wring Function module can make it generic.
    Thanks
    Sudeep

  • How can I update data fields in a merged document ?

    Hi,
    I'm looking for a way to update the values of data fields in a merged document with a script just as you can do with the user interface.
    I don't find any method like "updateDataFields ()" in the DataMerge object.
    Si I try to invoke the menu action "Update Data Fields", but it fails. The script error message is: "Error 53762, the script is not active." On the contrary, the action works if I use the interface.
    Can anyone help me?
    Thanks in advance,
    FredIsnard
    PS : I work with CS5.5 and JavaScript.

    Hi!
    You might be looking for this one:
    DataMerge.mergeRecords (outputOversetReportFile: File )
    Merges records and produces an optional overset report.
    outputOversetReportFile: Data Type: File
    The path to the file in which to store the overset report. (Optional)
    Best regards,
    Andreas

  • How can I use undo and redo with run time menu?

    Hi..I try to built my own menu for graphic programming. How can I use undo and redo in labview with run time menu?

    filozof-
    During runtime, by default, LabVIEW has undo/redo data changes under the edit menu. This will undo/redo changes made to controls during runtime. If you want a more extensive undo/redo (custom for your application), you are going to have to do quite a few things
    1) Create a custom runtime menu (Edit>>RunTime Menu) and place your own undo/redo controls on it
    2) Keep an action history in your program
    3) Catch the Shortcut menu event for your custom undo/redo controls
    4) Reverse the last action in your histroy when you catch the event
    This method would allow you undo entire operations (like resize, move, or whatever kind of functionality you are building into your application) unstead of just undoing data changes.
    Xaq

  • How can i assign view page name at run time in task flow

    Hi,
    jdev 11.1.2.3.0
    I have a requirement to get view page (jsff page) dynamically.
    Ex: I have TF in that i have two views i.e view1 and view2. in view1  there is one inputtext and button in inputtext i will give the name of the page, In view2 that particular page should be displayed.
    Input Text                 View2
    Employee                Employee Page
    Department              Department Page
    How can i implement this ?
    Thanks,
    Nitesh

    Use a router in your task flow and point to the page you want to display according to the value entered in the input text.
    A sample on how to use this technique can be found here http://tompeez.wordpress.com/2011/11/27/jdev-11-1-2-1-0-using-router-to-conditionally-set-navigation-target/
    Timo

  • How can i gather data from jtable!

    hi!
    in fact i am trying to gather all the rowdata from my table sothat i can insert thel into my databse !
    could you plkease tell me how to deal with this?
    thanks

    As a simple case, let's assume that your JTable's column header names are in the same order as the columns in the database table to which you want to insert the JTable data. Also, let's assume all your table values are Strings.
    You'll need to do something like this (sorry if there are syntax errors - I'm not coding in an IDE...!):
      String tempStr = "insert into table_name values (";
      StringBuffer sb = null;
      Statement stat = dbConnection.createStatement();
      for (int i=0; i<tableModel.getRowCount(); i++) {
        sb = new StringBuffer(tempStr);
        for (int j=0; j<tableModel.getColumnCount()-1; j++) {
          sb.concat("'").concat(tableModel.getValueAt(i, j)).concat("', ");
        // for the last column
        sb.concat("'").concat(tableModel.getValueAt(i, tableModel.getColumnCount()-1)).concat(");");
        // your sb object now has the entire insert statement to put in the database
        stat.executeQuery(sb.toString()) ;
      }If the JTable columns are not in the same order, then you'll need to modify the above code to build your sql statement with the explicit column order you need.
    I hope this helps.
    Cheers!

  • How can I Update Data Plan payment details?

    How do I edit the card information being billed monthly for the 3G service?

    Go to [http://www.att.com/ipad|http://www.att.com/ipad]. Click "Add Data Now" on the right. Logon to your account (or sign up if you don't have an logon. It's free.) Click "Edit User & Payment Information."

  • How can I perform data logging for a specific time??

    hello everyone,
    I am quite new in labview and I have a basic question regarding data logging. Currently I am using a cRIO9074 and doing some data logging for my test. The data logging it self works ok so far.
    But my problem is I would like to write my datas in a text file either for a specific time interval (ex)10 seconds) or for a specific amounts of data (ex)500 Samples). Can anyone give me some help regarding my problem?? Attached you can find my RT.vi 
    I would appreciate for anyhelp!
    Regards
    Yun 
    Attachments:
    BP250 Encoder Position & Velocity (Host).vi ‏92 KB

    Run your loggging program for that time. When your program terminates then it will write all the logged data so far in text file.
    Kudos are always welcome if you got solution to some extent.
    I need my difficulties because they are necessary to enjoy my success.
    --Ranjeet

  • TA24326 How can I update Apple software for PC running Windows 7?

    I'm still working on getting the iTunes Store to open from iTunes.  Perhaps I need to update some of the software that is not included with iTunes download.

    I get the "Accessing iTunes Store" message iTunes crashes and the message "iTunes has stopped working and must close"  "Close Program"
    Which particular version of iTunes are you running?
    To check if it's an 11.0.x of some description, first bring up your Menu Bar. Click on the wee boxy icon up in the top-left corner of your iTunes to see the "Show Menu Bar" control, as per the following screenshot:
    Now go "Help > About iTunes" and wait for the version number to scroll up from the bottom of the screen. (For example, mine says 11.0.2.25.)

  • How can I recover data that was overwritten by time machine?

    I have a 2 TB external hard drive on which I had archived a lot of video and data files.  I hooked it up to my MacBook Pro thinking that I could also utilize time machine.
    It asked me something ot the effect of "Would you like to use this drive for time machine" (I don't really remember what it asked), but I clicked on 'yes' or 'continue' or whatever and before I knew it, it had erased my hard drive and backed up my MacBook Pro.
    Is there a way to recover that data?
    With fingers and toes crossed.......thanks for any help.
    Mark Rabalais

    Not unless you had a backup of the previous contents on that drive?
    You could try a commercial data recovery suite, but since the TM backup will have overwritten much or all of what was on there previously, the odds of recovering intact and useable files is very small.
    Sorry, but I would say, no, it is gone at this point.

  • Help please - how can i change a file extension at run time

    hi all
    i have a question about file created on the run. for instance, if i need to create a file initially with a an extension of '.in'. and there are some processes writing data to it, and after the file is written. i need to change it to some thing like '.out'. is it possible to do this? can u please provide some samples if you have any solution or suggestion. thanks.

    do u have the links of these tutorials?IO tutorials...
    http://java.sun.com/docs/books/tutorial/essential/io/index.html

Maybe you are looking for

  • Not told of all charges, lack of Netflix promo code and major run around trying to sort it out...

    I recently signed up for Fios almost a month ago, installed myself and just received my first bill. My apartment's "rep" told me if I installed it myself I wouldn't be charged an install fee. He failed to tell me there was an activation fee of $69.99

  • Linux and the Sound Blaster Live

    Ive got my hands on a SB Li've 24bit external sound card and after some fiddling around I seem to only have standard stereo and no 5. Audio. My question is has anyone got these things to output 5. on Linux yet. I'm going to have to return it back to

  • Kernal Panic - any help?

    Hi I got a KP shut down today. Wondering if anyone can help. It happened when I closed Quicktime 7 (which I use regularly). No third-party RAM, nothing else fishy that I know of (lastest version of flash, etc). I also have problems with the computer

  • HT1926 My .msi file is missing, and I can neither download nor uninstall iTunes. Can someone help?

    When I tries to update my existing iTunes, I could not do it because I did not have the .msi file it needed. So I tried to uninstall, but I can't even do that because of that missing file. Could anyone please help me? I'm getting desperate here, and

  • How to delete desktop photo

    I am new to iPhoto6 and while experimenting with it I selected a JPEG pix, cropped it then hit DONE. The pix disappeared from iPhoto and went directly to my desktop, uncropped. I cannot find this pix in any of my files or folders so I can delete it.