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

Explain the member access separator, Explain the Member Access Separator ? ...

Explain the Member Access Separator ? class Car { String licensePlate; // e.g. "New York 543 A23" double speed; // in kilometers per hour double maxSpeed; // in

Explain difference between an if and a switch statement, What is the differ...

What is the difference between an if statement and a switch statement? The if statement is used to select between two alternatives. It uses a boolean expression to decide whi

Program using a data structure to represent a set, * Using a data structure...

* Using a data structure to represent a set * Writing and using a checked exception * Extending the Exception class What should you upload via Blackboard? The files,

Please help, please help please help please help please help please help pl...

please help please help please help please help please help please helpplease help please help

Explain different advice types in spring, 1) Around : org.aopalliance.inter...

1) Around : org.aopalliance.intercept.MethodInterceptor 2) Before : org.springframework.aop.BeforeAdvice 3)  After : org.springframework.aop.AfterReturningAdvice 4) Throws

What is meant by semantic error, What is meant by semantic error? Occur...

What is meant by semantic error? Occur although a statement executes and has an effect not intended by the programmer and Frequently times occur just in unusual & infrequent ci

Need to develop chat application for j2me, Need to develop Chat application...

Need to develop Chat application for j2me and I want Image Processing code Project Description: We want a chat application for a community website. Image processing and co

write program a, How do I write a program a bout Rotor cipher

How do I write a program a bout Rotor cipher?

Arrays, Prompt the user for an int between an upper and lower boundary. Reu...

Prompt the user for an int between an upper and lower boundary. Reuse the validateInput() method from project 2 to validate if the input is in bounds. If it is not, print an error

Describe j2ee?, J2EE (Java 2 Enterprise Edition) is an environment for depl...

J2EE (Java 2 Enterprise Edition) is an environment for deploying and developing enterprise applications on various operating system. The J2EE platform consists of J2EE components,

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