Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML
 
 
Hot Web Programming Job

 

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


 

Java Tutorials

Core Java
JSP
Servlet
JDBC
Hibernate
Struts 1
Struts 2
JSF
Spring
J2EE
J2ME
Web Services
Ajax
Dojo
MySQL
Latest Comments
Null pointer excep
swap program faile
hi.........
very good
navigaton mobile
  All Comments...
 

 

 
Struts Tutorials
*Stuts TOC
*Apache Struts Introduction
* Struts Controller
* Struts Action Class
* Struts ActionFrom Class
* Using Struts HTML Tags
*Struts Validator Framework    
*Client Side Address Validation    
*Struts Tiles
*tiles-defs.xml
*Struts DynaActionForm
*Struts File Upload
*Struts DataSource
*AGGREGATING ACTIONS
*Internationalization
Struts Resources
*Struts Books
*Struts Articles
*Struts Frameworks
*Struts IDE
*Struts Alternative
*Struts Links
*Struts Presentations
*Struts Projects
*Struts Software
*Struts Reference
*Struts Resources
*Other Struts Tutorial
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail
roseindia_net@yahoo.com
 
   

 
Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Java Beginners Applet

User Comments
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl
  Blink   Furl   Simpy   Y! MyWeb 

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

4 comments so far (post your own) View All Comments Latest 10 Comments:

This is a very good site.Very informative.This site is very helpful and has solved many problems of mine.

Thanx to the owner.

Posted by Rekha on Friday, 02.22.08 @ 11:58am | #49393

hey, this site is very good for me.. i am solving my problems with this site. I am very thankful to this site owner.

Thanks again.

Mahesh Palghadmal
Web Developer

Posted by Mahesh Palghadmal on Thursday, 01.17.08 @ 11:17am | #45409

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


public class CalculatorApplet extends Applet implements ActionListener
{
private Button keysArray[];
private Panel keyPad;
private TextField lcdField;
private double result;
private boolean first;
private boolean foundKey;
static boolean clearText;
private int prevOperator;

public void init()
{
lcdField = new TextField(20);
keyPad = new Panel ();
keysArray = new Button[17];
result = 0.0;
prevOperator = 0;
first = true;
clearText = true;

setLayout(new BorderLayout());

lcdField.setEditable(false);

for (int i = 0; i <=9; i++)
keysArray[i] = new Button(String.valueOf(i));
keysArray[10] = new Button("/");
keysArray[11] = new Button("*");
keysArray[12] = new Button("-");
keysArray[13] = new Button("+");
keysArray[14] = new Button("=");
keysArray[15] = new Button(".");
keysArray[16] = new Button("CLR");

keyPad.setLayout(new GridLayout (4,4));

for (int i = 7; i <=10; i++)
keyPad.add(keysArray[i]);

for (int i = 4; i <6; i++)
keyPad.add(keysArray[i]);

keyPad.add(keysArray[11]);

for (int i = 1; i <= 3;i++)
keyPad.add(keysArray[i]);

keyPad.add(keysArray[12]);

keyPad.add(keysArray[0]);

for (int i = 15; i >=13; i--)
keyPad.add(keysArray[i]);

add(lcdField, BorderLayout.NORTH);
add(keyPad, BorderLayout.CENTER);
add(keysArray[16], BorderLayout.EAST);

for(int i = 0; i < keysArray.length; i++)
keysArray[i].addActionListener(this);
}

public void actionPerformed(ActionEvent e)
{
foundKey = false;

for (int i = 0; i < keysArray.length && !foundKey; i++)
if(e.getSource() == keysArray[i])
{
foundKey = true;
switch(i)
{
case 0: case 1: case 2: case 3: case 4:
case 5: case 6: case 7: case 8: case 9:
case 15:
if (clearText)
{
lcdField.setText("");
clearText = false;
}
lcdField.setText(lcdField.getText() +
keysArray[i].getLabel());
break;

case 10:
case 11:
case 12:
case 13:
case 14:
clearText = true;
if (first)
{
if(lcdField.getText().length()==0)
result = 0.0;
else
result = Double.valueOf(lcdField.getText()).doubleValue();

first = false;
prevOperator = i;
}
else
{
switch(prevOperator)
{
case 10:
result /= Double.valueOf(lcdField.getText()).
doubleValue();
break;
case 11:
result *= Double.valueOf(lcdField.getText()).
doubleValue();
break;
case 12:
result -= Double.valueOf(lcdField.getText()).
doubleValue();
break;
case 13:
result += Double.valueOf(lcdField.getText()).
doubleValue();
break;
}
lcdField.setText(Double.toString(result));
if (i==14)
first = true;
else
prevOperator = i;
}
break;

case 16:
clearText = true;
first = true;
lcdField.setText("");
result = 0.0;
prevOperator = 0;
break;
}
}
}
}

whenever i try to run this or other applets
this msg is shown:

Exception in thread "main" java.lang.NoSuchMethodError: main

although there is no error found at the time of compilation.

Posted by ashok on Monday, 10.29.07 @ 16:15pm | #35063

it is very good site to get knowledge. im very thanksfull to owner of this site and all support for me

Posted by sampat bhawar on Thursday, 06.14.07 @ 15:18pm | #19199

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Back to Tutorial

 

  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.