Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

java applet init () problem

  • 13-12-2008 07:48PM
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 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