How do you close a dragged applet, as Stage.close() doesn't work?

I'm trying to implement a close button in a draggable applet, but Stage.close() doesn't work, and there's an odd little "X" icon which is causing me problems...
My starting point and example is the simple draggable applet from the API documentation. It's the code listed under "User-Specified Close Example":
http://java.sun.com/javafx/1.2/docs/api/javafx.stage/javafx.stage.AppletStageExtension.html
import javafx.scene.*;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.*;
import javafx.scene.shape.*;
import javafx.scene.text.*;
import javafx.stage.*;
var textContent = "Click the box to return to the browser";
var outside: Boolean = false;
var s: Stage = Stage {
    title: "AppDeploy Demo"
    width : 300 height : 200
    style: StageStyle.TRANSPARENT
    opacity: 0.5
    scene : Scene {
            content: [
                Text { content: bind textContent 
                       x: 25 y:35 fill: Color.BLACK
                       font: Font{size: 24}
                Rectangle { x: 100 y: 100 width: 100 height: 100 fill: Color.RED
                            onMouseClicked: function(e: MouseEvent): Void {
                                s.close();
    extensions: [
        AppletStageExtension {
            shouldDragStart: function(e: MouseEvent): Boolean {
                return e.shiftDown and e.primaryButtonDown;
            useDefaultClose: false
}However, the Stage.close() function in the user code doesn't seem to close the applet once it's dragged. It seems this can only be achieved by a mysterious little "X" in a box top right, acting as a close button.
Here's a demonstration of the problem once you've compiled that code:
1. Open browser with applet (I'm using IE8 on Windows XP)
2. Shift-drag the applet out of the browser. Notice the little X in a box appears when you drop the applet on the desktop.
3. Click the red rectangle to invoke the Stage.close() function in the user code.
4. Applet disappears from screen and does not reappear in the browser.
5. But minimising all the icons on the desktop shows the little X in a box is still there sitting on your desktop (actually I find the X has gone, but the box is still there). This suggests the applet is still running.
6. Close the browser. The little X's box is still on the desktop.
7. After a short pause a Java dialog box appears: "Desktop integration warning. The application would like to create shortcuts. Do you want to continue? OK/Skip" The applet wasn't closed, it is still running!
8. Click Skip. Dialog box disappears. But the little X's box is still on the desktop. Is the applet still running?
9. Try to recompile app again into a deployable Jar (I'm using Eclipse for this).
10. The compiler stops with "ERROR: Jar file C:\[...].jar could not be deleted. The Jar is probably locked by running application, Web browser, emulator or antivirus. Please check that all windows related to the application have been closed." Yes, the applet Jar is still being used.
11. Minimise all the windows. The little X's box is still on the desktop.
12. Click the little X's box.
13. After a few seconds the box disappears. Does this mean the applet is no longer in use...?
14. Recompile the app again into a deployable Jar. It works!
By the way, you get the same experience with another Sun sample: the DraggableMP3Player at
http://javafx.com/samples/DraggableMP3Player/index.html
That, too, thinks it's implementing it's own close button, and again the same problem occurs.
So it seems Stage.close() doesn't properly close the applet, and only the the little X in a box will do this.
I'd like to be able to really close the applet from my own code. How can I do this?
Many thanks
Nik
Edited by: nik.silver on Aug 6, 2009 12:48 PM

After double tap home button, swipe up on the app card that appears above the icon.

Similar Messages

  • HT201365 How do you close Apps in iOS 7? It doesn't work by double clicking power button.

    How do you close Apps in iOS 7? It doesn't work by double clicking power button.

    Double tap the Home button, then swipe upwards on the App Preview (not the App Icon)

  • TS3704 How are you supposed to fix "The feature you are trying to use is on a network resource that is unavailable" alert appears when you remove Apple software in Windows if it doesn't work on Windows 8 or 8.1???

    How are you supposed to fix "The feature you are trying to use is on a network resource that is unavailable" alert appears when you remove Apple software in Windows if it doesn't work on Windows 8 or 8.1???

    See Troubleshooting issues with iTunes for Windows updates. You may have to uninstall what you can, reboot and delete the named folders, then reinstall.
    tt2

  • Please please can some one tell me how do you charge ur ipad with ur laptop. it doesn't chage wen I put use the wire. only charges when I plug the socket in.

    please please can some one tell me how do you charge ur ipad with ur laptop. it doesn't chage wen I put use the wire. only charges when I plug the socket in. Iv never used an ipad b4 so don't really know much. Hope some one knowz.

    The quickest way (and really the only way) to charge your iPad is with the included 10W or 12W USB Power Adapter. iPad will also charge, although more slowly, when attached to a computer with a high-power USB port (many recent Mac computers) or with an iPhone Power Adapter (5W). When attached to a computer via a standard USB port (2.5W, most PCs or older Mac computers) iPad will charge very slowly (but iPad indicates not charging). Make sure your computer is on while charging iPad via USB. If iPad is connected to a computer that’s turned off or is in sleep or standby mode, the iPad battery will continue to drain.
    Apple recommends that once a month you let the iPad fully discharge & then recharge to 100%.
    How to Calibrate Your Mac, iPhone, or iPad Battery
    http://www.macblend.com/how-to-calibrate-your-mac-iphone-or-ipad-battery/
    At this link http://www.tomshardware.com/reviews/galaxy-tab-android-tablet,3014-11.html , tests show that the iPad 2 battery (25 watt-hours) will charge to 90% in 3 hours 1 minute. It will charge to 100% in 4 hours 2 minutes. The new iPad has a larger capacity battery (42 watt-hours), so using the 10W charger will obviously take longer. If you are using your iPad while charging, it will take even longer. It's best to turn your new iPad OFF and charge over night. Also look at The iPad's charging challenge explained http://www.macworld.com/article/1150356/ipadcharging.html
    Also, if you have a 3rd generation iPad, look at
    Apple: iPad Battery Nothing to Get Charged Up About
    http://allthingsd.com/20120327/apple-ipad-battery-nothing-to-get-charged-up-abou t/
    Apple Explains New iPad's Continued Charging Beyond 100% Battery Level
    http://www.macrumors.com/2012/03/27/apple-explains-new-ipads-continued-charging- beyond-100-battery-level/
    New iPad Takes Much Longer to Charge Than iPad 2
    http://www.iphonehacks.com/2012/03/new-ipad-takes-much-longer-to-charge-than-ipa d-2.html
    Apple Batteries - iPad http://www.apple.com/batteries/ipad.html
    Extend iPad Battery Life (Look at pjl123 comment)
    https://discussions.apple.com/thread/3921324?tstart=30
    New iPad Slow to Recharge, Barely Charges During Use
    http://www.pcworld.com/article/252326/new_ipad_slow_to_recharge_barely_charges_d uring_use.html
    Tips About Charging for New iPad 3
    http://goodscool-electronics.blogspot.com/2012/04/tips-about-charging-for-new-ip ad-3.html
    How to Save and Prolong the battery life of your new ipad
    https://discussions.apple.com/thread/4480944?tstart=0
    Prolong battery lifespan for iPad / iPad 2 / iPad 3: charging tips
    http://thehowto.wikidot.com/prolong-battery-lifespan-for-ipad
    iPhone, iPod, Using the iPad Charger
    http://support.apple.com/kb/HT4327
    Install and use Battery Doctor HD
    http://itunes.apple.com/tw/app/battery-doctor-hd/id459702901?mt=8
    To Extend a Device’s Battery Life, Get to Know It Better
    http://tinyurl.com/b67c7xz
    iPad Battery Replacement
    http://www.apple.com/batteries/replacements.html
    In rare instances when using the Camera Connection Kit, you may notice that iPad does not charge after using the Camera Connection Kit. Disconnecting and reconnecting the iPad from the charger will resolve this issue.
     Cheers, Tom

  • How do you add music to iPhone in Itunes it doesn't show up in the right hand corner anymore?

    How do you add music to iPhone in Itunes it doesn't show up in the right hand corner anymore?

    Reboot your computer. In iTunes go to View menu. Does it say Hide Sidebar? If it does look the iPhone in the left sidebar in iTunes.
    If it says Show Sidebar and you still don't see the iPhone on the upper right try choosing Show Sidebar and look on the left.
    If it's still not showing see: http://support.apple.com/kb/TS1538

  • You can't open Detour preferences because it doesn't work on an Intel-based

    i downloaded a program called 'Detour'
    it clearly should not have been installed on this computer.
    it is not in my applications folder, however it is a pane in my preference program. the error that comes up is this:
    "You can’t open Detour preferences because it doesn’t work on an Intel-based Mac"
    how do i find this troublesome program and delete it for good?
    much appreciate the help
    Foti

    Welcome to Apple Discussions.
    It may just be the preference pane. Right click on the Pref Pane in System Preferences and "Remove".
    Is it interfering anywhere else?
    If the app is not in your Applications folder and it exists, look in the Utilities folder.
    Alternatively, try AppCleaner
    -mj

  • Satellite T135 How to enter Safe Mode and HDD Recovery if "F8" doesn't work

    Hello everybody
    I have a Toshiba Satellite T135 Laptop and it has recently crashed. Since then, every time I switch it on, Startup Repair automatically gets enabled. But it fails repairing the error.
    I tried to resolve the problem with System Restore, but that didn't work either. So I think I have to go through the HDD recovery procedure.
    The problem is, that I have a lot of data on my laptop that I need to safe first. I wanted to do this via Safe Mode which I supposedly should be able to enter by pressing "F8" while initializing, when the Windows logo appears. But my laptop doesn't react when I press F8, but rather begins to make a alerting sound, if I press the button for a longer time.
    Apart from how to enter safe mode when pressing F8 while initializing doesn't work, I do have a second question: Is Toshiba Recovery Wizard the equivalent for HDD Recovery Procedure? That's the only similar option I've been able to find...
    Thank you very much for your advice.

    Hi buddy,
    Yes, the Toshiba HDD recovery option will wipe the *first* partition of HDD. Thats the partition where Windows is installed so all files on this partition will be deleted to restore the original out of box settings. If you have stored the data on this partition they will be deleted but all data on second partition will not be deleted.
    You can perform a backup if you buy an external HDD case as MisterX suggested. Put the notebook HDD into this case and connect it to another computer. Then you can back up all files that you need. :)

  • How can i stop the i tune pop force quit doesn't work

    hi ,
    please help " how can i stop the i tune pop force quit doesn't work"

    Refunds on downloaded software are virtually nonexistent.
    I have had cases where I purchase software on a physical disk. If I don't like the software I can uninstall it from my computer and sell it legally. Recouping most of my loss.

  • How do I delete items in my calendar when it doesn't work when I hover them over the trash can?

    How do I delete items in my calendar when it doesn't work when I hover them over the trash can?

    There are several ways
         - Selecting the event and hitting the "delete" key on your keyboard (as Wayne Contello said)
         - Selecting the event and opening the "edit" dropdown menubar item, and then selecting "delete"
         - Selecting the event and right clicking, then selecting "cut" (this option puts the event on your clipboard)

  • You can't open Sharing preferences because it doesn't work on an Intel-based Mac.

    I Am Running Lion And When I Open My Sharing Preferences This Error Comes Up: You can’t open Sharing preferences because it doesn’t work on an Intel-based Mac.
    If It HElps I Just Downloaded Apple Remote Desktop Client 210 And I Am Running OSX Lion And Have An I5 Core

    /system/library/preferencepanes/SharingPref.prefPane
    Is the location of the file with the problem. 
    Do you have your install dvd? or do you have a time machine backup?

  • How do you free memory when applet ends?

    I have an applet that uses 4 jframes. Any of the frames are set to call both stop() and destroy() whenever user clicks "Exit" or "X" in upper right corner of a frame.
    The applet destroy() method does the following:
    myAOS32001Frame = null;
    myAOS32002Frame = null;
    myAOS32003Frame = null;
    myAOS32004Frame = null;
    myMemoryChangeThread.stop();
    try {
    URL endedURL = new URL(this.getCodeBase(), "AOS320acEnded.html");
    this.getAppletContext().showDocument(endedURL);
    } // try
    catch (MalformedURLException urlexc) {
    urlexc.printStackTrace();
    } // catch
    This doesn't free up any memory at all. Only when the user closes the browser altogether does the memory free up.
    Do I have to set EVERY object (those within frames) to null? How do I set the main applet object (the JApplet class instance) to null (not just its child frames)? Should the garbage collector be run one last time? In what order should all these things occur?
    If every object needs to be set to null, anybody have a nice tidbit of code that loops through array of components (and properties) or something and sets them to null?
    Thanks.

    Thank you both for the tips. They were helpful.
    Now my mission is to make the applet as small as possible. It appears the base JVM occupies about 18MB of memory initially, and then my applet uses 12MB more (at times), and the JVM "reserves" about 10MB more.
    The only part under my control is the 12MB, it appears, and I'd be interested in general tips to make that as small as possible (maybe by using certain variable types instead of ones currently used, etc.). But I'll ask that in a different thread.

  • HT1430 How can you restart your iphone if your lock button does not work?

    How can you restart or turn off your iPhone if the lock button does not work?

    The best way is to let the battery die. Or you can reset the phone settings which restarts everything.

  • Within Music Library can anyone please explain why when I select the option to sort 'Album by Artist' a number of tracks are being treated as separate albums?  How can I correct this?  I have tried to 'drag and drop' but that doesn't work.

    Within music Library can anyone please explain why after I select the option to sort 'Album by Artist' a number of tracks are being treated as separate albums?  How can I fix this?  I have tried to manually correct by 'drag and drop' individual tracks but that doesn't work.  My music library includes a number of repeat album artwork images simply because not all tracks are being listed under the one album making my library more difficult to use than it should.  Any advise would be appreciated.

    See Grouping tracks into albums.
    tt2

  • How do I move music from iTunes to my iPhone? I have tried dragging and dropping and it doesn't work.

    I have tried dragging and dropping and have also tried creating a file called iPhone.

    Maybe you should read the manual:
    iPhone User Guide (For iOS 5.0 Software)
    If you want to drag and drop, then check the Manually manage music box. Otherwise sync your content.

  • How to use documentbeforesaved method? And why my code doesn't work in template files?

    Can someone help me with these two codes?
    ----Beginning of code 1-------------
    Private WithEvents App As Word.Application
    Private Sub Document_Open()
    Set App = Word.Application
    End Sub
    Private Sub App_DocumentBeforeSave(ByVal Doc As Document, SaveAsUI As Boolean, Cancel As Boolean)
    MsgBox("BeforeSave")
    End Sub
    --------------End of the code----------------
    Beginning of code 2--------------- Code 2 is from https://msdn.microsoft.com/en-us/library/office/ff838299(v=office.15).aspx
    Public WithEvents appWord as Word.Application 
    Private Sub appWord_DocumentBeforeSave _ 
     (ByVal Doc As Document, _ 
     SaveAsUI As Boolean, _ 
     Cancel As Boolean) 
     Dim intResponse As Integer 
    Private Sub App_DocumentBeforeSave(ByVal Doc As Document, SaveAsUI As Boolean, Cancel As Boolean)
    MsgBox("BeforeSave")
    End Sub
    In the first code, they have:
    Private Sub Document_Open()
    Set App = Word.Application
    End Sub
     I test these two codes in "This document" object, and I find out the first code works but the second code are not!
    Why second code doesn't work?
    Extra question: I am using microsoft 2013. I insert this code into a macro-enabled template. But when I am about to save my file I am expecting these code works. However, they didn't work!
    Thank you for solving these problem for me!

    Hello,
    Please note that the code snippet 2 in your post is different from the code snippet in the MSDN document. Also please read the comments of the MSDN code sample:
    This example prompts the user for a   yes or no response before saving any document.
    This code must be placed in a   class module, and an instance of the class must be correctly initialized to   see this example work; see
    Using Events with the Application Object for   directions on how to accomplish this.
    Public WithEvents appWord   as Word.Application
    Private Sub   appWord_DocumentBeforeSave _
     (ByVal Doc As Document, _
     SaveAsUI As Boolean, _
     Cancel As Boolean)
     Dim intResponse As Integer
     intResponse = MsgBox("Do you really   want to " _
     & "save the document?", _
     vbYesNo)
     If intResponse = vbNo Then Cancel = True
    End Sub
    So the problem in your code snippet 2 is that you didn't put it into a class module and initialize the class module. If you just put it into ThisDocument, you have to initialize the word application object.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • Proxy to File using EOIO

    Hi Experts, I have a scenario where I need to send data from SAP to PI so I am using proxy to file scenario. Here i need to send huge amount of data. In some blog i saw that proxy can handle only some maximum amount of data.(but not 100% sure how muc

  • How to manage windows cluster on windows server 2008 R2

    Hi I want to know how to properly shutdown or stop windows cluster with out failover or  failing it. I have successfully created windows cluster on win 2008 R2 sp1 using vmware with starwind software for SAN storage. Now when I  shut down or stop clu

  • Need some hints on using dbms_crypto

    Hello, I need some hints on using the dbms_crypto package to generate some password for the OID userpassword attribute. The passwordstring is stored in a format {CRYPT}dasdasdawdww, {SHA}jfsklefjskldjkdlkldf, {MD4}dfdsfgsdgdfewwe or {MD5}fsdfsdadsgdf

  • Is there a single sever supports both Jdev11 and Froms/Reports to deploy

    is there a single server to support both jdeveloper 11 and forms/reports to deploy on web. We currently have ias 10.1.2, deployed 10g forms/reports on web. we are developing new module in jdeveloper11. Can some one guide us, best way to integrate bot

  • What about to run color on a macbook black

    sorry, i dont know much abou color but, i just buy a macbook black, its recomended to run color on my computer???? thanks..