Java Applet program to print a welcome message

Here, we are implementing a java program in applet that will print a welcome message on the screen.
Submitted by Chandra Shekhar, on January 11, 2018

Given co-ordinates under which we have to print a welcome message using Java applet program.

In this example, we are using a function named g.drawString() which is a method of Graphics class, here g is an object of Graphics class. drawString() is taking three parameters string to display and x,y co-ordinates.

Applet program to print welcome message in Java

// This java program Welcomes you using Applet.

package Applet;

import java.applet.*;
import java.awt.*;

public class WelcomeToApplet extends Applet
{
	// create paint class to print on the screen.
	public void paint (Graphics g)
	{		
		// Enter message with co-ordinates to make it in centre.
		g.drawString ("Welcome To Includehelp", 25, 50);
	  
	}
}

Output

Welcome message in java applet

Java Applet Programs »





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.