Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

java applet init () problem

Options
  • 13-12-2008 7:48pm
    #1
    Registered Users Posts: 1,269 ✭✭✭


    hi,

    I'm trying to make a pretty little java paint program. One of the problems I'm having is setting the canvas to white, and then setting the brush to a colour, say purple, in the applets init method. My code's fairly bloated so in simple terms the problem is:
    class Painter extends Applet
    {
    public void init()
    {
    myCanvas.setpaintColour(Color.white);
    myCanvas.fill();
    myCanvas.setpaintColour(Color.purple);
    }
    }
    

    The myCanvas class has it's own setpaintColour and fill methods, which are aptly named. Annoyingly, the above code results in the applet initializing with a purple fill, instead of the intended white fill.

    Is there any way around this? Is it a basic feature which I'm forgetting?

    Any help is greatly appreciated, I might post the full code at some stage, after tidying it up...


Comments

  • Closed Accounts Posts: 6,151 ✭✭✭Thomas_S_Hunterson


    is the setPaintColour() method calling the fill() method?


  • Registered Users Posts: 1,269 ✭✭✭cocoa


    Sean_K wrote: »
    is the setPaintColour() method calling the fill() method?

    fair point, but no that wasn't it... I've figured it out now, I was using repaint and I didn't realise it's one of those things that has a delay.


Advertisement