Why doesn't my square move...

can someone help me find why my square doesn't move down the page?
import java.applet.*;
import java.awt.*;
public class ShapeTest extends Applet implements Runnable
Dimension bgWidthHeight;
Image buffImage;
Graphics buffGraphics;
Thread firstThread;
int h;
int w;
public void start()
if(firstThread == null)
firstThread = new Thread(this);
firstThread.start();
public void stop()
if(firstThread != null)
firstThread.stop();
firstThread = null;
public void update(Graphics g)
paint(g);
public void run()
h = bgWidthHeight.height;
w = bgWidthHeight.width;
try
while(Thread.currentThread() == firstThread)
h++;
w++;
repaint();
Thread.sleep(50);
catch(InterruptedException e) {}
public void paint(Graphics g)
bgWidthHeight = getSize();
buffImage = createImage(bgWidthHeight.width, bgWidthHeight.height);
buffGraphics = buffImage.getGraphics();
buffGraphics.fillRect(h, w, 20, 30);
g.drawImage(buffImage, 0, 0, this);
public void destroy()
buffGraphics.dispose();
}

Try this:
import java.applet.*;
import java.awt.*;
public class ShapeTest extends Applet implements Runnable
     Dimension bgWidthHeight;
     Image     buffImage = null;
     Graphics  buffGraphics;
     Thread    firstThread;
     int h,w;
     int x,y;
public void start()
     if (firstThread == null) firstThread = new Thread(this);
     firstThread.start();
public void stop()
     if (firstThread != null) firstThread.stop();
    firstThread = null;
public void update(Graphics g)
     paint(g);
public void run()
     h = bgWidthHeight.height;
     w = bgWidthHeight.width;
     x = 10;
     y = 10;
     while (Thread.currentThread() == firstThread)
          try
          {     repaint(x,y,20,30);
               x++;
               y++;
               repaint(x,y,20,30);
               Thread.sleep(50);
          catch(InterruptedException e) {}
public void paint(Graphics g)
     if (buffImage == null)
          bgWidthHeight = getSize();
          buffImage     = createImage(bgWidthHeight.width, bgWidthHeight.height);
          buffGraphics  = buffImage.getGraphics();
     buffGraphics.setColor(Color.white);
     buffGraphics.fillRect(0,0,w,h);
     buffGraphics.setColor(Color.red);
     buffGraphics.fillRect(x, y, 20, 30);
     g.drawImage(buffImage, 0, 0, this);
public void destroy()
     buffGraphics.dispose();
Noah
import java.applet.*;
import java.awt.*;
public class ShapeTest extends Applet implements Runnable
     Dimension bgWidthHeight;
     Image buffImage = null;
     Graphics buffGraphics;
     Thread firstThread;
     int h,w;
     int x,y;
public void start()
     if (firstThread == null) firstThread = new Thread(this);
     firstThread.start();
public void stop()
     if (firstThread != null) firstThread.stop();
firstThread = null;
public void update(Graphics g)
     paint(g);
public void run()
     h = bgWidthHeight.height;
     w = bgWidthHeight.width;
     x = 10;
     y = 10;
     while (Thread.currentThread() == firstThread)
          try
          {     repaint(x,y,20,30);
               x++;
               y++;
               repaint(x,y,20,30);
               Thread.sleep(50);
          catch(InterruptedException e) {}
public void paint(Graphics g)
     if (buffImage == null)
          bgWidthHeight = getSize();
          buffImage = createImage(bgWidthHeight.width, bgWidthHeight.height);
          buffGraphics = buffImage.getGraphics();
     buffGraphics.setColor(Color.white);
     buffGraphics.fillRect(0,0,w,h);
     buffGraphics.setColor(Color.red);
     buffGraphics.fillRect(x, y, 20, 30);
     g.drawImage(buffImage, 0, 0, this);
public void destroy()
     buffGraphics.dispose();

Similar Messages

  • Why Doesn't "Gift This Movie" Work For HD Movies?

    So I'm making up the list of movies I'd like for Christmas, only to discover there's no way for someone else to gift me the HD iTunes movies I want. To reproduce this, go to an HD movie like Kill Bill or Star Trek, click on the little arrow next to "Buy Movie", and the first option is "Gift this movie". Now do the same for the little arrow next to "Buy HD Movie"; there is no option for "Gift this movie".
    What gives? So the only way someone can give me an HD iTunes movie for Christmas is to give me a gift card? That's pretty cheesy.
    I have a hard time buying there is a logical explanation for this. It can't be that Apple is concerned that HD movies don't play on all Apple devices, since I assume that an SD version of the movie comes with the HD version (as it did, for instance, with Mad Men season 3). It can't be a requirement from the movie industry: if they've authorized the movie be made available in HD, why should they care if it is gifted? And clearly Apple already has the purchase / delivery / redemption mechanisms in place for gifting movies; why would HD movies matter?
    Could this purely be a support issue? Apple is worried about people accidentally gifting HD movies to people who aren't prepared for a multi-GB download, and getting calls from upset customers?

    I'm having this same problem. I would like to gift a couple HD movies for my parents' Christmas gifts in addition to an Apple TV. It doesn't look like there's an option to do this for HD movies. Has anyone else discovered a way to do this?

  • HT1657 Why doesn't my rental movie download completely? iPad

    I am trying to download a rental movie so I can watch later, hopefully during my flight. Movie almost completes downloading then stops and starts over.

    Films that you rent and download directly on the iPad cannot then be transferred to a different device - if you want to be able to copy rentals to other devices then you need to rent and download it via your computer : http://support.apple.com/kb/HT1415

  • Why doesn't a wmv movie embedded in Powerpoint play, when I've downloaded Flip4Mac?

    When I play the movie directly (outside Powerpoint) using FlipPlayer, there's no audio.  When I play it using QuickTime, it plays fine. However when I try to play it in PowerPoint, it says Codec Unavailable and won't play at all.
    The Powerpoint file was provided to me for training purposes. I'd prefer to not modify it if possible.
    Thanks for your help.

    Flip4Mac allows playback of most Windows Media Player formats via QuickTime Player.
    QuickTime Player can't open Powerpoint files so something else on your machine (Keynote) is trying to view it. The Flip4Mac component only works with QuickTime Player so a .wmv file embedded in a .pps file will not play on a Mac.

  • Why doesn't my embedded movie play when I export s a video?

    I am trying to export my project in keynote 09. However, the embedded movie does not export and when the movie plays it gets stuck on that slide where the embedded movie is. I even tried opening the file with 08 ( I shouldn't have upgraded) and it can't be opened. Any advice?
    Thanks!
    OS 10.8.4

    From my experience, most Windows users do not have QuickTime player installed on their machines.
    The alternative is to provide PDF or PowerPoint, but the software for these are not installed by default, and  of course Keynote is a Mac only application, so you are very limited in how they will easily view your presentation.
    I always provide Windows Media Video files for PC users, this requires separate software to be purchased to convert Quicktime to WMV.   Fip 4 Mac Studio
    I have had on occaision to supply clients with JPEG image files as this was the only method they could view the presentation as they were prevented from installing additional software.
    You will need to ask your users if they are prepared to install additional software and if they want video or a slide presentation.

  • When I double click home for audio playback doesn't work for movies since I synced it yesterday Why?

    When I double click the home button the audioplayback doesn't work for movies,  it did before I added and synced some items yesterday anybody know why?

    Jeanlewane wrote:
    Why, When I double click the home button and hold down the icon waiting for the red x to appear, it doesn't.?
    How to Close Apps
    Double Tap the Home Button... Then swipe the App (not the icon) Upwards... Tap the Home Button when finished.
    From Here  >  http://support.apple.com/kb/HT4211
    NOTE:  You cannot delete any pre-installed iOS app.

  • Why doesn't the original document I'm dragging and dropping from one folder to another move?

    Why doesn't the original document I'm dragging and dropping from one folder to another move?
    What's happening is the computer is creating a duplicte of the document and placing it in the new location with a new creation date.  The original document I wanted to drag and drop into a new location remains where it started as the "original" document and the new copy has this little arrow protruding up from the lower left of its icon.
    At first I thought it was an alias, but it's a copy of the document I thought I was dragging and dropping.
    What gives here?
    Steve

    That arrow indicates it is a linik to the original, though. This happens if you wish to drag files, for which you do not have permissions to do this operation, e.g. from Library or System folder. I am pretty sure you do not accomplish this operation from/to folders like Desktop or Documents; if so, there is a problem with your system.

  • HT1657 I had rented a movie on my IPhone5 and after downloading almost all of it, I get an error that there is no enough space. Why doesn't the store check to see if I have enough free space before proceeeding with the order?

    After downloading almost all of it, I get an error that there is no enough space. Why doesn't the store check to see if I have enough free space before proceeeding with the order?
    How do I get a refund?

    Well, with apps genneraly you do get told ahead of time. I'm not sure of the current algorithm with movies though.
    Why not just clear up some space? You can check your usage in your settings btw.

  • Why doesn't Disk Utility allow me to select an image or movie to burn?

    Why doesn't Disk Utility allow me to select an image or movie to burn?  Everything is greyed out, even files.

    You cannot burn a movie with Disk utility - you need a burn application which will encode, author, and render the files so you will be able to watch the movie in any DVD player. There is iDVD (still available within the retail iLife 09 or 11 disks available at online resellers or ebay, amazon, etc), or Roxio Toast or Burn (free, but very basic), or google for others.

  • Why can't I purchase movies on my iPad? When I hit buy it doesn't download.

    Why can't I purchase movies on my iPad? When I hit buy it doesn't download.

    Ok. That's strange.  The download should show up immediately in the lower right.  Even if it is stuck, you will se the red number.  So something is blocking the purchase.  Take a look at setting, restrictions, and see if something there is turned on that might be blocking you.

  • Why my iPhone doesn't have Squared Input Method?

    Why my iPhone doesn't have Squared Input Method? I heard that this input method is supported on Chinese and Hong Kong iPhone, but there are lots of people using iPhone from other countries need that Input Method. Apple should consider that since there is no any technical difficulties.

    Tell apple how much you want this at
    Http://www.apple.com/feedback

  • Why doesn't the Canadian site get movie options?

    why can't we get movies in Canada. apple is only provoking society to download movies illegally so they can use their videos to get their money's worth. We need movie's on the Canadian site.

    As has been said here many times already, the movie studios (so far only Disney even in the US) have not licensed Apple to sell movies outside of the US. There's nothing Apple can do unless and until they're granted the rights. When, or indeed if, this will happen, no one can say, though Apple has said that they hope to be able to offer movies internationally sometime in 2007.
    Forum Tip: Since you're new here, you've probably not discovered the Search feature available on every Discussions page, but next time, it might save you time (and everyone else from having to answer the same question multiple times) if you search a couple of ways for a topic, both in the relevant forums, in the User Tips Library and in the Apple Knowledge Base before you post a question.
    Regards.

  • Why can't I purchase movies from my Apple TV? When searching not all available movies even show up!

    I've had my apple tv for a while now, but have never actually purchased anything from the itunes store directly from the device. A friend recommended "Sleepless in Seattle" to me, and since it's not in Netflix or On Demand, I decided to buy it from itunes.
    In doing a search in the Movies section of my Apple TV and typing in "Sleepl", I got no results. Bummed, I went onto Amazon to see how much the DVD would cost. On a whim, I opened itunes on my computer and did a search for the movie. To my shock, it is available for purchase on itunes for $9.99!
    Once I found this out, I went back to my Apple TV and searched again. The movie still didn't appear to exist. I noticed then that every movie on the apple tv only gave me the option of renting, not buying. I was going to purchase from my computer, but then thought better of it because I wasn't sure it would be made available for me to watch on the apple tv.
    Is there something wrong with my system? Why can't I buy movies from the device? I can buy tv shows, so it just seems weird to me that this is limited to the movies!

    Ha, ha, you are such a tool!
    That profile was written in 2007 and never updated. Unlike you, I don't live on this forum. I have one 5 year old Dell gathering dust, waiting for the trash that has some kids software on it my kids never use.
    Currently I own a 27 inch iMac, and a 21 inch iMac used by my wife. I just sold my MacBook Air, which replaced my MacBook Pro of two years ago. I have an AppleTV v2, and unfortunately gave my AppleTV v1 to a friend before I realized they stripped out the movie purchase feature. We also own an iPad, two iPhones, and 4 iPods, two of which are used as digital music storage for our cars.
    So yes, all of my factual posts concerning Apple's shocking decision to try to hide the fact they removed significant functionality from AppleTV when they revved it, are just driven by the fact that 4 years ago I used almost no apple products. Apparently I harbor a twisted desire to hurt the company that provides me almost all of my technology of choice today, despite being an early software developer for the Mac, helping start two Macinotosh software companies in the 1980s and 1990s, and working at Apple for 2 years in the early 90s.
    The truth is, Apple's products weren't so good 15 years ago so I gradually switched to Windows for professional reasons. About 4 years go I bought an iPhone, and started to wake up to the fact that Apple had done a tremendous job moving the Mac platform to the intel architecture, and was very happy to replace my crappy dells with Apple products.
    But that doesn't mean I wear blinders when their product teams and marketing department makes mistakes, or does something deceptive.

  • Why doesn't the iPad have a guest screen like the PC for extra security?

    I just want to start off first by saying I just purchased my iPad about six months ago and I'm really enjoying it,but if you're like me,I believe in protecting my privacy.
    I don't like to turn down any of friends or coworkers when I'm asked to use my iPad,but when you have such things as your personal pictures,movies,music,business documents,etc...you'd like to keep them from prying eyes. I thought that with the new iOS 7 update,that issue would've been fixed, but I was wrong. I'm hoping Apple would correct this problem with the next iOS update,it would make a lot of loyal Apple consumers & anyone who's new to purchasing the iPad for the first time very happy to know that feature is available.
    Why doesn't the iPad offer a guest screen?

    Tell Apple at the link below.
    http://www.apple.com/feedback/ipad.html

  • Why doesn't the "more like this" section offer suggestions anymore in the netflix app?

    In the netflix app there is an area labeled "More like this" and it usually show suggestions of other movies.  After the last ATV update, it just shows "More like this..." but it doesn't show any movie suggestions.  When I spoke with netflix, they said the problem was with Apple since they design the netflix app.

    I would also like to know why the suggestions are missing.  It seems to work when you select movies outside netflix.

Maybe you are looking for