When is the paint()-method called?

From: Jesper Sahner (jespersahner_at_hotmail.com)
Date: 10/28/04


Date: 28 Oct 2004 11:38:10 -0700

Hi!

A beginner's question: When is the paint()-method EXACTLY called in
the following little example?

import java.awt.*;

public class GWindow extends Frame
{
  public void paint(Graphics g)
  {
    g.drawLine(0,0,50,50);
    g.fillOval(5,20,300,30);
    g.setColor(Color.green);
    g.drawString("Hello",100,40);
  }
}

public class ShowGWindow
{
  public static void main(String[] arg)
  {
    GWindow w = new GWindow();
    w.setSize(350,60);
    w.setTitle("GWindow");
    w.setVisible(true);
  }
}

Regards,
Jesper



Relevant Pages

  • program challenge
    ... public void setName{ ... the salaried class that extends Employee ... public class Salaried extends Employee ... // Programmer.java: the programmer class that extends from Hourly ...
    (comp.lang.java.help)
  • Re: Tricky form problem
    ... > ShowDialog method) different modal child forms. ... when using ShowDialog() there's no ... > public class MainForm: Form ... > public void ShowForm() ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: InvalidOperationException was unhandled
    ... > public Vehicle MyVehicle; ... >public class Vehicle ... > public void SerializeOriginal(String filename) ...
    (microsoft.public.dotnet.vjsharp)
  • RE: SoapTypeAttribute (System.Xml.Serialization) Example Code Fails
    ... "David Bozzini" wrote: ... > public class Employee{ ... > public void SerializeOriginal{ ... > mySerializer.Serialize(writer, myGroup); ...
    (microsoft.public.dotnet.framework)
  • RE: Problem: C# custom event is null
    ... public event MyDelegate OnFire; ... public void B_Event_Raised ... (these are sample classes to illustrate) ...
    (microsoft.public.dotnet.languages.csharp)