Some important methos in Applets



Applet methods:

public void init ()
public void start ()
public void stop ()
public void destroy ()
public void paint (Graphics)
Also:
public void repaint()
public void update (Graphics)
public void showStatus(String)
public String getParameter(String)

repaint( ) method:
Call repaint( ) when you have changed something and want your changes to show up on the screen
repaint( ) is a request–it might not happen
When you call repaint( ), Java schedules a call to update(Graphics g)

update( ) method:
When you call repaint( ), Java schedules a call to update(Graphics g)
Here’s what update does:
public void update(Graphics g) {     // Fills applet with background color, then     paint(g); }

Sample Graphics methods:

–>A Graphics is something you can paint on
–>g.drawString(“Hello”, 20, 20);
–>g.drawRect(x, y, width, height);
–>g.fillRect(x, y, width, height);
–>g.drawOval(x, y, width, height);
–>g.fillOval(x, y, width, height);
–>g.setColor(Color.red);

Random Posts

  • Define Session Hijacking
  • Jdbc Interview Questions
  • Connecting our Class(say x) to DataBase using Hibernate
  • What is API
  • Define implicit objects

Post a Comment