How to position the Stage at the first available place on the screen

Im creating a Stage,
but for any reason when I dont define x,y it shows in different places on the screen, and sometimes outside of the screen
if I set x=0 and y=0 I have problems, because some user, like me, use the taskbar on the top of the screen,
anybody knows how do workaround this ?
this is the code of my Stage
public class Game extends Stage {
    public var tick: Timeline = Timeline {
        repeatCount: Timeline.INDEFINITE
        keyFrames: [
            KeyFrame {
                time: 0.01s
                action: function() {
                    mainLoop();
    // main game loop
    public function mainLoop(){
        for (node in scene.content) {
            if( node instanceof Updatable){
                (node as Updatable).update();
    public function play(){
        tick.play();
}and this is how I'm using it
var game: Game = Game {
    title: "Cabecudinhos, episódio 1 o ataque dos mosquitos"
    x: 0
    y: 0
    width: 800
    height: 600
    scene: Scene {
        content: [
            background
            littleBox
function run(__ARGS__ : String[]) {
    game.play();
    soundtrack.play();
}

You can ask Java for that.
You can just center the stage on screen, that's quite easy given the screen dimensions:
import java.awt.*;
var dim: Dimension = Toolkit.getDefaultToolkit().getScreenSize();
println("Screen is {dim.getWidth()}x{dim.getHeight()}");I suppose it works for main screen, there is code to get the info for all screens (if several are connected).
If you need to know the placements of the taskbar and other bars, you need to get the insets, which is a bit more convoluted.
var ge: GraphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
var gsl: GraphicsDevice[] = ge.getScreenDevices();
var gcl: GraphicsConfiguration[] = gsl[0].getConfigurations();
var ins: Insets = Toolkit.getDefaultToolkit().getScreenInsets(gcl[0]);
println("Insets are T {ins.top}, L {ins.left}, B {ins.bottom}, R {ins.right}");It shows B 34 for my setting and T 34 if Windows' taskbar is on top, etc.

Similar Messages

  • Why the constructor of the base class calls first when u run the java app.

    why the constructor of the base class calls first when u run the java application

    For the record the other very exciting questions are:
    pls give the differences between application server and web server with examples
    will u pls narrate the differences between servlet context and servlet config.....
    where can we find servlet config...
    is there any methods to access servlet config

  • Can I get the refund on that first month after paying the $80 cancellation fee ?

    I recently canceled my subscription after paying for one month.
    Can I get the refund on that first month after paying the $80 cancellation fee ?

    From this document< " Cancel your membership or subscription | Creative Cloud"
    If you cancel within the first month, you receive a full refund. Otherwise, you are billed 50% of your remaining contract obligation.
    From what i understand, you cannot get  your refund for the previous month.
    Thanks,
    Preran

  • What are the different kinds of tools  available to cleanup the siebel file

    Hi All,
    Please let me know What are the different kinds of tools available to cleanup the siebel filesystem.
    Thanks in advance
    Tusar

    assuming that you installed Siebel Server under d:\D:\dba81
    cd D:\sba81\siebsrvr\bin
    1) reporting mode
    sfscleanup.exe /u SIEBEL-USER /p SIEBEL-PASSWORD /C SIEBEL-DATA-SOURCE /d SIEBEL-TABLE-OWNER /f SIEBEL-FILE-SYSTEM /m SIEBEL-FILE-SYSTEM-FOR-INCORRECT_FILES /r Y /x "D:\sba81\siebsrvr\log\sfscleanup_report.log"
    2) Real execution
    Replace /r Y by /r N
    Best Regards
    EvtLogLvl

  • F-44: The Re-document not appear available to do the clearing.

    Hi
    Experts
    Hi,
    We need help to understand what hapen with the consult of vendor XXXXX
    When we consult this vendor on transaction FK10N we see the information detailed on the attached file.
    But when I try to do the clearing and try the transaction F-44, the re-document not appear available to do the clearing.
    But when I try to do the clear vendor on F-44 the documents ( 4000000419   1700000135 and 1500000456 ) not appear and I not understand why?
    But this Document No's are seen in FBL1N as a Open Items and also as a Cleared Items, But not able to see in F-44
    4000000419    06/27/2011
    1700000135    07/14/2011
    1500000456    03/30/2011
    Could you please help me with this issue?
    Anil

    hI
    Friend,
    I Checked SE11 REGUP table, if the documents You don't see by F-44 are already contained into a payment proposal.
    If Yes, You should delete the F110 payment proposal to see them by F-44.
    I deleted the payment proposal, even though Iam not able to see the docuements in F-44. what to do?
    I Checked the table BSIK and Also BSAK it is showing this docu nos.
    Anil

  • Why is the MacBook Pro no longer available in a 17" screen?

    Why is the MacBook Pro no longer available in a 17" screen?

    No one here knows why Apple decided to discontinue the 17" screen.  This is a user to user community.  Click on the Contact Us link at the bottom of this website.  Write a letter to Apple & ask them.  If they respond please post it. 

  • HT1725 The files seems to be corrupted.  To redownload the file, choose "Check for Available Downloads" from the Store menu.

    While downloading apps from iTunes Store following error is repeatedly coming "The files seems to be corrupted.  To redownload the file, choose "Check for Available Downloads" from the Store menu."? Please suggest any solution.

    Contact itunes support.

  • How do I view a message in the reading pane without first having to open the message?

    On my previous e-mail system, I was able to read the text of an incoming message in the reading pane below the selection of incoming messages without first having to open the incoming message about which I was curious. This had the advantage of allowing me to review and delete messages that appeared to be suspicious to me without first opening them and exposing my computer to the danger of an incoming & unwanted virus, etc. I am not able to do this with the new e-mail system and I an unable to find instructions on how to do this with your "Help" inquiry. Does Firefox have this capability? If so, how do I access it?

    Firefox has no email features, it is just a web browser.
    If you are using a web based email service such as Gmail or Hotmail, you will need to contact the support for the email service to see if they offer the feature that you want. Any email features will be part of the web based email service.

  • I have ios7.1.2 on my iphone and am trying to upgrade to 8.0.2. I haven't installed 8 yet and when I try and upgrade nothing happens.  It says just the improvements from 8 are available but not the whole ios.  What to do?

    I have ios7.1.2 on my iphone and am trying to upgrade to 8.0.2. I haven't installed 8 yet and when I try and upgrade nothing happens.  It says ios8.0.2  improvements from 8.0.1 are available but not the whole ios.  What to do?

    It sounds like maybe 8.0.1 has downloaded onto your phone but not installed. You can check for it in Settings > General > Usage > Storage, Manage Storage. If it's there you should see it at the top of the list of apps. Swipe to delete it. 8.0.1 was pulled by Apple quickly after it was introduced due to issues and replaced by 8.0.2. Once it's deleted you should be able to download and install 8.0.2.

  • Keep receiving the iTunes error:  The file seems to be corrupted.  To redownload the file choose "Check for available downloads" from the store menu.

    I keep getting the above error.  When I go through the store tab, I continue to get the same message.  I found something about deleting the tmp file earlier today at another site but it was related to an older version of iTunes and was of no real help.
    All I want to do is download the song I've been charged for.
    Solutions?

    Contact itunes support.

  • HT1212 how do i reset my i pod first generation  ive forgotten the pass word

    how do i reset i pod first generation

    See Here  >  http://support.apple.com/kb/HT1808
    You may need to try this More than Once...  Be sure to Follow ALL the Steps...
    After you have Recovered your Device...
    Re-Sync your Content or Restore from the most recent Backup...
    Restore from Backup  >  http://support.apple.com/kb/ht1766

  • How do I migrate an ipad to a new computer if the old computer is not available to retrieve the backup file from?

    I've read lots about using the "transfer purchases" option, but the person I'm helping is very afraid of losing data, etc.

    Read this thread completely and carefully.
    https://discussions.apple.com/thread/3305461
    If you follow the advice/suggestions that King Penguin and Demo (me) posted in this thread, you will be able to transfer everything from your iPad to another computer - even if you no longer have access to the old computer.
    Transferring purchases is a breeze and it WILL work.  Just follow the instructions. Remember to turn auto sync OFF in iTunes before you connect the iPad to the computer and launch iTunes. And remember to Transfer Purchases and Backup before you proceed with anything else. The data that you are worried about losing is contained in the iPad backup when you manually create the backup - hence the importance of backing up before syncing.

  • How to position a check box in an ABAP query's selection screen?

    Hi Experts,
    I am working on SAP queries and for that I have created an infoset. There was a requirement to have a checkbox at selection screen, which we can obtain by Infoset-> Extras->"Selections" tab -> create a parameter as a checkbox.
    However, it is appearing at the first place among all the selection screen elements which are defined in the infoset.
    Is there any way to have it positioned as per the requirement? (We have checked the option of "sequence on selection screen" provided while creating the checkbox, however, it does not work for us).
    Kindly have a look at the attached screen shots.
    Here , in the file, “Test Par” is the selection text for the parameter declared.
    Thanks
    Mohit

    I think I have it 90%there. I have no error now, it edits a
    record fine, if you add the checkbox to the record it adds it, and
    if you take it away, it does that. BUT now it will not add a new
    record.
    This is my code now for the update / insert
    <cfif not IsDefined("FORM.admin")>
    <cfset IsAdmin= 0>
    <cfelse>
    <cfset IsAdmin= 1>
    </cfif>
    <cfif isDefined("Form.RecordID")>
    <cfquery datasource="#APPLICATION.dataSource#">
    UPDATE user
    SET user.Fname=<cfqueryparam cfsqltype="cf_sql_varchar"
    value="#form.Fname#">,
    user.Lname=<cfqueryparam cfsqltype="cf_sql_varchar"
    value="#form.Lname#">,
    user.userName=<cfqueryparam cfsqltype="cf_sql_varchar"
    value="#form.userName#">,
    user.password=<cfqueryparam cfsqltype="cf_sql_varchar"
    value="#form.password#">,
    user.email=<cfqueryparam cfsqltype="cf_sql_varchar"
    value="#form.email#">,
    user.admin =<cfqueryparam value="#IsAdmin#"
    CFSQLType="CF_SQL_INTEGER">
    WHERE ID =<cfqueryparam value="#form.RecordID#"
    cfsqlType="CF_SQL_INTEGER">
    </cfquery>
    <cflocation url="indexUser.cfm?RecordID=#Form.RecordID#"
    addtoken="no">
    <cfelse>
    <cfquery result="GetNewRecord"
    datasource="#APPLICATION.dataSource#" dbtype="ODBC">
    INSERT INTO user
    (Fname, Lname, userName, password, email, admin)
    VALUES (<cfqueryparam cfsqltype="cf_sql_varchar"
    value="#form.Fname#">,
    <cfqueryparam cfsqltype="cf_sql_varchar"
    value="#form.Lname#">,
    <cfqueryparam cfsqltype="cf_sql_varchar"
    value="#form.userName#">,
    <cfqueryparam cfsqltype="cf_sql_varchar"
    value="#form.password#">,
    <cfqueryparam cfsqltype="cf_sql_varchar"
    value="#form.email#">,
    <cfqueryparam value="#IsAdmin#"
    CFSQLType="CF_SQL_INTEGER">)
    </cfquery>
    <cflocation url="indexUser.cfm">
    </cfif>
    Is there a better way to write this so it will work? I have
    everything else working including the checkbox showing checked if
    it is checked in the db, I believe this is my last hang up on a
    checkbox.
    Any ideas?

  • Is the Azure Files data highly available/replicated under the covers?

    I am assuming that with Azure Files, under the covers data is replicated multiple times for High Availability.  Is that correct?  For some applications, typically failover application, where the application doesn't assume highly available storage;
    the applications themselves build logic to either replicate/sync data.  An example is Elastic Search.  In these cases, the system lands up making too many copies.  Is the Azure File Semantic the same as blob store, in this regard.

    Hi,
    Would request you to refer to the article below to understand Azure File Service (in preview now):
    Introducing MS Azure File Service
    http://blogs.msdn.com/b/windowsazurestorage/archive/2014/05/12/introducing-microsoft-azure-file-service.aspx
    Below article helps us understand the same better with a "how-to" perspective:
    The Azure File Service
    http://clemmblog.azurewebsites.net/azure-file-service/
    Lastly, would like to keep you informed on the Features Not Supported By The Azure File Service
    http://msdn.microsoft.com/en-us/library/azure/dn744326.aspx
    Thank you,
    Arvind

  • I have a 2 year old iPad and have upgraded the iOS as they came available.  Currently the iPad runs iOS 7.03.  Today a friend was talking about "Personal Hot Spots".  His iPad displays this option via 'setting', but is not even listed on mine.  Plse help.

    I have a 2 year old iPad updated to iOS 7.03.  For some reason "Personal Hotspot" does not even come up as an option in " Settings" .  I do not know if it was there in previous iOS versions as I've only just heard of it.  I have tried it on 3G and WiFi.  I have entirely deleted my WiFi and rebooted the iPad, all with no joy.
    Any assistance would be greatly appreciated. Thankyou

    As Stated... The iPad 2 does not offer this Feature.
    iOS System Requirements  >  http://support.apple.com/kb/HT3574
    Understanding  >  http://support.apple.com/kb/HT4517

Maybe you are looking for

  • API Error Handling

    I want to create store procedure that reads datas from text file and using API to create the record in database. I've try to write the simple code by follow the code example in "Oracle Order Management Suit API and Open Interface". I have the followi

  • Windows 7 machine can't find a driver for my laserjet 1200 PCL networked ...

    ... thru an XP Pro machine. How do I resolve this?  Every other computer in the house...running XP or Vista...can access this printer.  Why not my new Toshiba laptop? Jim Baker [email protected]

  • Warning message from mackeeper

    When I try to open new page "your mac may have been infected" sign popped up and I click to Ok to get rid of the message and this message came up next If you don't remove these potential virus, they may infect your system files and damage your hardwa

  • Forecast Transfer from APO to R/3

    Hi All, We have an issue wherein we wanted to transfer the forecast to R/3 for non-working weeks. We are planning in APO in weekly buckets. So, when we transfer the forecast for a week which is completely marked with non-working days at R/3, we want

  • Help with galleries

    Hello, I'm Javier and today I started using Project Siena. I've made a photo gallery and I've added a button to it, but I want each photo to have a button that leads to a different screen, and I don't know how to do it.... Here's an image of it: Than