Can I modify a table model outside of the event thread if it's not seen?

I have a JTable that I use to display several table models (I'm extending DefaultTableModel); I switch between the models using JTable.setModel.
If model A is active and currently being viewed, I of course make sure any updates are done using SwingUtilities.invokeLater().
My question is: Can I modify an "inactive" table, say table B, without using invokeLater(), for example B.setValueAt() etc.

Isn't a model connected to an instance by JTable.setModel()? (Or by passing the model as a parameter in new JTable()) Yea. I meant connected to a JTable's UI. Or more specifically, listeners are installed on the model.
if data is changing and the user is not currently viewing that data, I want to change the table model in another threadI would argue that this is thread safe:
1) When a table becomes 'inactive' (not showing in any way) then you set the model to some static empty one.
table.setModel(EMPTY_MODEL);This should happen on the EventDispatchThread. Setting the model to the empty one will uninstall all the listeners on the actual model.
2) Freely modify the table's actual model in another Thread.
3) When the table is about to become 'active', then you set the model back to the original one.
table.setModel(originalModel);This should happen on the EventDispatchThread. In particular, the other thread should execute it with an invoke later. That way, proper synchronization occurs and the EDT sees all the changes made to the original model.

Similar Messages

  • In Address Book, how can i modify several contacts (several cards) at the s

    Hello,
    In Address Book, how can i modify several contacts (several cards) at the same time ?
    for exemple : I have 100 contact which live in Paris, I select all of them together, but when I put "Paris" in the field "city", it puts "Paris" only in the fisrt contact !
    how to edit several contact at a time ?
    And I would like to put some kind of "tags", or words, in "remark", also by selecting several contact and edit them together...
    Thanks by advance !
    Alexandre.

    Welcome to the discussions, Alexandre1975 et bonjour.
    Just using Address Book this can't be done, but if you are prepared to try a little Applescript it is easy. This script will set the city for example - but only if there is already an address.
    AK
    click here to open this script in your editor<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">tell application "Address Book"
    set ContactList to the selection
    repeat with ThisOne in ContactList
    set city of first address of ThisOne to "Paris"
    end repeat
    end tell</pre>
    (The recent upgrade to the discussions has disabled the link that allows direct opening of a script, so run Script Editor and copy in the script.)
    Message was edited by: Austin Kinsella1

  • HT1904 How can I get a refund for apps in the apple App Store that do not work and are not what they said they wer

    How can I get a refund for apps in the apple App Store that do not work and are not what they said they wer

    You've tried deleting and redownloading them and seeing if they then work and tried contacting the developers ? If you have and they can't/won't help then try the 'report a problem' page to contact iTunes Support : http://reportaproblem.apple.com
    If the 'report a problem' link doesn't work then you can try contacting iTunes support via this page : http://www.apple.com/support/itunes/contact/- click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • If I have a repeating event in iCal, can I attach different docs, pdfs, etc., do the events. I am entering lessonplans and want each date to have an attachment.

    If I have a repeating event in iCal, can I attach different docs, pdfs, etc., do the events. I am entering lessonplans and want each date to have an attachment.

    Yes. As you edit each one, you will get a dialog asking whether you want to change all or just the current one.

  • I am so confused.  I just downloaded Itunes.  I set up an Apple ID with a password.  Now I want to purchase a song.  I can't do it.  I keep getting the message: This Apple ID has not yet been used with the Itunes Store.  What am I doing wrong?

    I am so confused.  I just downloaded Itunes.  I set up an Apple ID with a password.  Now I want to buy a song.  I can't do it.  I keep getting the message: "This Apple ID has not yet been used with the Itunes Store.  What am I doing wrong?

    You haven't opened an account with that Apple ID in iTunes. Open iTunes and log in. A dialog will appear in which you need to enter your Apple ID and/or password. Below it you should see a link for creating a new account. Click on that link to get started.

  • I have a new iPod and now I can't buy something on it ,because of the safety questions. I have not the answers. I can't remember that answer the questions.

    I have a new iPod and now I can't buy something on it ,because of the safety questions. I have not the answers. I can't remember that answer the questions.

    Frequently asked questions about Apple ID - http://support.apple.com/kb/HE37 --> Can I change the answers to the security questions for my Apple ID?  --> Yes. You can change the answers to the security questions provided when you originally signed up for your Apple ID. Go to My Apple ID (http://appleid.apple.com/) and click Manage your account.
    Forgotten security questions - https://discussions.apple.com/message/18402551  and https://discussions.apple.com/message/18625296
    More involved forgotten question issues - https://discussions.apple.com/thread/3961813
    Kappy 09/2012 post about security questions - https://discussions.apple.com/message/19569468
    John Galt's tips (09&11/2012) - https://discussions.apple.com/message/19809294 and https://discussions.apple.com/message/20229239
    If none of the above work, contact iTunes Support at http://www.apple.com/support/itunes/contact/ and follow the instructions to report the issue to the iTunes Store.

  • All of a sudden, I can't watch any of my films from the Event Library, it also says 'Source Clip is missing' in the other window, I haven't even touched anything that I know of?

    All of a sudden, I can't watch any of my films from the Event Library, it also says 'Source Clip is missing' in the other window, I haven't even touched anything that I know of?

    Hi
    I haven't even touched anything that I know of?
    And You've not moved or emptied any folder on Your Hard Disk named
    • iMovie Event's - or -
    • iMovie Project's
    Or - disconnected any external hard disk/s
    As one CAN NOT move the Event's or Project's on / via DeskTop/Finder - AS iMovie then loses the connection to them. Moving them - MUST BE DONE - within iMovie application - to work OK.
    So if You by meaning or accident moved it/them - Move them back - and iMovie might work again.
    ELSE - If You are 100% sure that You didn't move them then
    • Trash iMovie Pref and Cache files
    • Run Repair Permissions - Disk Util tool
    • Run Repair Hard Disk - Disk Util tool - BUT YOU MUST Start-Up Your Mac from DVD or External HD to do this
    and may be all will work OK again
    Yours Bengt W

  • Can't access my ipad, comes up with the following message on screen "Ipad not backed up. this ipad hasn't been backed up. Backups happen when this ipad is plugged in, locked and connected to wifi".

    can't access my ipad, comes up with the following message on screen "Ipad not backed up. this ipad hasn't been backed up. Backups happen when this ipad is plugged in, locked and connected to wifi".

    Try a Reset  ( No Data will be Lost )
    Press and hold the Sleep/Wake button and the Home button at the same time for at least Ten seconds... (But can take Longer)... until the Apple logo appears. Release the Buttons

  • Executing Code outside of the Event Dispatcher Thread

    Hello,
    I have just come to learn that any actionPerformed() method that is called after an event occurs actually runs in the Event Dispatcher. So, for example, if you click on a button, any code that is run as a result is run in the event dispatcher.
    So there are two things I am wondering about. First, If i run code in response to a user event, then it doesn't have to use invokeLater() to update GUI components because it's already being run in the event thread? Second, if I run code in response to an event but it's computationally expensive and I do not want to run it in the Event Dispatcher thread, how do i do that? Will a method call cause it to do so, or do i have to specifically create a new thread for it?
    My questions are a result of this: How does one normally go about updating a GUI during a long process? I figured that if I could get the process to run in any thread other than the Event Dispatcher, I could call invokeLater() within it and it would update the GUI. Am I correct in assuming so?

    So there are two things I am wondering about. First, If i run code in response to a user event, then it doesn't have to use invokeLater() to update GUI components because it's already being run in the event thread?
    Correct. So if your response to an action is, for example, creating a new bit of UI using data which is already in memory, you can just do it.
    Second, if I run code in response to an event but it's computationally expensive and I do not want to run it in the Event Dispatcher thread, how do i do that? Will a method call cause it to do so, or do i have to specifically create a new thread for it?
    You will need to create a new thread: method calls are just control flow within the same thread.
    You should use an object which implements Runnable and then use "new Thread(foo).start()"
    My questions are a result of this: How does one normally go about updating a GUI during a long process?
    You have to hop back onto the EDT whenever an update is required. I'd suggest writing yourself a little reusable class or two to help you with this - such as a listener mechanism with an implementation which handles the thread hopping.
    I figured that if I could get the process to run in any thread other than the Event Dispatcher, I could call invokeLater() within it and it would update the GUI. Am I correct in assuming so?
    Yes.
    Should I use inner classes? I would prefer to keep them as separate classes within the same package.
    Depends on all sorts of things - sometimes anonymous or declared inner objects are the way forward, sometimes public class objects, sometimes generic helper objects and sometimes utility classes. There are all sorts of different scenarios. As I say, though, it's worth writing some utility/helper classes to reuse. Personally I don't find SwingWorker is ideal so I have my own. Note that an abstract Action implementation is a very useful one, since this is precisely where you need to be doing most of the thread hopping.

  • How can you start up your ipod if holding the hold and home button does not work?

    how can you start up your ipod if holding the hold and home button does not work?

    Remi,
    How long did you hold these buttons for? Did you try more than once?  Have you tried letting it charge for a bit and trying again?
    If nothing else, see this article for more troubleshooting assistance.
    http://support.apple.com/kb/TS2771
    B-rock

  • How can I make a table cell extend beyond the page?  The text disappears when the cell becomes larger than the page.

    How can I make a table cell extend beyond a page?  The text disappears when the cell becomes bigger than the page.  I want the table to continue to the next page.

    As a student, you might be able to get Office for Mac from the college bookstore at a substantial discount. Otherwise, I think your best option for documents that need to be shared with Office users is to get one of the free Office clones such as LibreOffice.

  • Can you create a table of contents for the documents within a PDF Portfolio?

    If I create a pdf portfolio that contains multiple documents (e.g. Word, multiple PDFs and Excel documents), is there a way to create a table of contents at the beginning of the portfolio to help navigate to the individual documents?

    Hi,
    The Files list displays a list of files, so the user can quickly see all the files in the portfolio with any information you want to share; title, description, file type, size etc.
    Or, you can also use a different layout, for example, the Linear and use the space next to each file to describe it.
    Hope this helps.......
    JGaf

  • Can i enhance a table via eewb for the service contract?

    Hi, expert
    I want to enhance a table for the service contract,
    when i use eewb to do the enhancement, i find only the BUPA  can do table enhancement.
    Or i can create a tran. table and display the data via a table view on the web ui ,
    but how to save the data of the table view when i click save button on the Web UI ?
    Thanks.
    Oliver.

    FYI: Found the problem. In the Administrator's Guide (of course not in the supplied packages documentation about DBMS_JOB) I found:
    "How Jobs Execute
    SNP background processes execute jobs. To execute a job, the process creates a session to run the job.
    When an SNP process runs a job, the job is run in the same environment in which it was submitted and with the owner's default privileges.
    When you force a job to run using the procedure DBMS_JOB.RUN, the job is run by your user process. When your user process runs a job, it is run with your default privileges only. Privileges granted to you through roles are unavailable."
    And of course we had set up our users to get all privileges through Roles, so CREATE TABLE wasn't one of my DEFAULT PRIVILEGES!
    It sure would be nice if Oracle documentation could get its act together and provide ALL information about a topic in a logical place. The effort to find the information about privileges occurred after it took me 1/2 hour to figure out why my submissions were failing - I didn't have the ';' included in the quoted string for the procedure to be called - which I only figured out after looking at the code for DBMS_JOB where it made the note to make sure you include the ';'. Wouldn't it be good to have that MINOR DETAIL mentioned in the description of DBMS_JOB.SUBMIT?????

  • Can I modify a power point presentation on the keynote and send it back as a power point? Will a PC be able to open it?

    Can I modify a power point presentation that was sent to me on my keynote (OS X version 10.9.4, processor 2.6 GHz Intel Core i5, memory 8GB 1600 MHz DDR3), and send the presentation back after the modification as a power point? Will a PC be able to open it and work with without any problem? How should I do it? Also, there are some videos that do not play, what should I do?
    Thanks for the help.

    Can I modify a power point presentation
    Keynote will open, edit and save PowerPoint files.
    In Keynote use:    File > Open, then select the PowerPoint file.
    Once edited save it by:   press the Option key then,    File > Save As
    PowerPoint file will open if the user has either PowerPoint or PowerPoint Viewer installed on the Windows computer.
    Also, there are some videos that do not play, what should I do?
    If they are Windows Media files they would have to be converted to play on a Mac.

  • Table expands outside of the content area in a tabbed panel - sometimes

    I am using a tabbed panel to create several different views of a database. The system is working pretty well, the only problem I have is that the content for almost all of the tabbed panels extend beyond the right hand end of the content panel. The page is here www.mwlcraftshow.com/gordo.php and you'll see that when you select the "Declined" tab the data shows correctly within the content area, but if you select "Accepted" or "All vendors" the table extends beyond the content panel. I've reviewed the html and css and don't see any difference between the tab that works (Declined) and tabs that don't work (All vendors, Accepted).
    I'd really appreciate someone pointing me in the right direction.
    Thanks

    I see that you are indicating td widths for your tables. If you don't try to dictate widths in tables AND reduce the size of your text, you will have better luck keeping the table on the panel. You might also consider making the live area for the TabbedPanels wider, as well (the whole widget). If you have a limited size monitor, you won't be able to do that.
    The only size you should use on this table is for the table width itself: use 100%, and it will fill the TabbedPanel Content width-wise, and should force the columns to fit (if you take off their widths as I suggested above).
    With tables, absolute width indicators seem only to be a "suggestion" as tables will automatically expand if the content is too much for the content cells. Applying a 100% width for the table as a whole should force the cells to expand down and not horizontally.
    Beth

Maybe you are looking for

  • [solved] broken gtk aps after recent updates

    I have critical problem with gtk based apps, most of them ends with segmenation faults. bagheera@tux:~$ empathy Naruszenie ochrony pamięci bagheera@tux:~$ linphone ALSA lib conf.c:4630:(snd_config_expand) Unknown parameters 0 ALSA lib control.c:882:(

  • Connect by prior (hierarchical query)

    Hi All, Some1 asked me a question which goes like this: Source emp_no dep_no 110 10 110 20 110 30 110 40 120 10 130 10 130 20 write a query to achieve the following output from the above source emp_no dept_no 110 10203040 120 10 130 1020 Now I have c

  • Error using SET SERVEROUTPUT ON command

    HI, I am using Hudson configuration tool for automated deployment.The script was running successfully without spool command,but when i use these commands i got below exception. spool file1_select.log SET SERVEROUTPUT ON; DECLARE l_vc_user VARCHAR2 (5

  • Java error when trying to run .jar program---help?

    I have a Java program that runs fine on a Windows box. When I run it with the GUI "Jar Launcher", the program name appears at the top of the screen very briefly but then the program crashes. When I run it using Terminal, I get the following errors: +

  • Your Save operation could not be completed

    Hi, I started Photoshop Express Online on my Windows 7 computer using Firefox. I uploaded some pictures. All was fine. When I edit a picture however (which itself is working fine, too) I only get the error message shown in the title. This is happenin