Re: ArrayIndexOutOfBoundsException when updating JTable from SwingWorker

This is a common threading bug and there is a simple fix. You may only modify a visible component from the Event Dispatcher Thread.
You are modifying the table model (which is part of a visible component) from an application thread (the swing worker).
Even through you lock it or something like that, thats not the right way to do it. Don't write to the table model from another thread.
The actual exception is that the EDT thread is painting the table rows while the swing worker is removing table rows, so you have the classic producer/consumer thread problem. The fix is not to use locks but instead use the Swing single thread rule, which is that only the EDT thread may modify a visible component. There is a lot of info on the java tutorials about swing threading.

Thanks a lot, for some reason I neglected to try using SwingUtilities.invokeLater in my attempts to fix the problem! This has solved it.

Similar Messages

  • Error when updating pages from template

    When updating pages from a template I have been occasionally
    getting this error message:
    While executing onLoad in Swap Image.htm, the following
    JavaScript error(s) occured:
    At line 325 of the file "Hard Drive: Applications: Macromedia
    Dreamweaver 8: Configuration: Behaviors: Actions: Swap Image.js":
    Reference Error: createObjRefs is not Defined
    I am on a Mac running 10.3.9, Dreamweaver 8.02.2809
    Any ideas on how to fix this?
    Thanks,
    Paul

    When updating pages from a template I have been occasionally
    getting this error message:
    While executing onLoad in Swap Image.htm, the following
    JavaScript error(s) occured:
    At line 325 of the file "Hard Drive: Applications: Macromedia
    Dreamweaver 8: Configuration: Behaviors: Actions: Swap Image.js":
    Reference Error: createObjRefs is not Defined
    I am on a Mac running 10.3.9, Dreamweaver 8.02.2809
    Any ideas on how to fix this?
    Thanks,
    Paul

  • When updating itunes from 10.0.1.22 to anything higher, my network card stops working, HELP!

    When updating itunes from 10.0.1.22 to anything higher, my network card stops working, HELP!
    I have an iPhone 3gs, and a work iPhone 4 on iOS 4.3.3.  I want to sych with iTunes but clearly must upgrade to >10.1
    When I do, my network card no longer works on my desktop.  Please HELP!
    My spec is;
    NETWORK CARD;

    polydorus wrote:
    This isn't my thing, but the following post on this seems to have helped some people:
    http://discussions.apple.com/thread.jspa?messageID=12622179#12622179
    That's the go-to advice with this one, p. (I certainly don't have much to offer beyond it, but it does a superb job in the vast majority of instances.)

  • Flicker when updating jTable

    I have an application using a jTable. When updating this jTable with a new row there is some annoing flicker - especially if i have many rows in my table.
    Seems like when swing is repainting i have the last marked line twice in the table, both on top an in the bottom. It gives a lot of distraction for the users trying to key in payments.
    My guess is it is happening when swing is repainting the table (it is apparently outside my application). My tablemodel is extending the abstractTableModel.
    Does anybody have any good suggestions to get rid of this???

    Thanks everyone for the feedback.
    I just did a day's worth of testing using C# and .NET for Windows Mobile (in Visual Studio 2005) and was able to reproduce the same interface without any flickering issues. Not having to poll the device's hardware buttons is also a positive
    The key is to override the main form's OnPaintBackground() method.
    From "Crafting Smartphone User Interfaces Using .NET Compact Framework":
    OnPaintBackground
    This method needs to be over ridden to prevent the OS from repainting the background each time the user navigates the ListView, causing flicker. If you don't need a background then just override this method but provide no implementation.
    So it looks like I'll be doing things in C# for this project. As the mobile device won't be used for data acquisition, the Mobile Module isn't a necessity. I just hope .NET's serial functionality is as good as LabVIEW's!

  • Updating JTable From List

    hi all
    i am having trouble updating a jtable from a list.
    the table is declared as follows
    //TableTracks.java
    String[] columnNames = {"Track Number",
      "Mute",
      "File/Track Name",
      "Number of Loops",
    Object[][] data = {
    {"1", "0", "", "1" , },
    {"2", "0", "", "1" , },
    {"3", "0", "", "1" , },
    {"4", "0", "", "1" , },
    {"5", "0", "", "1" , },
    {"6", "0", "", "1" , },
    {"7", "0", "", "1" , },
    {"8", "0", "", "1" , },
         final JTable table = new JTable(data, columnNames);I would like to select a value in a List by using the arrow keys, then when pressing enter key the selected List value appears in a cell in the table.
    The list works fine for me, i get a Listvalue string from the following method
    //Part of FileList.java
    //tableTracks class constructor
    TableTracks tableTrack = new TableTracks();
    public void keyReleased(KeyEvent e) {
    switch(e.getKeyCode()) {
    case KeyEvent.VK_ENTER:
       value = jlst.getSelectedValue().toString();;
       if (value.endsWith(".wav"))
       iNameLen = value.length();
       value = value.substring(iEntryType,iNameLen);
       System.out.println("sending..... " + value);
       tableTrack.insertValue(value);
       break;
    }So far so good! in the above i call the insertValue method and below is that method
    //TableTracks.java
    void insertValue(String file)
      System.out.println("insertVal: " + file);
       table.setValueAt(file, 3, 3 );
    }in both of the system.out.println statements in the above 2 methods, the correct value is displayed. But it simply will not display the vlaue in the table.
    Before i added the List option to my program, i had it working by allowing the user to select a file name using a FileChooser. With this method, the table.setValue worked fine. But now, it will not.
    Any help or suggestions would be very greatly appreciated.
    cheers
    RC

    You probably defined the "table" variable twice. Once as a class variable and once as a local variable and your "insertValue" method is referring to the wrong variable and therefore updating the wrong table.

  • Update Jtable from access database

    as the title suggests help me guys... till now i have a database and some contents in it.. when the application starts the table is filled with contents of the database.. now whenever i add or remove a row in the databse i want to show it in the table... i have a Vector called dbData with the present contents of the database.. i want to update jtable with contents of dbData.... how to do it??

    the best things i can see to do is
    JTable table = new Jtable(.....); // this was ur table before;
    deleteRow(table); // you deleted the row
    // now you have a vector containing all the data for the rows;
    // but you need a vector containing the columns for the rows too
    //so now you do
    table = new JTable(dbData,columnnames);
    repaint();dbData must be a vector of vectors;
    dbData.elementAt(1) return a vector with all the data for row one
    so dbData.elementAt(1).elementAt(1) will be the data for row 1 column 1
    // dbData will be the data still remaining in the table
    or instead of the above you could use a nested for loop and set each element one at a time
    Object temp;
    int numberofRows = dbData.elementCount();
    int numberofColumns = db.elementAt(0).elementCount();
    for(int row = 0; row < numberofColumns;row++)
    for( int column = 0; column < numberofRows; column++)
      temp = dbData.elementAt(row).elementAt(column);
      table.setValueAt(temp,row,column);
    }

  • Any way to turn off errors when updating pages from the template?

    I'm using Dreamweaver MX. My site is huge. It's an intranet
    spanning dozens of departments. Some of those departments have
    subsites that don't fall under the intranet's control, although
    they are embedded within our site's folder structure. When I make a
    change to the template and update pages, every time I hit one of
    those subsites I get tons of errors, from "template not found" to
    "unmatched body tag". The errors that pop up each have to be
    clicked on before the updating can continue. I get hundreds of
    these.
    Is there any way to make errors not pop up while updating
    pages from the template? Or even to exclude certain folders from
    being checked? (Cloaking doesn't do it.)

    > I'm using Dreamweaver MX. My site is huge.
    Both of these are problems, I'm afraid. Combining that with
    templates is
    really trouble.
    > "unmatched body tag".
    Errors such as this are definitely caused by errors in your
    page itself.
    Can you show me a page where you would get this?
    > Is there any way to make errors not pop up while
    updating pages from the
    > template? Or even to exclude certain folders from being
    checked? (Cloaking
    > doesn't do it.)
    Valid code will not produce these errors. Unfortunately, the
    only way to
    avoid them is to remove any validation hiccups from your
    pages.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "abna" <[email protected]> wrote in message
    news:f14ue2$pk5$[email protected]..
    > I'm using Dreamweaver MX. My site is huge. It's an
    intranet spanning
    > dozens of
    > departments. Some of those departments have subsites
    that don't fall under
    > the
    > intranet's control, although they are embedded within
    our site's folder
    > structure. When I make a change to the template and
    update pages, every
    > time I
    > hit one of those subsites I get tons of errors, from
    "template not found"
    > to
    > "unmatched body tag". The errors that pop up each have
    to be clicked on
    > before
    > the updating can continue. I get hundreds of these.
    >
    > Is there any way to make errors not pop up while
    updating pages from the
    > template? Or even to exclude certain folders from being
    checked? (Cloaking
    > doesn't do it.)
    >

  • Develop/Map model disabled when updating Lightroom from disk

    Hello,
    I got a disk for Lightroom 5.2 and entered the product key after instillation.  However, when updating to 5.7 the develop and map models become deactivated and it says I must renew my membership.  I regestered my product key with Adobe.com and re-installed but the error persists.  Am I not able to upgrade my Lightroom even though I own a disk with the program?
    Has anyone run into this issue before or familiar with what is going on?
    Thanks,
    Michael

    uninstall your lr.
    use the below link to dl lr 5.7.1 and install using your password.
    Downloadable installation files available:
    Suites and Programs:  CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4, CS4 Web Standard | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  13 | 12 | 11, 10 | 9, 8, 7 win | 8 mac | 7 mac
    Photoshop Elements:  13 |12 | 11, 10 | 9,8,7 win | 8 mac | 7 mac
    Lightroom:  5.7.1| 5 | 4 | 3
    Captivate:  8 | 7 | 6 | 5.5, 5
    Contribute:  CS5 | CS4, CS3
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.

  • Update JTable from String[][]

    Hello everyone, I have a JTable with a slightly customized DefaultTableModel shown below:
    DefaultTableModel tableModel = new DefaultTableModel(rowData, columnNames){
         private static final long serialVersionUID = 8655602888381735851L;
         @Override
             public boolean isCellEditable(int row, int column)
                         return false;
              };rowData is a String[][] of my data. When a user clicks a button, they add a row of data to the String[][]. I am wondering how I can update the JTable to reflect this change in the String[][]. Thanks!

    The problem with that is that I'm going to be performing various searches through the data, and those searches are performed on a TreeMap.
    rowData gets its data from the TreeMap, and is then displayedThe active verb does not describe the situation accurately: according to your code, rowdata is merely built from the TreeMap instance, and stuffed into a DefaultTableModel for display.
    When the user adds data, they add it to the TreeMap so that it can be searched.
    I can easily convert the data from the TreeMap to the String[][], but I don't know how to "redraw" the table with the new data.I assume the data is too big to repeat the process each time the user adds a row (build the new String[][], wrap it into a new DefaultTableModel instance and set the instance as the table's model).
    Another way is to duplicate the structure: when the user adds a row, add it into the searchable collection, and into the table model. But this costs twice the memory, and, again, I assume your data set is too large.
    A third, probably more elegant way is to build your own TableModel implementation: it could store a reference to the TreeMap instance, and an array converting the table's row index values to the tree's key value. That way the table model can be described in the active mode:
    "the JTable asks the model for cell values, and the model asks the tree for the corresponding data" :o)

  • How to update jTable from user input?

    I create one jTable with 2 rows and 3 columns. the jtable colums contains deviceIP and Status. I am getting device IP from user input through jTextfield. so, when user enter IP and click add button, it must added in the jTable rows one by one.
    how can I add it by user enter the IP. Also, I want to update the status column value by "UP" or "DOWN" by just getting string value from other function.
    but, my problem is i need to update the correct IP status value to correct column (ie., I want to put IP 1(row 1) status to column 1 in status column list.
    I don't know about jTable .
    If any one have any examples please give me.

    use
    ((DefaultTableModel)jTable.getModel()).addRow(Object[]);
    Object[] is the array of row data values you want to insert;

  • Update JTable from a JDialog

    I'm wanting to update a JTable I have on a JFrame. This JFrame has a button on it which opens a JDialog box which populates a database. The main JFrame's JTable (ReceivedTable) holds this information. When a user inputs some more information and closes the dialog, I'd like to update the JTable in the main JFrame, but am not sure how to go about doing this. Can someone give me an idea to work from.
    Thanks.

    G'day mate,
    Make an extension of JDialog like so:
    //import appropriate classes here
    public class MyDialog extends JDialog implements ActionListener {
         //you would have some text fields or such here
         public MyDialog(Frame parent, String name) {
              super(parent, name, true);
              JPanel cp = (JPanel)getContentPane();
              //cp.add(fields here!);
              JButton submit = new JButton("Submit");
              submit.addActionListener(this);
              cp.add(submit);
         public void actionPerformed(ActionEvent ae) {
              Vector data = new Vector();
              //populate 2d data vector with data for the table
              Vector column_names = new Vector();
              //names for your table columns
              ((DefaultTableModel)((JFrame)getOwner()).getTable().getModel()).setDataVector(data, column_names);
              dispose();
    Note: In your JFrame you will need to define a method getTable().
    I think that should work for you... Obviously you'll have to add in a lot of code yourself, but that should be a reasonable skeleton.
    Good luck,
    Muel.

  • Adobe Bridge CS4 pops error when Update Option from Help is launched

    Hi All,
    when i m trying to Launch the Update from the help menu of Adobe Bridge it pops-up with a error messge instead of launching update.
    The error says
    Adobe Bridge
    Bridge is not in a position to check for updates.
    The cause of the error may lie in the fact that an Internet connection can be established or that you are logged in as a user without administrator privileges.
    Ok
    Please help what is the probable cause for this.
    I have tried disabling the updateoption by
    1) Adding the Enterprise DWORD value in registry HKLM\Software\Adobe\Updater
    2) Adding the "Update" "Suppress" value in "Application.XML.Override" file while installing the CS4 Suite
    I am using  Vista Build is the behavioural diff seen on XP n Vista
    Thank You

    Hey
    Apologies I dont think I had made myself clear.
    I am trying to package Adobe Photoshop CS4 which has Adobe Bridge as a component. As per the company standards, I am suppossed to be deploying this package & installing it using silent setup. Since this is a corporate environment, they do not want any auto updates to be enabled, as well as disable all menu items related to updates. Hence I had checked through the Adobe Support Site and followed the instructions provided by using the Adobe Deployment Toolkit and supressed the updates using the tool.
    Inspite of following the steps mentioned in the Deployment Kit and the guides associated with it, I was unable to supress the Updates options that reflects under Help Menu for Adobe Bridge CS4. All the other associated programs like photoshop, Extend Scripts etc the updates are disabled. The problem seems to be only with the Adobe Bridge Update.
    I have also tried disabling the update option by
    1) Adding the Enterprise DWORD value in registry HKLM\Software\Adobe\Updater
    2) Adding the "Update" "Suppress" value in "Application.XML.Override" file while installing the CS4 Suite
    Inspite of trying the above steps the update option in the menu is still enabled and when I click on the updates menu item I get the following error message.
    Adobe Bridge
    Bridge is not in a position to check for updates.
    The cause of the error may lie in the fact that an Internet connection can be established or that you are logged in as a user without administrator privileges.
    Ok
    Please advise,

  • Update jtable from other window

    Hi !
    I have a jtable in window #1.
    When choose row I opened window #2.
    In window #2 I update sme details and want the
    table in window #1 to update.
    How can I do it ?
    Thank you for your help

    hi,
    1. In Win2 make a 'linked' object-variable to Win1, like:
    puplic javax.swing.JFrame Win2 extends JFrame{
       //* as type the class of your own win1! not a common window (javax.swing.JFrame)!
       private Win1 myWin1 = null;
       public Win2(Win1 parWin1){ window javax.swing.
          this.myWin1 = parWin1
    }2. Make a public getter-methode for your JTable in Win1
    puplic javax.swing.JFrame Win1 extends JFrame{
       private javax.swing.JTable myTable1 = null;
       public javax.swing.JTable getJTable(){
          return this.myTable1;
    }3. call your win2 with the new constructor
       Win2 myWin2 = new Win2(this);
       myWin2.show();4. Now you can work in Win2 with your JTable with
       ... this.myWin1.getTable1.....cu
    Oliver SCORP
    ps: normally you don't have to update your JTable - you have to do this with the (Data) Model of your JTable

  • PLS-00327 when updating table from a remote table inside a PLSQL procedure

    Hi,
    Inside a PL/SQL procedure,I want to update a table from a remote table :
    begin
    UPDATE rachel1 set NEW_TEN_CODE =
    (SELECT NEW_TEN_CODE FROM rachel@REFI
    WHERE rachel1.OLD_TEN_CODE=rachel.OLD_TEN_CODE@REFI);
    end;
    I receive the error :
    PLS-00327: "RACHEL" is not in SQL scope here
    When I extract the update from the procedure and I run from SQL (without begin ... end), it works :
    SQL> UPDATE rachel1 set NEW_TEN_CODE =
    2 (SELECT NEW_TEN_CODE FROM rachel@REFI
    3 WHERE rachel1.OLD_TEN_CODE=rachel.OLD_TEN_CODE@REFI);
    So, why doesn't the update work inside the PL/SQL procedure ?
    What have I to do ?
    I need to run this command inside the procedure.
    Regards,
    Rachel

    Hi,
    Yes, the owner of the procedure have select on RACHEL@REFI.
    My oracle version is : 8.1.7.4.
    In fact, I've resolved the problem by doing :
    begin
    UPDATE rachel1 set NEW_TEN_CODE =
    (SELECT NEW_TEN_CODE FROM rachel@REFI
    WHERE rachel1.OLD_TEN_CODE=rachel.OLD_TEN_CODE);
    end;
    Regards,
    Rachel

  • HT201210 Error when updating iPhone from 5.1.1 to iOS 6.0

    When I tried to update my iPhone software from 5.1.1 to iOS6, it said there was an error.  Then it said I needed to restore my iPhone.  I pushed update and restore, and it keeps giving me an error.  My iPhone is essentially wiped out and not usable because it shows iTunes with the cord logo on my phone.  I've tried this several times to restore.  What do I do?

    http://support.apple.com/kb/TS3694#error3194

Maybe you are looking for