Paintin in new thread

Hi
I use a 3rd party product (a component in my GUI) that has a problem painting its components. The paint takes a long time. This freezes the whole application. I thought putting the paint call in the parent class that contains the offending component in a new Thread:
public void paint(Graphics g)
paintThread = new PaintThread(g);
SwingUtilities.invokeLater(paintThread);
public void rePaint(Graphics g)
super.paint(g);
private class PaintThread extends Thread
Graphics graphics = null;
public PaintThread(Graphics g)
graphics = g;
public void run()
rePaint(graphics);
This doesn't work, it leaves the component greyed out.
Any ideas?
Thanks
George

Chances are, unless you call it directly, that the paint(Graphics g) is being called in the Event Dispatch Thread. What you are doing is declaring a new Thread (PaintThread) that is never used as a Thread (never started). Instead, you use it merely as a Runnable whose run() method will be called later in the Event Dispatch Thread (that's what SwingUtilities.invokeLater is about).
Do you have access to the source code of your third party product? Feel free to post the paint method to see if it really is the bottleneck of your program.
Next time, please use code tags (see Formatting tips, prior to posting).

Similar Messages

  • How to let new thread to access EJB

    I start new thread in Servlet class and I want this thread to call EJB business method but I get following error:
    javax.naming.NameNotFoundException: Name comp/env/ejb not found in context "java:"
    Probablly because thread has no credentials and so on. I know this concept violates J2EE specs but I don't know how to make timer to call business mathod every N minutes (I use J2EE 1.3 so I can't use Tiemr EJB).
    I suspect that this new thread has no credentials and no role. What happens if I set run-as some role in servlet? As I saw new thread still has no credentials and role.
    Can anyone suggest me how can I set credentials to new thread so it can call EJB business method or how to implement timer service in J2EE 1.3.

    I start new thread in Servlet class and I want this
    thread to call EJB business method but I get
    following error:
    javax.naming.NameNotFoundException: Name comp/env/ejb
    not found in context "java:"It may happen because you'r new thread doesnt have information (JNDI environment) about EJB references.
    Can anyone suggest me how can I set credentials to
    new thread I guess it's server specific.
    so it can call EJB business method or how
    to implement timer service in J2EE 1.3.Don't use EJB reference. Lookup EJB by it's global JNDI name.

  • As Requested New Thread DSL low speeds and drop outs ref: Anthorny Verizon.

    Please see post by Jerrold concerning the form for information requested, I have never been able to fill this out. Note also I had to sign in three times just to access your private letter to me today.
    Here is a summary of problem:
    When my line was first installed line speed was always between 9 to 12 Mps, which is fine for a 15 Mps line, sometimes would even go higher, so line was ok.
    In October 2012 my line speed dropped to about 5 to 7 Mps, I contacted support and repairs were attemped, but did not correct the problem in fact problem became worst.  My line speed dropped to about 2 to 3 Mps.
    Now from October to end of November, all repairs did not correct problem.  I was told by chat tech support that the problem was being worked on and there was an open ticket.
    In December my line speed returned to normal speed was between 9 to about 13 Mps.  No one had contacted me about this so I again contacted chat tech support who said my line had been fixed and there were no open tickets so have a nice day.  I accepted this at face value and accepted that my line was now ok.
    In January 2013, My line speed dropped again to 2 to 3 Mps.  I contacted chat tech support who tested line and put in a repair request.  No one had responded back to me and a week later my line started to drop in and out losing the connection completely.  I again contacted tech support who told me they had no open tickets on my account, they tested line and while we were talking on voice connection my phone started to have heavy static, both my DSL and Phone dropped out at that point.  Tech support called me back and said he was putting a repair request and that my line had problems. That night Tuesday January 29 my Phone and DSL both died, no dial tone on phone and DSL showed only power light on.  Contacted tech support by a friends cell phone and informed them of this, was told ok it would be fixed by open ticket for next day.
    Repair was to be made on Wednesday January 30, no one showed up, called tech support and told repair would be made on Thursday.  Thursday late repair person showed up around 4:30 or 5:00pm, landlord gave access to building.  I did not know they were here at all, when he told me( my landlord) I tested my DSL and found it running at 1.7 Mps or below that.  When I attempted to call tech support found my phone was still dead, no dial tone at all.  Contacted chat tech support who told me ticket was still open and would be fixed by Friday, or Monday.
    On Monday, phone still dead, DSL running at 1.7 Mps contacted chat support who had me take a phone to the junction box outside of building, plugged in two phones to this no dial tone at junction box (both phones work ok checked using a neighbors phone jack)  should note that on the outside of building there are two junction boxes, but one has lock on it so could not use that one.  Anyway told that DSL could not be fixed until phone is repaired.  Tried contacting phone repair and all I get is auto wait then line drops using a neighbors phone and pay phone my is dead.
    Tuesday again contacted chat support now told to bad, until phone is fixed cannot help me ( was'nt that suppose to be done in first repair, fix phone and DSL given both were reported dead).
    So why am I upset well look at history I now sit with No Phone service, DSL running way below what I pay for and a tech support who has said to bad not our problem.  I also do not want to hear that my line does not and cannot support the speed I pay for ( it has shown to support that speed at beginning of install up to October and again in December).
    Well anyway your letter did not say where to start new thread should I do that here, or in open forum?
    Oh, auto phone repair has given me a date for phone service as this Friday, I hope that at least gets done I cannot contact them any other way it seems.
    You may also ref: my thread on ping rates over 600 on long distants calls for any other history, but as per your request here is new thread.  Please note as of today I have No Phone so can only be contacted by email or here.  Untill phone is repaired that's all there is.

    Please go to your profile page for the forum by clicking on your name, and look in the middle towards the bottom where you will find an area titled "My Private Support Cases".
    There you will find a link to the private board where you and the agent may exchange information. This should be checked on a frequent basis as the agent may be waiting for information from you before they can proceed with any actions. Please keep all correspondence regarding your issue in the private support portal.
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer that solved your issue as the accepted solution.

  • I am trying to have some LabVIEW code called in a New thread exit when the testStand sequence terminates

    I have a Sequence that launches a sequence in a New Thread that happens to launch some LabVIEW code.  The problem is when the LabVIEW code finishes, it will not close even when the TestStand sequence terminates. Is there a way to tell this LabVIEW code to Exit, I've tried the Quit LabVIEW function, but that causes a C++ RunTime Error.  The LabVIEW code does end though, and it is set in the VI properties to:
    Checked - Show Front Panel When Called
    Checked - Close Afterwardds if originally closed
    The sequence call that the LabVIEW code is launched from has the following options:
    - New Thread
    Unchecked - Automatically wait for the thread to complete at the end of the current sequence
    Unchecked - Initially Suspended
    Unchecked - Use single threaded apartment
    Any clues on this would be appreciated.

    Hi ADL,
    Everything should close correctly if you check the checkbox "Automatically wait for the thread to complete at the end of the current sequence" in the thread settings.
    With it unchecked, I am seeing the behavior you are. 
    Gavin Fox
    Systems Software
    National Instruments

  • I group messaged from my ipad and this has screwed up the way my messages are reveived by my friends (it creates new threads in their phones with my email in place of my contact name) I've stopped messaging from my ipad but the problem remains. Any help?

    I have an iPhone 4S and use the group texting feature ALL THE TIME. I recently updated my iPad to the latest software and made the colossal mistake of continuing my group messaging from my iPad while connected to wifi. Doing this has successfully screwed but every group text thread I am in, to the point where its very hard for those involved in the thread to keep up. When I initially messaged those I was already engaged in text threads with it created a new thread in their phones replacing my name in their phones with my email. At first this was not a big deal but ever since then the people I am messaging have become increasingly frustrated with how my messages come through. If I am messaged in a group text and respond to it, sometimes when I respond it will create an entirely different thread in my recipients phones. So at that point they have to switch threads in order to read what I wrote. The new thread that my phone creates will send the message under my email not my name (related to the contact they have me saved as in their phones). The worst part about it is that there seems to be no rhyme or reason to why or when my phone will send the message as normal or under my email like it did with my iPad. I haven’t messaged from my iPad since these problems immediately began a month ago but the issues still continue. I have tried everything to get this to stop, I’ve turned off my wifi, I’ve had my friends delete the threads that my messages create in their phones. I’ve had them delete my email in their contact lists and nothing has worked. Can you help me? Any info you could provide would be greatly appreciated.
    Note: My phone message no different whatsoever. All the threads have remained the same. The issue is what it is doing to the people that I am messaging.
        Best Regards
             Rick Mulhern
    Message was edited by: Rickapplehelp19

    I have this identical problem.  For a while my group texts didnt show up on my ipad.  Then one day they did, maybe everyone in the group started using the same os version or something.  Ever since my first reply to the group there have been complaints of multiple threads.  I can not find a pattern for when my group text's decide they want to create a new thread. (it doesnt happen every time)  Everyone in the group has deleted the thread, we've all toggled imessage on/off etc.  There still hasn't been a solution.
    Any help would be appreciated.
    Thanks

  • Cannot post new thread in Calendar forum

    I have a question about Oracle Calendar, and I'm trying to post my question in the Calendar forum. But when I click the "Post New Thread" link, I get an error page that says "Error: you do not have permission to view the requested forum or category."
    What am I doing wrong?
    I am signed in as a registered user, not a guest. I originally created this account a few years ago but have not used it in a long time until today.

    How did you get to the forum? Are you trying to post to an archived forum? You may need to use a different forum, perhaps someone can tell which forum to ask such a question, or you can get a clue by searching here (as opposed to google searching). This is a huge site, sometimes it takes a bit of work to find the right place. For me, the google search generally works better, but that may not apply to what you are searching for.

  • Limited subject characters count when creating a new thread in Portal 7.3 forums

    Hello,
    i was wondering if and how you can change the max. characters for the subject when creating a new thread in Portal 7.3 forums.
    It seems like the character count is limited to 75 characters for subjects.
    I didn't find any suitable property, in the forums admin console, for that issue.
    Thanks

    Hi Andrzej,
    Have faced a similar issue in EP 7.01. It was due to the missing Super Admin access - Save was clocking & timing out.
    Upgraded the Admin permissions and this issue was resolved.
    Hope this helps.

  • Same problem -- new thread

    Hello,
    I have been reading through some of the other threads in the forum and it seems I'm having the same freezing problem with my 4th gen iPod, 50 gig, when connecting to Mac. Thought I'd post a new thread since the others are tremendously long and I have not yet found any answers.
    I have been accustomed to listening to the contents of my iPod through iTunes while at work, but one day the songs started skipping around and iTunes started to freeze. Thinking the problem was iTunes, since my iPod was working fine while not connected to the computer, I ignored it and just ejected the iPod. When I connected the iPod to my iBook G4 at home the same thing happened. iTunes froze, Finder froze, and I had to restart the iPod to disconnect it. After I did that the iPod would no longer show up on the desktop or in iTunes on either my iBook or work G4, so I restored it with the very latest iPod updater, thinking it would be a pain to put all my music back in, but it would be worth it in the end.
    Now when I try to add music to the iPod, the iPod itself eventually freezes mid-update, freezes iTunes and also the Finder and I have to start all over again. After restoring it a 4th time I got wise and decided to manually update. I have been adding 3 or 4 playists myself and then disconnecting for a while before reconnecting to add some more. This is a painstaking process, and I'm sure there is something going on here that is not my fault. The iPod has continued to work 100% normally when not connected to a Mac. The trouble seemed to appear out of nowhere, and I don't think it's a HD problem because of the fact that the iPod never freezes when not connected.
    It seems like many people with this gen. iPod are having similar problems, but I'd like to hear if someone thinks I may have done something to precipitate what is going on with my iPod. It's only a little over a year old and I see no reason why I should be having these Mac-connecting problems with it.
    4th Gen 50 gig click wheel   Mac OS X (10.4.6)  

    Turn off the PC.
    Open your MacBook.
    Open Applications > Utilities > AirPort Utility - click Manual Setup
    Click the AirPort Utility menu item in the upper left hand corner of the screen next to the Apple icon
    Click Check for Updates.
    If you have been updating your MacBook, you may already have the latest version of AirPort Utility. If so, you are all set. If you have an update available for AirPort Utility, go ahead and update it.
    Then open AirPort Utility again and click Manual Setup
    Click on the word "Status" to see if there are any messages or updates available for your AirPort Extreme. If yes, go head and update.
    In the future, use the MacBook to access your AirPort Extreme, not the PC.
    There is no need to "start over" unless you want to do everything again.
    Message was edited by: Bob Timmons

  • (New thread) HP SimpleSave md1000h External Hard Drive - Can't Access Files,

    New thread on same old unaswered issues from others.
    My desktop crashed.  It  needs new harddrive.
    I religiously backup my info everyweek on my simplesave md1000h
    However, before I buy a new computer or replace the harddrive on my old computer, I want to at least get my Quicken Checking account info up and running on my wife's  laptop.
    When I plug in the usb for the md1000h into the laptop,
     it recognizes the  hardware is there but, does not show any files.
    I presume my laptop needs the software to run the simple save.
    However, there is nothing out there on the HP site.
    Can anyone confirm that this is the issue...that I need the software...if so, where can I download it from.
    I beleive the softweare came preloaded on the md1000....now I cant access that software....go figure.
    Any help is appreciated.   Thanks.  Greg

    I too have the exact same problem on my HP SimpleSave (sd500a) external hard drive. I got through to WDC, and they apparently support these devices now. They asked me to send them a copy of my purchase receipt in order to extend my warranty in their system in order to help me (ridiculous!!). I sent the scanned copy of the receipt to [email protected], and got an auto-reply that they will get back to me within 1 day. I also went on their website, and they refer to the device in their system as 'ED Caviar Blue EIDE Hard Drive'. It has the same serial number as my product from HP, so I guess they have acquired these products or at least support of them (?). In any case, I'm freaking out because I have tons of family pictures, video and my entire iTunes library on the device. If any one is able to get help for this, please respond. I am desperate to get this resolved.

  • How can I include results of a subsequenc​e, which runs in a new thread, in the main sequence test report

    Hi!
    I', m working with TestStand Version 4.2.1. I have a main sequence, which calkls different subsequences. All these steps are properly reported. One of subsequences runs as "new thread". How can I include its results in common test report of the main sequence?
    I have markes variables of the subsequence as it is requred for test report (it works OK if it is not a new thread). If the the numerical test, which is executed in this subsequence is correct, I get no results at all. If the numeric test failed I get somewhere in the main sequence report a "red message", that test failed whithout any reference to the step or values of vaiables which were not correct.
    I tried an option "On the fly" in the Report Configuration , but haven' got any useful results. What shall I do?
    Best regards
    Solved!
    Go to Solution.

    Hi,
    I tried it but without success:
    1) I got a reference to the Thread as "Locals.Step1=RunState.Thread" for every of 2 steps which start a thread
    2) I put both "Waits" after steps with (and without) threads, at the same place, where they were before
    3) The sequence run OK, but when it came to Wait for Thread 1 it waited for ever, I had to terminate sequence
    Does it mean, that I got a false reference (suppose No - please, have a look at attached pic)?
    Or does it mean, that Waits are badly placed in the sequence (threads are already terminated)? Here is a pic of sequeces calls with Wait after them.
    Regards
    Attachments:
    Thread.JPG ‏34 KB
    SequenceCall.JPG ‏32 KB

  • How to call a sequence in a new thread from C++ dll

    Here is what I am trying to do:
    I implemented a dll that monitors network traffic, and it also supports message handlers that can be triggered when a specific message has been received. Essentially the receipt of a message is like an event causing additional code to be executed. What I need to do is have the message handler in the dll call/execute a sequence (either is the same sequence file that originally called the dll, or in a different sequence file). Also I want the sequence to be executed within the same execution object for the purpose of result collection and report generation. I am expecting the dll to have to launch a new thread to call a sequence because of the asynchronous nature of the message received event.
    There are easier ways to achieve the same result, but one of my goals is to make it easy for a test developer to configure a message handler, by having only one step in their sequence to configure the message handler. I want the rest to be transparent to the user.
    I am unsure about how to implement this feature, so I am asking for any examples, ideas, comments before I start trying things out.

    Assuming that I understand your question correctly, it would seem to be the best way to do this would be to pass the Execution object to the DLL (either through a direct pass of the Execution object or passing the sequence context, from which you can get the Execution).  Then simply call Execution.NewThread, specifying the SequenceFile object (accessible from Engine.GetSequenceFileEx) and then passing the Thread object out as an output.  Your sequence file in which your DLL is called could then simply have a Wait step which is configured to wait on that Thread object.  What happens in this case is that the results are collected for that thread (which is being executed asynchronously) and returned as the results for the Wait step.
    Although you are probably not using LabVIEW, I have attached an example of this in LabVIEW that might be helpful just for seeing the flow.
    Thanks,
    Andy McRorie
    NI R&D
    Attachments:
    thread_test.seq ‏32 KB
    testthread.vi ‏19 KB

  • How can I include the results are coming from a new thread, in the main sequence report?

    Hi,
    I have a main sequence which calls other sequence running in a new thread.
    I cannot see the results (limit test etc.) comming from that sequence.
    Is there any trick to it?
    Andras

    Hi again Andras.
    I got a reply from the technical support. I hope this help you.
    To include in main report the results of your test in another thread you must follow these steps:
    1.- Right click on the sequence call where you create the new thread. In "Specify Module" panel, just right "Run sequence in a new thread" press "Settings" button and disable "Automatically wait for the thread to complete..."
    2.- At the end of your main sequence add a new "synchronization - wait" step. Configure your wait, selecting in the upper ring tab "wait for thread".
    3.- Then select below "specify by sequence call" and pick over your thread name.
    With these changes your main sequence will add the results from your thread to your main sequence report.
    I hope it works for you. (but sadly it doesn't work for me)

  • Stationglobals in a Labview custom step type inside a new thread do not get updated

    Hi,
    I have a Custom Step type which I use to pass parameters to TestStand from a VI and vice-versa through some step fields. I run the VI inside a sequence in a new thread and expect the VI to update the parameters when I change them through the TestStand StationGlobals.
    For example, I have a waveform injection custom step. I want to continuously inject a signal while I do some measurements on it. So, I put this step type in a sequence and ran it in a new thread. 
    I pass the VI parameter 'Stop_Injection' through a step field as shown in image 1. And I expect the step field to get updated when the new thread is run continuously by passing the corresponding stationglobal in the Pre-expression of the custom step (image 2). But this fails to happen. The VI does not get updated.
    On the other hand, if I do not bother with the step field and directly pass the stationglobal (figure 3), it works perfectly. 
    Any idea why this is happening?
    I hope I was clear in my question.
    LabVIEW 8.6.1
    TestStand 4.1.1
    Message Edited by Changi on 08-06-2009 12:50 AM
    Attachments:
    1.JPG ‏92 KB
    2.JPG ‏42 KB
    3.JPG ‏91 KB

    Hi,
    In image 3 you are linked directly to the StationGlobal of which you are continually updating therefore seeing the changes.
    In the other you are only linked to the Step.Stop_Injection and are only updating this valve from the stationglobals once in the pre-expression. You are not changing the reference.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • Paint JProgressBar in new Thread

    Hi,
    I have a DnD Applet for managing your computer(files and folders) at work from home and have a problem with painting a JProgressBar during the drop action. I've tried to paint the JProgressBar in a new Thread but it freezes. I can see the progressbar but it doesn't move.
    I can't do the other things that I wan't to do in drop in a new Thread because of other circumstances so I have to paint the progressbar in a separate thread. Why doesn't the progressbar move?
    Any ideas?
    public void drop(final DropTargetDropEvent dtde) {
    setCursor(new Cursor(Cursor.WAIT_CURSOR));
    Thread t = new Thread() {
    public void run() {
    paintThread(); // THIS IS WHERE I PAINT THE PROGRESSBAR
    t.start();
    // HERE FOLLOWS THE OTHER THINGS I WANT TO DO IN DROP...
    Isn't threads supposed to work side by side?

    What you're trying to do is making a myThread method that extends Thread. It's not possible to make a method inherit from anything.
    You can't make a class with void either, a class doesn't return anything. You have mixed a class declaration and a method declaration. It doesn't make any sense at all...sorry!
    And I don't think you have got the idea with synchronized and what that means...

  • Calling sequence in a new thread multiple times gives debug warning "reference not released properly"

    Hi,
    I am including steps inside a sequence which calls sub sequences in a new thread. After calling each sub sequence in a new thread, I am putting Wait step which is configured to wait for the respective sub seueqnce to complete its execution. When I include these steps (call a subsequence in a new thread and then configuring wait to complete it) once, it executes properly but when I includes these steps twice, I get debug warning when I close Teststand sequence editor. Due to this behaviour, when I run this sequence through operator interface (Simple OI), I get run time error R6025.
    I checked if there is any object reference which might not be released, but could not figure it out here. Please see attached sequence and the debug warning message.
    Used version: Teststand 4.0.1, LabVIEW 8.5, Windows XP
    Kindly help.
    Thanks in advance,
    Nirmal
    Attachments:
    Sequence_new_thread2.seq ‏37 KB
    Debug Warning2.JPG ‏34 KB

    Hi Nirmal,
    Thanks for the detailed instructions. I tried exactly what you said and I still do not see the leak. The problem is likely specific to something customized on that machine or in the very least does not happen every time or on all machines. I'd recommend trying to narrow down by eliminating the possibility of an unintended customization. If you can try installing a clean install of teststand on a clean machine and see if you can still reproduce the problem then that would help narrow things down a little. If you can't reproduce it on a clean install on a clean machine then I'd start looking at what's different on the machine you can reproduce it on. You could remove your config files to eliminate customizations to settings such as search directories. You could remove files from your components\User directory to eliminate the possibility of using those. Just a few ideas. Other people might have some other ones.
    -Doug

Maybe you are looking for

  • Combined FIles in PI using BPM without correlation

    Hi All I have a requirement, I have two files coming from the source system one file with Header Detials & other file with Item Detials and I have to combine these two files into a single file. I have used the BPM in PI to combine the two files uisng

  • Using button to scroll down a Listbox control

    Hi, I am creating a tool which will allow users to scroll down to each item one at a time from the Listbox. However I hit upon an out of range exception each time I try as the box exceeds its index limit. So far this is the code that sort of works fo

  • MRN PRINTOUT PROBLEM

    HI GURUS CAN ANY ONE TELL ME WHILE WE CREATING MRN WITH REFERENCE TO ASSET PO AND TAKING PRINTOUT OF MRN USING TCODE MB90 WE SEE THAT THERE IS ADDITIONAL AMOUNT FIELD AND SYSTEM ARE SHOWING SOME VALUE IN THAT FIELD WHICH IS NEGATIVE CAN ANY ONE HELP

  • XI to XI communication

    Hi, I am doing XI to XI communication. Sender XI posts a message to receiver XI. but Receiver XI giving error that No receiver agreement found for sender to receiver. What could be the problem?

  • Formatting Major Issue

    Hello there I wanted to format one of my HDD partitions (its NTFS) to Mac OS Extended Journaled so I opened Disk Utility and I selected the specific partition that I wanted to format I clicked Erase and select Mac OS Extended Journaled its started bu