How to stop an event action when other event happen ?

This is my first swing program
I want to design an application with two buttons,"start" and "stop"
Pressing "start" will start listing data
Pressing "stop" will stop listing data immediate
What should I do??
I try to use a flag like the following:
==============================
btnStartActionPerformed() {
while(1) {
if (loop_break) break;
btnStopActionPerformed() {
loop_break = true;
==============================
but btnStopActionPerformed() will not start until btnStartActionPerformed() is finished
What should I do?

I agree with the thread comment...
But if you are going to use a while loop, you can do this:
loop_break = false;
while(!loop_break) {
}But if you need to stop anywhere inside the loop, you need to use if statements to check that flag between every action the while loop contains. Otherwise, you're limited to breaking whenever you check the flag, of course, or as above, before the next loop iteration.

Similar Messages

  • How to Stop the method Action When an Exception Occur in other Method

    Hi All ,
    public void action( Event clientEvent) {
    startAction();
    JOptionPane.showMessageDialog(null, getDocumnetId());
    how to Stop the method action ( "action" ) if an exception occur in the method ("startAction")
    ( if the exception occur we doesn't need to show the JOption Message )

    Hi,
    try FacesContext.getCurrentInstance().renderResponse();
    Frank

  • How to stop a process chain when its running?

    Dear Experts,
    How to stop a process chain when its running? is it that a chain can be stoppend when we open an info package of that chain ?
    Thank you,
    Raj

    Hi,
    Goto the main menu process chain --> choose the remove from the Schudule...
    Regards
    sathis
    I hope it helps to u... please assign the points

  • How to stop timeout event

    hi,
    Inside a while loop i've placed one timeoout event with other button click event, but after stopping the while loop the time out event didn't stop.. how to stop that event,
    Suggestions pls??
    Thanks and Regards
    Jagan

    2716jag wrote:
    im having only one event structure.. see within a while loop im having the event structure. im having three cases, one is time out event having the time out of value '0'. that is it never wait for other to event occur. if i click other other event after running that time out event is running. in one case im stoping the while loop with a boolean. but after giving the true value to the while loop the time out event is continously running. tell me how an i stop the time out event??
    You should really show us your code! We cannot troubleshoot vague descriptions. Attach your VI or at least attach a picture of the code.
    Have you tried running in execution highlighting mode?
    Some guesses:
    Are you possibly running the VI in "continuous run" mode? That would restart the code after it finishes. 
    Is your stop button outside the loop, but wired to the stop terminal across the loop boundary?
    Message Edited by altenbach on 06-15-2008 01:48 AM
    LabVIEW Champion . Do more with less code and in less time .

  • How to stop an ORB server in other program

    I have writen an ORB server program, just like the sample HelloServer, the main thread wait on a new object forever.
    How to stop the server in some other programs?
    Is there some common method to stop ORB server except kill the main process.
    Thank for any help!

    The question I have is how to stop an orb server programmatically without shutting down my app. My app is a server that runs continuously. I want the ability to shut down just the orb portion and restart it if desired.
    I also look for this capability. When searching for this in the forums, surprisingly, I only find one question for this, but no reply or answer. Does anyone have any idea?
    Thank you for all ideas.

  • Could somebody please advice how to stop the pages dropping ,when l go on ebay ,utube etc

    could somebody please advice how to stop the pages dropping ,when l go on ebay ,utube etc

    could somebody please advice how to stop the pages dropping ,when l go on ebay ,utube etc

  • How to stop Timer event inside movie clip that does not exist?

    Hello. I am using Adobe Flash CS6.
    As this topic title says. how to stop Timer event nside movieclip that does not exist?
    I mean my fla stracture is  there are 2 frames on main timeline, and I put mcA on frame 2.
    And I put a button on root that does
    if(currentFrame ==1)
    gotoAndStop(2);
    else if (currentFrame ==2)
    gotoAndStop(1);
    And mcA has AS inside and it is
    var T_Timer:Timer = new Timer(1000,0)
    T_Timer.addEventListener(TimerEvent.TIMER, test)
    function test(e:TimerEvent):void{
    trace("Timer active")
    T_Timer.start();
    I need to stop T_TImer from root on frame 1, not on frame 2.
    but, "mcA.T_Timer.stop();" won't work.
    I get TypeError: Error #1010 error.
    I don't know how to stop this timer event. I have to stop it from root, and I can't use EVENT_REMOVED in this case.

    If the object doesn't exist you cannot do anything relative to targeting it.  Maybe you should move the timer to the main timeline where you can access it any time.

  • How to stop iphone from autoplay when plug into car audio system usb?

    how to stop iphone from autoplaying when connected to your car audio USB ?

    You need to remove the association that Windows has with that particular file type. To do that, you need to open Windows Explorer. From there, click on Tools, then Folder options. Click on the tab that is named file types. You then need to find the extension for the photos that appear in the iPhone, then click that registered file type. Once you do that, there is a section to select the program to open that file type with. You can click on the change button, and that will allow you to change the program that it opens with, or restore the default. There is also a box that can be checked to always use the selected program. If you unselect it, it will prompt you next time on what program to use.
    Hope this helps.

  • Sharing iPad2:  how to protect my own data when others use it?

    A single iPad2 is shared with others.  How do we protect individual data when others use the iPad?

    I use iCab and Comcast email with no problems. Try restarting your iPad. Try quitting iCab, restart the iPad and then try again. Just keep fighting the loop and see if you can ultimately get it to work if you have to.
    Try using the Connect Lite version of the Xfinity/Comast mail on the iPad. You will have to change that in the preferences on the server. It is in the general section. You want to select Xfinity Connect Lite. I have Comcst and I think this makes it a little easier to navigate and its a little more iPad friendly.
    If you want to be able to write mail in the Comcast webmail on the iPad you have to change to use Plain Text instead of HTML in the Composing preference. If you don't, the keyboard will not popup when you tap in the text field. You will be able to enter the email address in the To: field and the subject in the subject line but that is all unless you switch to plain text.
    I actually prefer the mail app on the iPad to using the Comcast webmail but that's just my preference.

  • How to stop the Flex application when user clicks on Cancel button from JS-confirm message?

    Hi All,
    I use the next code when a user clicks on a link:
    private function clickHandler():void
          ExternalInterface.call('confirm', 'Of course you want to go to the Adobe forums!');
          navigateToURL(new URLRequest('http://forums.adobe.com'), '_self');
    This will show up the javascript confimation box. But when the cancel-button is clicked, the user goes straightly to http://forums.adobe.com...
    How to stop Flex performing the next code when a user clicks on the Cancel button?
    Or, how to catch which button is clicked by a user in Flex?
    Thanks!

    I agree with Mr. Hall that using mx.controls.Alert in Flex may be a better route.
    Show the Alert like this:
    // show an alert with a question and yes and no choices
    Alert.show( "Would you like to go to the Adobe Forums?", "Question",
         Alert.YES | Alert.NO, this, closeHandler, null, Alert.YES );
    Then handle the response in the closeHandler() function:
    protected function closeHandler( closeEvent:CloseEvent ):void
    if( event.detail == Alert.YES )
         navigateToURL( new URLRequest('http://forums.adobe.com'), '_self' );
    else if( event.detail == Alert.NO )
         // they chose no
    The following documentation on Alerts may be helpful:
    http://www.flexafterdark.com/docs/ActionScript-Alert
    Let me know if that helps...
    Ben Edwards

  • How to stop new record creation when mouse click

    Hi,
    I am working with Oracle Forms 6i.
    I have a multi record block. I have provided a 'New' button that the user should click when a new record creation is required. This is because there is some other function that needs to be performed when the new record is created. Specifically, on clicking the new button, the program populates the field with values read from another table. This works fine.
    However, I realized, that if the user clicks on the mutli-record block just below the last record, a new record gets created. This action does not cause the logic behind the 'New' button to execute and the record is created in a manner that is not acceptable.
    First question is why does the new record get created only by clicking with the mouse with the pointer below the last record? Is there a way to stop this from happening?
    Thanks in advance for your help.
    Shailesh

    Hi Andreas,
    Probably I was not able to explaing my problem.
    I have a button that creates a new record when clicked. The button's trigger has the CREATE_RECORD statement.
    When a new record is created, I need to copy values from the record above it. I have therefore used DUPLICATE_RECORD in my block's WHEN-NEW-RECORD-INSTANCE trigger.
    I cannot use DUPLICATE-RECORD in WHEN-CREATE-RECORD trigger.
    So, I am not clear about what you are suggesting.
    My problem is that a new record gets created when click with my mouse pointer below the last record in the multi-record block. Why does that happen and how to prevent it?
    Thanks
    Shailesh

  • How to stop everything before gotoAndStop to other frames?

    Hi,
    I'm trying to make a small flash that looks like a website.
    and I'm using 4 buttons with gotoAndStop to navigate to 4 different frames/pages.
    The problem is, when I import a video or videoclip to a frame/page, it won't stop playing when I click the button to go to other frames.
    It's not visible because I'm not in that frame but I can still hear it playing in the background.
    If I go back to that frame, it starts playing video again but the old one is still playing ...
    How do I stop everything in the current frame when I click the navigation buttons?
    I'm new to flash please help

    Thank you for your reply Ned,
    I did make the video stop by this code, it works perfectly when I navigate to other frames
    VideoClip.addEventListener(Event.REMOVED_FROM_STAGE, stopPlay);
    function stopPlay(e:Event)
         VideoClip.stop();
    but this code won't work for the nested movie clips.
    In another frame/page of my flash file, I have put a mini game that I imported as a movieclip, It has background music and stuff. It won't stop if I click buttons to go to other frames. When I click back to that frame, it just loads the movieclip mini game again ....
    How do I fix this?

  • HELP - How to stop audio from starting when captivate loads

    Hi there,
    I'm trying to work out how to stop my audio files attached to objects (images) from playing when captivate initially loads.  I have a number of images with audio and when captivate initially loads all of the audios play at once which isn't good.  I only want the audio associated with the object to play when the user clicks the item.   
    I've been researching for days and can't find an answer.  Am I doing something wrong, or am I overlooking something.? 
    Could someone PLEASE help me with this or at least put me in the right direction.  Any suggestions will be appreciated!!!
    Jasmin 

    To achieve that you have to separate the audio from the image. The principle I explained in this article http://lilybiri.posterous.com/audio-objects-control-them
    The audio will play when the object to which it is attached gets visible. If you attach the audio to another object like a non-visible highlight box (that is my 'audio object' but you can use also a non-visible drawing object), you can set this 'audio object' to invisible in its Properties panel. When the user clicks on the click box, execute the action 'Show audio object' and the audio will play. I would even recommend using advanced standard actions over a simple action because you will be able to hide the other audio objects at the same time, and the play head will not be released - see video http://www.youtube.com/watch?v=M3nKi-DB6Fw&feature=plcp
    You have to know that hiding an audio object, will pause the audio. If you show it again, it will continue playing, not restart.
    Lilybiri

  • How to stop Aperture starting up when iPhone is plugged in?

    Hi all,
    silly question... but Aperture keeps opening whenever my iPhone is plugged in. Does anyone know how to stop this? Not a big deal... but its getting annoying!
    Thanks in advance!
    Lil

    And, if you want Aperture to launch when you connect your camera, but not when you connect your iPhone, open Image Capture when your iPhone is connected, highlight your iPhone in the sidebar, and select the No Application option in the lower left-hand corner where it says "connecting this iPhone opens"
    You can have different options for each device.

  • How to stop suggestions for words when texting

    How do I stop suggestions for words when texting?

    Settings>General>Keyboard>Auto-Correction>Off.

  • How to stop specific query attached with other query in same process using With method

    Would it be possible to stop one query out of two queries attached to single process...because i see it is returning one IDisposable inteface...if i call dispose() method...two queries are stopped/killed...
    So how to stop specific query which is combined with other queries in a  same process at runtime i.e., attach or detach kind of thing?
    Thanks in advance
    Satish

    Yes, the overloading of the term "Process" can be confusing. In SI, depending on your edition of StreamInsight, a process can run on one or more threads from a pool of threads and are scheduled together. Don't think of a process necessarily as a single
    thread or multiple processes as a method of multi-threading.
    As for a limit on the number of queries, there isn't a hard limit that I'm aware of. However, there will be a practical limit that will vary based on the complexity of the query, the event rate and your hardware (# of cores). If you are using Standard Edition,
    this limit is much smaller as you only have a single scheduler thread. With Premium Edition, you have a scheduler thread for each core on the machine so you can get higher throughput and lower latency. But if you have, say, 4 cores on the machine (don't count
    hyperthreaded cores, just real cores), 100 queries and a target throughput of 100K events/second, you'll likely have some problems. At 1K events/sec, you'd likely be fine though. With 32 cores and Premium Edition, you'd probably be OK with 100K events/sec.
    So ... like I said, it depends.
    DevBiker (aka J Sawyer)
    Microsoft MVP - Sql Server (StreamInsight)
    If I answered your question, please mark as answer.
    If my post was helpful, please mark as helpful.

Maybe you are looking for

  • How to isolate media files in Applications from video uploaders within FMS

    Hello, We have linux-centos with FMS 3.5.2, apache is on another server. We host media files within applications folders. The media files are uploaded via ssh by different users, each one populating her own my_app/streams. the problem: We do not want

  • Terminal "open" command misbehaving

    In Terminal, when I use the "open" command on any folder, I expect that folder to open in the Finder. For example, "open /Applications" should open the Applications folder in the Finder. This does not happen for me. Instead, iTunes opens and starts t

  • How to style 'Related Products' "Buy Now" Button?

    I have been styling my site to the way I want it, but I hit a road block. I styled the "Buy Now" button on my store with - input.productSubmitInput in my css stylesheet But it is making ALL the Buy Now buttons the same size... Now my "Related Product

  • Define Number Assignment for Material and Phys. Inv. Docs

    Can we give number range for Goods Receipt, goods issue, physical inventory document and Invoice verification document year wise?? Suppose for 2011 no range  490000 to 499999                     2012  no range 500000 to 599999 For all the documents(G

  • Printer not on list...

    I installed an Epson Stylus CX7000F to the USB attached to a PC (Win XP) desktop. It replaced a CX6600. I was able to print from my MacBook Pro (OS X v10.4.9) through the Network Neighborhood, as the 6600 was listed on the drop down menu. I installed