sry to those whose tried to help before and would thank anyone who knows how to move the different shapes of my project to gether at the same time, so it looks lik balloons flying? could anyone help?

/**
 * draw a balloon on to a canvas
 * 
 * @author (chris twaits) 
 * @version (12/10/07)
 */
public class Balloons
{
    private Circle top;
    private Triangle middle;
    private Triangle bottom;
    private Circle top2;
    private Triangle middle2;
    private Triangle bottom2;
    private Circle top3;
    private Triangle middle3;
    private Triangle bottom3;

    /**
     * construct object
     */
    public void draw()
    {
        top = new Circle();
        top.changeColor("red");
        top.moveHorizontal(8);
        top.moveVertical(121);
        top.changeSize(60);
        top.makeVisible();

        middle = new Triangle();  
        middle.changeColor("green");
        middle.changeSize(-38, 55);
        middle.moveHorizontal(8);
        middle.moveVertical(247);
        middle.makeVisible();

        bottom = new Triangle();  
        bottom.changeColor("blue");
        bottom.changeSize(7, 11);
        bottom.moveHorizontal(8);
        bottom.moveVertical(246);
        bottom.makeVisible();

        top2 = new Circle();
        top2.changeColor("blue");
        top2.moveHorizontal(125);
        top2.moveVertical(175);
        top2.changeSize(60);
        top2.makeVisible();

        middle2 = new Triangle();  
        middle2.changeColor("magenta");
        middle2.changeSize(-38, 55);
        middle2.moveHorizontal(125);
        middle2.moveVertical(301);
        middle2.makeVisible();

        bottom2 = new Triangle();  
        bottom2.changeColor("green");
        bottom2.changeSize(7, 11);
        bottom2.moveHorizontal(125);
        bottom2.moveVertical(300);
        bottom2.makeVisible();


        top3 = new Circle();
        top3.changeColor("yellow");
        top3.moveHorizontal(240);
        top3.moveVertical(141);
        top3.changeSize(60);
        top3.makeVisible();

        middle3 = new Triangle();  
        middle3.changeColor("blue");
        middle3.changeSize(-38, 55);
        middle3.moveHorizontal(240);
        middle3.moveVertical(267);
        middle3.makeVisible();

        bottom3 = new Triangle();  
        bottom3.changeColor("black");
        bottom3.changeSize(7, 11);
        bottom3.moveHorizontal(240);
        bottom3.moveVertical(266);
        bottom3.makeVisible();

    }    
     /**
      * Create method for balloons to fly
      */

     public void slowMoveVertical()

    {
        top.slowMoveVertical(-50);
        top2.slowMoveVertical(-50);
        top3.slowMoveVertical(-50);
        middle.slowMoveVertical(-50);
        middle2.slowMoveVertical(-50);
        middle3.slowMoveVertical(-50);
        bottom.slowMoveVertical(-50); 
        bottom2.slowMoveVertical(-50);
        bottom3.slowMoveVertical(-50);
     }
}

your slowMoveVertical method seems like an infinite method to me. When does it stop?

lol,im not sure if i understand exactly what your saying but it does stop. can you help m8?

All that method does is call itself though, I can't see when it will exit. This is called infinite recursion.

EDIT: Ah, my mistake, you are actually calling a slowMoveVertical(int) method in your slowMoveVertical() method. Can you post your code for the slowMoveVertical(int) method and I will try to help?

All that method does is call itself though, I can't see when it will exit. This is called infinite recursion.

EDIT: Ah, my mistake, you are actually calling a slowMoveVertical(int) method in your slowMoveVertical() method. Can you post your code for the slowMoveVertical(int) method and I will try to help?

that code works in conjunction with a square class,triangle class,circle class and a canvas class. does that help?

So is that the code that moves your balloons? If not, what does? Sorry but I'm having a bit of trouble working out which part of your code does what...

ok, i have a leader class called balloons, which is coded in such a way that it moves the shapes in th classes(sqaure,triangle and circle) to become a balloon shape. the shapes are then shown onto the canvas(created from the class canvas).it mite be easier to actually send you the whole thing.

So you have multiple objects that you want to see them move on the canvas at the same time slowly into the shape or form of a balloon?

Are you drawing in a JPanel (or JFrame) or an Applet? I think your problem might be as simple as calling repaint() after you do all your movement calculations?

Are you drawing in a JPanel (or JFrame) or an Applet? I think your problem might be as simple as calling repaint() after you do all your movement calculations?

Most likely the painting code is in the slowMoveVertical(int) methods on the Circle, Triangle, etc classes, which he didn't post the code for.

You're correct that if he is only changing positional data in those methods and his paint code were to just render the objects based on those positions then repaint would be all he needed. I don't think that is how he has it structured right now though.

jframe m8.so could anyone inform on what i have to do, or do you want sum more info?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.