Solved

How to shift image ?

Posted on 1997-04-07
1
210 Views
Last Modified: 2011-08-18
I want to copy an area of image from left to right to make it looks like it "grow" from left to right. So I wrote the following codes :

int n = 300;
while( n > 0 )
{
      g.copyArea(n, 0, 3, 50, 3, 0);
      n = n-3;
}

And I already draw lines at 0,0 to 3,50. It should reduplicate that image once when I call the above loop. But it just can't work, it doesn't duplicate anything at all !

But if I change the logic of loop to:

int n = 0;
while( n > 300)
{
      g.copyArea(n, 0, 3, 50, 3, 0);
      n = n+3;
}

Then it can work, and show me a lines of image, duplicated from the left hand side.

Why such happened ? What's wrong of my code or logic ?

Please help me !! Thank you very much !! ( Urgent ! )
0
Comment
Question by:c.w.yuen
1 Comment
 
LVL 2

Accepted Solution

by:
majkl earned 100 total points
ID: 1219501
int n = 0;
             while( n > 300)
             {
             g.copyArea(n, 0, 3, 50, 3, 0);
             n = n+3;
             }

this loops never loops.
n = 0 and while n > 300
statement is everytime false :)


0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
The viewer will learn how to implement Singleton Design Pattern in Java.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question