Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Applet Jav Applets

Have Programming Question? Ask it here!
 
 
 


ricky
Jav Applets
1 Answer(s)      4 years and 5 months ago
Posted in : Applet


I need to write a small payroll program, using applet, that provides a text field for the number of hours, a text field for the pay rate, and a non-editable text field for the output. It should also also provide labels to identify all three text fields and a button to calculate the result.

Thanks

Advertisement
View Answers

April 6, 2010 at 3:31 PM


Hi Friend,

Try the following code:

1)
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;

public class OpenWindow extends Applet implements ActionListener {
Label l1,l2,l3;
TextField t1,t2,t3;
Button b;
Panel p;

public void init(){
l1=new Label("Number of hours");
l2=new Label("Pay Rate");
l3=new Label("Total");
t1=new TextField(20);
t2=new TextField(20);
t3=new TextField(20);

p=new Panel(new GridLayout(4,2));
t3.setEditable(false);
b = new Button("Calculate");
b.addActionListener(this);
p.add(l1);
p.add(t1);
p.add(l2);
p.add(t2);
p.add(l3);
p.add(t3);
p.add(b);
add(p);
}
public void actionPerformed(ActionEvent e){
int hours=Integer.parseInt(t1.getText());
int rate=Integer.parseInt(t2.getText());
int total=hours*rate;
t3.setText(Integer.toString(total));
}
}

2)applet.html:

<html>
<body>
<h1>Java Applet Demo</h1>
<applet code=OpenWindow .class width=500 height=400>
</applet>
</body>
</html>

Thanks




Related Tutorials/Questions & Answers:
Jav Applets - Applet
Jav Applets  I need to write a small payroll program, using applet, that provides a text field for the number of hours, a text field for the pay rate, and a non-editable text field for the output. It should also also provide
Applets?
Applets?  applets are using now a days   Please visit the following link: Applet Tutorials
Advertisements
jav-util.zip
jav-util.zip  i need to load a zipfile in to my class while executing and i have extract each file in that zip and a particular file content i need to desplay how can i do this please help me
jav
JAv method overloading
JAv method overloading  What restrictions are placed on method overloading
jav compolation error - Java Beginners
jav compolation error  find symbol error
jav beginners - Java Beginners
jav beginners  pl. let me know the logic and the program to print the prime and twin prim numbers thanks  Hi Friend, Try the following code: class TwinPrimes{ public static void main (String
Applets
Java NotesApplets Why no applets in these notes These notes were originally written using applets almost entirely. However, all applet examples are being changed to applications. The only really portable applets are written in Java
APPLETS - Security
APPLETS  In java applets sun.misc is not working can any body help me for the alternate solution. while using new sun.misc.BASE64Encoder().encode(enc); i got runtime error... java.security.AccessControlException
jav a - Design concepts & design patterns
jav a  Q.1. Write a program in Java to perform the addition of two complex numbers.   Hi Friend, Try the following code: public class ComplexNumber{ private int a; private int b; public ComplexNumber
Applications and Applets
Applications and Applets       Now a days, Java is widely used for applications and applets. The code... the user's browser. Applets can be very useful, user friendly programs or can
Applications and Applets
Applications and Applets       Now a days, Java is widely used for applications and applets. The code... the user's browser. Applets can be very useful, user friendly programs or can
Applets in Java
Applet is a Java program embedded within HTML pages. Java applets is compatible with almost all the web browsers like Mozilla Firefox, Google Chrome, Internet explorer, Netscape navigator and others that are java enabled. Applets
Programming using applets and oracle - Applet
Programming using applets and oracle  Develop an Online Examination software in java using applets as front end and oracle as back end. Software should handle at least ten users at a time. There are Multiple Choice questions
Servlet v/s Applets - Servlet Interview Questions
Servlet v/s Applets  what is difference between servlets & applets
Free Java Applets
Free Java Applets       There are many free java applets available on the web that you can use in your website. These applets includes menu, clock, slide show, image animation
Should we go for javascript or applets for online exam project using java
Should we go for javascript or applets for online exam project using java  Hi, I am new to java and i am working on online examination project.As soon as the candidate login successfully a window pop up should appear
Role of Java Applets in Web Application Development
In this article, we are discussing about the role of Java Applets in web application development. As we all know that an Applet is a simple Java program, which is written in Java programming language that extends the java.applet.
I am new to java applets. When i run this code on applet viewer status is displayed that applet not initialized
I am new to java applets. When i run this code on applet viewer status is displayed that applet not initialized  import java.awt.*; import java.awt.event.*; import java.applet.*; public class Textfields extends Applet implements
What is Applet in Java?
computer. Applets are used to make the web site more dynamic and entertaining. The main difference between Java based applications and applets...? Applets are cross platform and can run on Windows, Mac OS and Linux platform
Java & JEE books Page2
; Applets This lesson talks about the basics of applets, advantages of applets over applications, how to load applets in a web page, how to convert applications to applets and how applets work. You should thoroughly understand
Java Applet
Applets are Java programs that run on java enabled web browser. Java applets can run on client servers with some restrictions. Applets are embedded into HTML...: There are various advantages of using Java Applets: They can run on any
Applet versus Application
;    Applets as previously described, are the small programs while applications are larger programs. Applets don't have the main method while in an application execution starts with the main method. Applets can run in our
Free Java stuffs
for cell phones Free Java Applets
Java JAR Files
Java JAR Files       A JAR file is a collection of  class files and auxiliary resources associated with applets and applications. The Java Archive (JAR) file format enables
Top-level Listeners
; A common way to write simple applets is to use the use the applet itself
&lt;APPLET&gt; Tag Parameters: The &lt;PARAM&gt; Tag
directly to a Java applet. Parameters are to applets what command-line... to applets are: First, add the PARAM tag (with values) to the HTML source file... These parameter values are retrieved by Java applets using the getParameter() method
Java Update
Update 2 provides improved behavior for applets in Safari and increased stability.... The Kernel online installer lets first time Java users run applets... Java applets and applications and any additional libraries that may
The Java Applet Viewer
; Applet viewer is a command line program to run Java applets... that inherits the Applet. We generally use web browsers to run applets. Its not always... that acts as a test bed for Java applets. The working of Applet viewer is a bit
Java hello world
Java hello world       Java is a high-level object-oriented programming language developed by the Sun Microsystems and is available in different form like JSP, Java Applets, J2EE
Applet
; Introduction Applet is java program that can be embedded into HTML pages. Java applets... restrictions on it. Applet can't access system resources on the local computer. Applets... of Applet: Applets are cross platform and can run on Windows, Mac OS
The Java Applet Viewer
;  Applet viewer is a command line program to run Java applets... applets. Its not always mandatory to open a Web browser for running an applet... viewer. This is a tool that acts as a test bed for Java applets. The working
Using Applet in JSP
be embedded into HTML pages. Java applets runs on the java enables web browsers... resources on the local computer. Applets are used to make the web site more dynamic
The Java Applet Viewer
; Applet viewer is a command line program to run Java applets... the Applet. We generally use web browsers to run applets. Its not always... that acts as a test bed for Java applets. The working of Applet viewer is a bit
Applet in Java
the java.applet.Applet class Applets are also useful for a small Internet and intranet... through Java-enabled web browsers. Advantages of Applet: Applets can run on Windows, Linux and Mac OS Applets are secure Almost all web browsers support
Java basics
Java basics  Differences between applications and applets
Java applet
Java applet  what are types of applets
Advertisements
 

 

 

DMCA.com