SetLocation on a JLabel only sets it for a few milliseconds

My main class extends JFrame, and I have two panels gameArea and commandArea. I set the Layout of the content pane to BorderLayout and placed JPanel gameArea in the Center and JPanel commandArea in the South. I didn't specify a layout for gameArea, although I believe it uses FlowLayout by default. I added my JLabel test to gameArea. I have a timer whose event fires every 10 milliseconds.
I'm writing a typing tutor program for a class. The program is supposed to scroll a word down the screen, and if you type it before it hits the bottom you get a point. When you type a letter it uses HTML in the JLabel to increase the font size of the letters you've already typed.
What I initially did was use Graphics.drawString to draw the word to the gameArea JPanel, but that produced a lot of flickering. What I'm doing now is using setLocation to move my JLabel (which contains the word) down the screen. The Timer event calls setLocation. I use the keyTyped event to grab the keystrokes.
This looks much smoother, except the word still flickers at the top center of my window while it's moving down the page. If I don't type anything it looks fine, but once I start typing it starts flickering. If I click the Pause button, which stops the Timer, the JLabel moves up to the top center of my window and sits there.
I've tried gameArea.setLayout(null) but then the JLabel doesn't appear on the screen at all. Any thoughts?

You must set gameArea's layout to null, and set the size of your label because without layout the size will not be computed and you won't see the label...
Hope this helped,
Regards.

Similar Messages

  • My Ipod touch is in recovery mode but when I go to restore it in itunes it only stays connected for a few seconds then ejects itself. How do I keep my ipod on long enough to restore it?

    My Ipod touch is in recovery mode but when I go into Itunes to restore it, it will only stay connected for a few seconds then ejects itself from itunes. How do I keep my Ipod connected long enough to go through the restore process?

    Error 1611
    This error typically occur when security software interferes with the restore and update process. FollowTroubleshooting security software issues to resolve this issue. In rare cases, this error may be a hardware issue. If the errors persist on another computer, the device may need service.

  • TS1559 HELP!! I should automatically connect to wi-fi, it Wont! when i tell it to.... it only stays conected for a few seconds.

    Hi my iphone suddenly doesn't want to connect automatically to wifi!
    Even When I tell it to....
    It only stays connect for a few seconds.
    You return to wifi to find its turned off.
    The process starts again & Again & Again.
    With no success!
    Works fine on cellular data. I'm trying to update files that require you to connect to wi-fi,
    Because some Files are to big to update/upgrade using cellular dara?cellular!
    Has anyone else had this problem & worked out how to fix it.
    Please please please, help me!
    Remaining employed depends on it!! Thanks

    That is how your ipad is designed to work.
    Maybe try resetting network settings. If all else fails you can do a back up and restore as new to be certain there is no issue with your software.

  • Help! When I try to purchase a song from iTunes and have agreed to the terms and conditions, it then tells me that my session has timed out... but I've only been trying for a few minutes. I can't buy songs if it keeps doing this!

    Help! When I try to purchase a song from iTunes and have agreed to the terms and conditions, it then tells me that my session has timed out... but I've only been trying for a few minutes. I can't buy songs if it keeps doing this! Does anyone know why it's doing this and how to fix it? Thanks!

    Hi mterry1723, one solution that might be worth trying is this:
    - Close iTunes, if it's open
    - Open Safari and got to 'Preferences'
    - Select 'Security' on the top
    - Untick all the security options in the menu
    - Click the 'Show Cookies' button and look for all the 'apple' entries in the left-hand column.
    - Highlight them (select them collectively) and press 'Remove'
    - Now open iTunes and buy the song as usual.
    - You may be asked to do the same security process as before, so do as asked.
    - Hopefully, the security check will now have accepted your answers and start downloading the song as normal.
    Remember to re-tick all the required security options you had just un-ticked in Safari preferences. You don't need to bother about opening the cookies again.
    I hope this has worked for you and my profoundest apologies if it has not. Worth a go, though!
    I did see this thread: https://discussions.apple.com/message/18259935#18259935 which may be of more help, mainly the last entry by 'c2boyd'
    Message was edited by: Bongomal

  • Why is my mac so slow i have cleansed and cleaned it is a 2010 mac mini i5 but it runs like a 20 year old pc i have only had it for a few months and it was straight out of the box

    why is my mac so slow i have cleansed and cleaned it is a 2010 mac mini i5 but it runs like a 20 year old pc i have only had it for a few months and it was straight out of the box

    I'm thinking that you have a > Mac mini (Mid 2011) - Technical Specifications because the 2010 model's only have Core 2 Duo processors and the 2011 had the first i5 processor. 
    2 GB of RAM is the minimum requirement for Mountain Lion, but it's hardly enough to really enjoy doing anything else.
    see > Memory and Free Installation Guides for Apple Mac Mini
    Plus I don't have any problems running Mountain Lion and a load of App's on my 2010 Mac Mini with 8GB of RAM.

  • HT2486 the photos that I add to address book will only be there for a few seconds after I close the edit button. Either they go away completely or they a very small portion of the actual photo

    the photos that I add to address book will only be there for a few seconds after I close the edit button. Either they go away completely or they are very small portion of the actual photo

    Frank, thanks for your note.  I wrote "COMPLETED" because I had gone to a lot of effort to get the content of the book precisely as I wanted it. I would fully expect to see my level of effort and care matched by functional competence in Aperture 3 to render the book the way I created it.  Too much to ask?
    And yes, I upgraded the Aperture 2 Library first.  [Not ALL my tens of 000s of pix, because I use Lightroom selectively for photo editing. But Yes to the Aperture 2 Library.]  That step took a number of minutes, but seemed to work fine (no error messages of any kind).
    Then I opened the existing book project in Aperture 3, which followed some "magic-box" process that took a minute or so.  As I said, when that step was done, by all appearances the book was ready to submit for printing - until I examined the photos a little more closely.  You did see the blurry example I included, didn't you? That is what each and every photo looks like.
    Text-box content appears to have been rendered pertectly, for the record (including captions).
    So, ... is this result something you have heard of before?  Do you know of a one-step solution?  Or am I looking at an extended picture-by-picture fix?

  • I'm not happy at all with my Ipad I only had it for a few monthes and I found a lot of things wrong with it like it wont charge only one earbud works when i watch videos or listen to music but both work when I'm facetiming

    I'm not happy at all with my Ipad I only had it for a few monthes and I found a lot of things wrong with it like it wont charge only one earbud works when i watch videos or listen to music but both work when I'm facetiming

    Contact Apple to take advantage of your standard 1 year warranty.

  • My Dock Connector to VGA Adapter only shows up for a few seconds

    Hello, and as the title says, I have some problems with my VGA adapter.
    I am using iOS 8.1 with the iPad (3rd Generation)
    So far, I have only got it to work twice, when I plugged it in, appeared for a few seconds, then disappears off my screen.
    The second time I plugged it in, it worked for 1-2 seconds, then a message came up saying that the accessory may not be supported and when I pressed the button it was gone again.
    The VGA cable and screen was working when I plugged in the Thunderbolt to VGA adapter so I think there has to be a problem with the iPad adapter or something.
    If anyone is able to give help, I would be grateful.
    Thank You

    Ah, that does make a difference. Orange is the color of the light when it's charging. The LED can be, and sometimes is, really red when there's a hardware problem, but it never should be red. If yours is never really red, that's good.
    Read the article I've linked below, with particular attention to item 3 under "Troubleshooting". I suspect the power supply in your house, or at least at the outlets you've tried, is very noisy. But testing with a different AC adapter may tell the tale, and testing with both adapters in a different building might confirm the conclusion.
    http://support.apple.com/kb/TS1713

  • My iPad suddenly started to show crazy colors.  I turned it off and had to use the two button trick to turn it back on.  Now it shows only green stripes for a few seconds and goes back to sleep.

    My iPad suddenly started to show crazy colors.  I turned it off.  It would not reboot until I used the two-button reboot.  Now it shows only green stripes.  only for a few seconds and goes back to sleep.  HELP!

    Standard troubleshooting...
    1. Try a Restart by pressing the sleep/lock button until you see the slider.  Slide to power off.  Restart by pressing the sleep/lock button until you see the Apple logo.
    2. Try a Reset by pressing the home and sleep buttons until you see the Apple logo, ignoring the slider if, it comes up. Takes about 5-15 secs of button holding and you won't lose any data or settings.
    3. Remove all apps from Recently Used list...
    - From any Home Screen, double tap the home button to bring up the Recents List
    - Tap and hold any icon in this list until they wiggle
    - Press the red to delete all apps from this list.
    - Press the home button twice when done.
    4. If still a problem restore with your backup.
    5. If still a problem restore as new, i.e. without your backup. See how it runs with nothing synced to it.
    6. If still a problem, it's likely a hardware issue.

  • My wife and I both have iPhones, we just got a iPad air. Can we use iPad together or can we only set up for one?

    My wife and I both have iPhones, we just got a new iPad air. Can we set it up for both of us or should we give it it's own setup separate from our phones?

    It's a trust issue. You can set them up so you don't receive each other's messages as long as you each have your own email address.
    The trust issue is the fact that either of you can change the separation at any time via Settings by checking the appropriate (inappropriate?) email address.
    To be absolutely sure you can never receive each other's messages will require two Apple IDs.

  • Purchased songs seem to only stay on for a few days, then I have to re-sync

    Songs that I've imported from CD stay permanent on the IPOD. But songs that I've purchased through iTunes seem to only stay on a few days then only the titles/playlists are there for them. It won't play them, but instead will just advance through the playlist.
    A possible related symptom, before this happens, when I turn on the iPod, it gets the apple symbol which I assume means it is booting up as opposed to just waking up.
    Is it normal for purchased songs to have a "shelf life" then they expire? I would assume they are saved to the hard disk like any other songs.
    Has anyone encountered this or do you know a rememdy for my problem?

    Any ideas from anyone?

  • How to set discount for first few customers???

    If a company plans to offer a new scheme in which first 100 customers will get 20 % discount and after that normal rates from 101st customer onwards. How to do the settings for the same.

    Hi,
    No automatic solution
    For this you can mange with PROCESSING status of condition record at initial stage it is released status once discount consumed by 100 customer then set status as block in condition record(before 101 customer can order)
    VK11/VK12
    Menu EXTRA >> key enter processing status
    Some time release status or processing status column not appear in condition record the reason is the table used in access sequence no flagged for WITH RELEASE STATUS when creating table,so create new table tickmark to with release status and assign same in access sequence of your discount condition
    Kapil

  • TS4585 My phone will not turn on and when it does, it only stays on for a few minutes.  The last time it said it was necessary to do a restore in itunes, but shut off again before i could read rest of warning

    My phone was working fine last night.  Plugged it into the charger and went to bed. Woke up this am to it off.  It would not turn on.  I tried a different charger and a different outlet.  Tried several times to hold down power and volume and or the menu button.  Finally, several hours later, holding the power and volume buttoon turned on the phone.  Said had 1%battery, so i kept it plugged in for about 5 min.  It went up to 2%.  I started to look at recieved text, then it went dead again.  Repeated the same steps and left it plugged in.  It kept turning off.  till finally, it went dim and a warning message came on to restore phone from itunes but idid not see the end of warning bc it shut off again.  Now it will not turn on, but has the white apple symbol turning off and on over and over.  I can not find the option to restore the phone, plus the phone is not on so the computer is not registering that its plugged in.  I can not call out bc no landline and can not call tech support.  Does anyone know why this is, or what to do?????????????

    Your iPhone is in recoverty mode at the moment so to possibly get it back up and running you would need to do a restore as you have been trying. Follow the steps in the article below for the specific error messages you have been receiving. If after following all steps the issue remains book an appointment at a local Apple Retail Store to have the iPhone evaluated.
    Resolve specific iTunes update and restore errors

  • Help only had verzion for a few days and very frustrated. About to return

    So we have been with sprint for over 9 years.  And have been happy with their service... However our friend has verzion and was using it @ our house and we noticed how much faster it was so we decided to switch....... Black Friday we wanted a deal of course. We wanted the iPhone 5s, walmarts had the best deal we waited and then they told us they had a problem with activation between them and verzion....... So they put us on the "list"  well they didn't call us back.... So Saturday  we went out looking again. Target had a similar deal although it was still more expensive for the phones. We signed up and got 2 iPhones .  We also wanted a hotspot they said they didn't have them and had to wait. Although there was a banner in target sayin they had them.... Again we were put on the list..... No call .....   So now we go to get our hotspot and now they are telling us they won't honor the waived activation.... I called verzion and spoke with a rep about wanting to purchase the hotspot and not being able to. They said any promotions such as the waived activation would be noted .. Since there was availability problems..... Now I called verzion  and they say there is no note on our account... Also I am a authorized user on the account. Which they have verified  again each time I call they act like I speak a foreign language..... And have to verify I am on the account again..... So they can't keep that straight so I see how they don't see our promotion "note in our account........ "
    Help someone at verzion has to be able to see the note or see that we did get our phones on the waived activation. And waive the activation on the hot spot like we were promised.....  Come on why make some one mad over something like this within the return period?
    Help some with some common sense p,ease help a new customer
    Ps thank god we did not port over our sprint numbers yet,      Help
    The rep I talked to earlier simply said they could not help me and some one would call me which hasn't happened..... Big surprise...
    Verzion  please respond to me via this message or text us please

    We are post pay, normal contract customers.  Right now we have our sprint phones still..... It was a just in case verzion didn't work well....
    I mean a 2 year contract with 2 iPhones and a hot spot with 10 gig is what $200+ for 24 months  is close to $5k ......
    So they won't keep a promise to waive a activation fee of $35 on a out of stock item..... 
    That just doest make any sense to me...
    Oh yeah btw the card is currently on sale @ walmart for $a dollar... Through verzion they are $20... That is the reason we didn't get it through verzion directly in the first place.......  Again that is the reason I called verzion to make sure they would honor the waived activation fee...... 
    I feel I already paid a extra $50 due to verzion and their in-ability to keep their computers up and running with the biggest retailer on the biggest retail day....
    I  sure don't want to pay another $35  because if their in ability......
    How much do I have tp pay if we return them.... Target doesn't charge a restocking fee that I am aware of...  But I have a weeks with of limited usage so do they pro rate the month based onnthe days you had it?
    Or would some one from verzion. Please help us and keep verzion promise to waive the activation fee on our device we want to purchase....

  • Setting targets for the KPI's

    Where and how do you set the target for the KPI?
    I see that there are input ready quesries available to set targets how to use them?
    Can you only set targets for base KPI's?
    How and where is the data collected stored for the KPI's? in the standard cube given as business content?
    I would really appreciate your input Gurus.

    Hi Sijesh,
    I am also, currently working on a project implementing BO SuPM Version 1.0. Landscape is ECC -> BI -> SuPM dashboards.
    I have created a KPI in SuPM dashboard.
    Case 1 : Automatic data collection - This KPI is marked for Automatic data collection. So, maintained Scripts with Connectivity and SAP BW Query name. I save this KPI and include in a new report and Run it. There are no records displayed.
    Case 2: Manual data collection - This KPI is marked for manual data collection. So, maintained values in SuPM portal itself. I save this KPI and include in a new report and Run it. There are no records displayed.
    Could you please help me how KPI in SuPM be filled manually and automatically ( from BW Query)?
    Thanks,
    Best Regards
    PhaniRaj

Maybe you are looking for