What's the easiest way to have a message box?

Hey, i'm making this game and i have one frame and i have and one panel inside, and when the user completes the game i want a message box to popup saying "Congratulations, You Won!"
At the moment when the user wins the game, i've just put a "System.out.println("You've Won"); but i want a message box to appear on top of the game. What's the best and simplest way to achieve this?
I tried replacing my "System.out.println("You've Won") with JOptionPane.showMessageDialog(null, "You Won!"); and that just caused the whole thing to freeze up.
Thanks

saru88 wrote:
I did as you suggested and changed the "null" in
JOptionPane.showMessageDialog(null, "You Won!"); to
JOptionPane.showMessageDialog(this, "You Won!"); to refer to the JPanel which contains the game code.And? Any benefit (unlikely)?
Sorry for my lack of explanation about freezing up, what happens is the message box appears, but the inside is completely transparent and so i can see the game display behind it. And if i click inside it, then it does nothing but change the focus to that window. When i said freeze before i meant, it becomes "non responding" and so I have to open "Task Manager" and close it that way. This sounds like a thread issue. Are you calling JOptionPane.showMessageDialog(...) off of the EDT, the Event Dispatch Thread?

Similar Messages

  • What's the easiest way to have datagrid including renderers disabled, with loading spinner?

    I understand how to fire my start loading / end loading events when a datagrid is being populated from external data. What I do not know how to do effecitively (and have been googling) is what's the best practice for making the datagrid appear as modal with a loading spinner on top of it?
    My train of thought of the approach is - onLoading,  Make existing datagrid not clickable, then set alpha to dim the current datagrid. Show a loading spinner on top of  the grid.
    I can set the alpha which gives it the modal appearance, but how to make it so the user can't click anything in the existing grid? Setting the grid to enabled=false sort of works, but there are some icons in an item renderer in the grid that at are still clickable. Do I have to manually disable all of them as well?
    Sadly, I'm suprised that googling for this hasn't turned up much. I know this must be a basic problem.

    hi,
    I would place the grid in a container and have 2 states when you want to load data you set the state to locked once data is loaded set state to normal, in locked state it will show a custom spinner, blur the container and disable the container which effectively blocks the Grid. I just included the button event so you could test the effect.
    David
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
    <fx:Script>
    <![CDATA[
    protected function button1_clickHandler(event:MouseEvent):void
    if (this.currentState == 'normal')
    currentState = "locked"
    else
    currentState = "normal";
    ]]>
    </fx:Script>
    <s:states>
    <s:State name="normal"/>
    <s:State name="locked"/>
    </s:states>
    <fx:Declarations>
    <s:BlurFilter id="lockGrid" blurX="4" blurY="4"/>
    </fx:Declarations>
    <s:Group x="199" y="131" width="655" height="381" enabled.locked="false" filters.locked="{[lockGrid]}">
    <mx:DataGrid right="0" left="0" top="0" bottom="0">
    <mx:columns>
    <mx:DataGridColumn headerText="Column 1" dataField="col1"/>
    <mx:DataGridColumn headerText="Column 2" dataField="col2"/>
    <mx:DataGridColumn headerText="Column 3" dataField="col3"/>
    </mx:columns>
    </mx:DataGrid>
    </s:Group>
    <!--<mx:SWFLoader id="myspinner" source="spinner.swf" includeIn="locked" verticalCenter="0" horizontalCenter="0/>-->
    <s:Button x="199" y="538" label.normal="Disable Grid" label.locked="Enable Grid" click="button1_clickHandler(event)"/>
    </s:Application>

  • I am using Iphoto 11 ver 9.4.3 on mac using oxs 10.8.5 i want to export calendar projects to an external hard drive. what is the easiest way to do this? i have tried export and import but it didn't seem to work.

    I am using Iphoto 11 ver 9.4.3 on mac using oxs 10.8.5 i want to export calendar projects to an external hard drive. my goal is to store them in an external hard drive so it doesn't use up memory on the mac hard drive. is it possible to copy the specific projects without copying the entire library? what is the easiest way to do this? i have tried export and import but it didn't seem to work.

    What do you not understand?
    You can duplicate the iPhoto library (command - D ) and delete everything except the project and its photos from the copy and move that
    Or
    However the calendar takes very little space - it is simpy database entries - it is the photos in the calendar that take space - and for most people you would wnat to keep those photos in your library
    you can use a photo in 50 calendars and it still is only one photo in your library - as I explained calenders do not exist as such - they are simply database entries telling iPhotop how to display the calendar - they take almost no space at all
    LN

  • I have a mid year 2007 24 inch iMac and will be purchasing a new 27 inch Retina iMac, what is the easiest way to transfer the data and files from my old machine to the new one?

    I have a mid year 2007 24 inch iMac and will be purchasing a new 27 inch Retina iMac, what is the easiest way to transfer the data and files from my old machine to the new one?

    Following up on this thread,
    I have a new iMac on the way and my current is from 2008, never had a problem but I am sure there are internal issues that I would prefer not to transfer.
    I have no issues other then the slowness in certain programs and that is the main reason to buy a new one.
    Programs like numbers and pages seem to take a longer time to open after I update to Yosemite.
    I only use 272GB of 500 GB, my memory is 4GB and I am upgrading to 8Gb and bought the 4.0 processor.
    Question:
    Is there a way to manually transfer items or would that be a waste of time in that if there are issues they could be anywhere and would transfer anyway?

  • What is the easiest way to access the router from an iPad?  I have no problems accessing it from my laptop.  Even though I am entering the address in the left address box, not the Google search box, it wants to do either a search, or add www beginning of

    What is the easiest way to access the router from an iPad?  I have no problems accessing it from my laptop.  Even though I am entering the address in the left address box, not the Google search box, it wants to do either a search, or add www to the beginning of the IP address.
    I usually can eventually access the router, but it is way to much trouble.  However, I use my iPad hundreds of times more often than my laptop.

    Are you typing http:// in front of the IP address of the router? e.g. http://192.168.0.1
    Sometimes, and with some routers it doesn't seem to like it if you miss off the http://

  • I have a new iMac. I have set up a user page for myself, for my wife and an administrator page. My question is my wife needs files from my user page transferred to her page. What's the easiest way?

    I have a new iMac. I have set up a user page for myself, for my wife and an administrator page. My question is my wife needs files from my user page transferred to her page. What's the easiest way?

    I've done this by dragging files from my user page to her drop box. In Finder, drag the required files and hover over the hard disc icon in the navigation bar on the left. As you hover, it will open another finder window showing the contents. Work your way down these windows into <Her username | Public | Dropbox>. Drop the files into the dropbox. She can then retrieve them from her user page.
    Good luck,
    Stephen

  • I have an Iphone 4 and want to copy my photos to my windows PC, what is the easiest way to do this?

    I have an Iphone 4 and want to copy my photos to my windows PC, what is the easiest way to do this?

    Your PC should recognise the iPhone as a camera and you can simply treat it as one.
    Programs like Photoshop can import photos from it or you can use Camera and Scanner Wizard to import instead.
    You can also double-click the iPhone in My Cmputer and drag and drop

  • I have a bunch of .pmd files that I have to have access to.. I am trying to convert to .pdf. what is the easiest way to do this with updated computers?

    I have a bunch of .pmd files that I have to have access to.. I am trying to convert to .pdf. what is the easiest way to do this with updated computers?

    Then you can’t do anything with those files. Even opening them in InDesign would yield very unpredictable results.
    You’d need to find an old machine running nothing later than Windows XP and then buy a copy of PM which is like lighting money on fire.
    That said, someone might come along willing to help out but just exactly how many is a bunch?

  • I have too much music for one ipod.  What's the easiest way to sync half of my library on to one ipod and the other half to another?

    I have too much music for one ipod.  What's the easiest way to sync half of you library on to one ipod and the other half on to another?

    Make playlists and choose whatever playlists you want to sync

  • What is the easiest way to transfer music from my ex's itunes library to mine? We both have Macbooks and we do have home sharing.

    Over the years my ex's and I bought tons of music off itunes, but always bought it on her Macbook. Now that we aren't together I want to copy all of the music from her itunes library and import it into mine. Is this possible, and what is the easiest way?
    Many Thanks

    the simplest way, assuming all your media files are in the default location, would be to connect the two Macs with a firewire cable, boot the source Mac in Target Disk Mode, and copy the entire iTunes folder (not just the iTunes music folder) from <MacintoshHD>/users/yourname/music on the source to <MacintoshHD>/users/yourname/music on the target (overwriting the iTunes folder in place there).
    that would ensure everything (including playcounts, ratings, original "date added", which home sharing doesn't copy over) will be transferred. it would also ensure that any mobile devices (iPhone, etc.) will simply keep on syncing without problems.
    you can also use an external HD (or your LAN) but make sure to copy the entire iTunes folder.

  • What is the easiest way to create and manage very big forms?

    I need to create a form that will contain few hundred questions. Could you please give me some advise on what is the easiest way to do that? I mean for example is it easier to create everything in Word (since it is easier to manage) and than create a form based on that?
    My concern is that when I will have a very big form, containing different kinds of questions and with many scripts, managing it during work will be slow and difficult, for example adding a question in the middle of the form which would require moving half of the questions down which could smash the layout etc.
    What is the best practise for that?
    Thanks in advance

    Try using Table and Rows for this kind of forms. These forms will have the same look throught with a question and and answer section..
    In the future if you want to add a new section, you can simply add rows in between..
    Thanks
    Srini

  • I want to use 1 itunes account but with 3 different iphones 2 for the kids and one for me, what is the easiest way to do that?

    I want to use 1 itunes account but sync 3 different iphones, 2 for the kids and 1 for me.  So I would like to have different programs, songs, apps etc for each phone.  What is the easiest way to do that

    Agreed heather. Also, if you have three users on the same account how do you keep phone calls and messages from going to all three phones?

  • What is the easiest way to transfer a large imovie project from one computer to another in a different location.

    What is the easiest way to transfer an faairly large HD imovie project from one computer to another in a different location. Can you export to drop box? Will the other computer need the exact imovie version?

    OK it depends.
    If you have a finished movie, you can SHARE/EXPORT MOVIE and create your final movie. Then, depending on the size of the finished movie, you can transfer via dropbox or similar service. Ninety minutes is a very long movie for iMovie, but it may work for you. I would suggest 720P to keep the size down.
    If you need to transfer the entire iMovie Project so it can be edited in iMovie at the other end, then you need to transfer the project and event assets to an external hard drive and get the hard drive to the other location.
    Directions are here. Follow the directions for 1) Moving or copying Project to external drive. Then 2) Consolidate Media.
    https://discussions.apple.com/docs/DOC-4141

  • What's the easiest way to add storage to a mac mini. (1TB hard drive but only 32G of real storage). External device, internal or partitioning?

    What's the easiest way to add storage to a mac mini. (1TB hard drive but only 32G of real storage). External device, internal or is there some way to partition? I tried doing so but received a message that there wasn't enough free space to partition. Seems like a 1TB drive should have more storage than my Ipad

    Its worth confirming what free space you have on your drive: 
    go to:   Apple Menu > About this Mac >  More Info > Storage
    The bar chart shows how much free space there is on the drive:
    Please realise that partitioning does not create extra space so this wont help you.
    If your free space is less than 20 % you should get extra storage with an external USB or Firewire drive, any make or model will work.

  • What's the easiest way to move app data and data structures to a server?

    Hi guys,
    I've been developing my app locally with Apex 4.2 and Oracle 11g XE on Windows 7. It's getting close to the time to move the app to an Oracle Apex server. I imagine Export/Import is the way to move the app. But what about the app tables and data (those tables/data like "customer" and "account" created specifically for the app)? I've been using a data modeling tool, so I can run a DDL script to create the data structures on the server. What is the easiest way to move the app data to the server? Is there a way to move both structures and data in one process?
    Thanks,
    Kim

    There's probably another way to get here, but, in SQL Developer, on the tree navigation, expand the objects down to your table, right click, then click EXPORT.. there you will see all the options. This is a tedious process and it sucks IMO, but yeah, it works. It sucks mostly because 1) it's one table at a time, 2) if your data model is robust and has constraints, and sequences and triggers, then you'll have to disable them all for the insert, and hope that you can re-enable constraints, etc without a glitch (good luck, unless you have only a handful of tables)
    I prefer using the oracle command line EXP to export an entire schema, then on the target server I use IMP to import the schema. That way, it's near exact. This makes life messy if you develop more than one application in a single schema, and I've felt that pain -- however -- it's a whole lot easier to drop tables and other objects than it is to create them! (thus, even if the process of EXP/IMP moved more than you wanted to "move".. just blow away what you don't want on the target after the fact..)
    You could use oracle's datapump method too.
    Alternatively, what can be done, IF you have access to both servers from your SQL developer instance (or if you can tnsping them both already from the command line, you can use SQL*PLUS), is run a script that will identify your apex apps' objects (usually by prefix to object names, like EBA_PROJ_%, etc) and do all the manual work for you. I've created a script that does exactly this so that I can move data from dev to prod servers over a dblink. It's tricky because of the order that must be executed to disable constraints and then re-enable them, and of course, trickier if you don't consistently prefix ALL of your "application objects"... (tables, views, triggers, sequences, functions, procs, indexes, etc)

Maybe you are looking for

  • What to do when your Game Center won't connect with the game?

    My game center won't connect to the game I'm trying to play and what is happing is the game would come one. But when its loading it will stop right in the middle of it and won't do anything. I don't know if its the game or game center. I believe its

  • Iphoto 9.4.2 constantly crashing on opening and after repair

    I am using a MacBook Pro 15" retina. OSX 10.8.2 iphoto 11 version 9.4.2 After uploading a batch of new photos, I pressed the info button for one of the photos and iphoto quit unexpectedly. I have tried the following: - repairing permission - repairin

  • Why is there a restriction on window size in Pages 5.0? And is there a way to make the window smaller anyway?

    I like to work with multiple windows open on the same screen at once. Now the smallest allowed width of the window takes up over half the screen (I have a 13 inch macbook)! This restriction is here whether or not I am zoomed in or out. Can I get arou

  • Conditional GROUP BY

    Hi I need a SQL report to conditionally display fields based on the value of a bind variable. I can achieve this via the interactive reports feature conditional display but I need to remove the GROUP BY for that field at the same time. How can I have

  • Error Cannot Import registry file

    HI All,  I have managed to redirect outlook profile using import/export registry file. ( GPO -Start up/logoff script)  But some PC's i found this error: Cannot import h:\outlook.reg : error opening the file. There may be a disk or file ssytem error.