Java applet programming examples, JAVA Programming

Assignment Help:

Question:

(a) The following is a simple example of a Java Class:

// File: Welcome.java
public class Welcome {
public static void main(String args[]) {
System.out.println("Welcome to Java World");
}
}

Convert this file into an applet that prints out the same message when it is executed on a web page. Ensure that the text is written at the pixel position (10, 10) from the top left corner of the applet window.

(b) We will now call this applet from inside a web page. Suppose we wish to display the applet inside an applet window that is 200 pixels wide and 50 pixels high. What is the line of html code that needs to be inserted into an html file to do this?

(c) Now modify the applet from Part (a) so that the text is written out with the following properties: Font is Arial, Bold; Font size is 26 point; Text colour is blue.

(d) In Part (c), the text string and the font size have been "hard-wired" into the applet definition. However, we can pass both of these in to the applet as parameters. Modify the code you have written so far to enable both the text to be written on the screen, and the font size to be entered as parameters.

(e) Now we can reuse the applet in a number of different web pages, and print out different strings in different sizes. Write down the html fragment that will enable the applet to be called, with parameter values for the text string and font size set as "Aren't I clever!", and 18, respectively.


Related Discussions:- Java applet programming examples

What is constructors and explain with an example, What is Constructors? Exp...

What is Constructors? Explain with an example? A constructor forms a new instance of the class. It initializes all the variables and does any work essential to prepare the clas

Define the type casting?, Type casting defines treating a variable of one t...

Type casting defines treating a variable of one type as though it is another type. When up casting primitives as given below from left to right, automatic conversion happens. Bu

Translate four row solitaires from java swing to android, Translate Four Ro...

Translate Four Row Solitaires from Java Swing to Android. Project Description: There is a product known Four Row Solitaire listed in GitHub. I would like Swing GUI to be repl

Servlet, how to request one servlet to another by passing value

how to request one servlet to another by passing value

Program to create shipping company model, This assignment models a simplifi...

This assignment models a simplified delivery company. It is composed of the following departments:  receiving which contains a list of packages to be delivered, shipping which ship

Design a game in java, Ten pigs were all in a pen, enjoying their morning s...

Ten pigs were all in a pen, enjoying their morning slop when a bird flew down from a nearby tree and began picking all the best bits out from the trough. This greatly perturbed the

Classes, what is the default modifiers for methods in interface

what is the default modifiers for methods in interface

Java collection framework., #question.Write a program that computes the edi...

#question.Write a program that computes the edit distance (also called the Levenshtein distance, for its creator Vladimir Levenshtein) between two words. The edit distance between

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd