473,378 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Applet Problam

hi dear
i have problem in this code
it is very important for me please send your answers very Quicly.



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

public class test1 extends Applet
{
Label enter =new Label("Enter Number 1");
Label result =new Label("Sum Is:");
TextField text=new TextField(5);
TextField output=new TextField(5);
Button calc=new Button("Calculate");
Font font =new Font("Helvetica",Font.BOLD,18);
int num,sum=0;
String s;
@Override
public void init()
{
enter.setFont(font);
result.setFont(font);
calc.addActionListener(this);
text.addActionListener(this);

add(enter);
add(text);
add(result);
add(output);
add(calc);

}
public void start()
{
text.setText("0");
}
public void actionPerformed(ActionEvent e)
{
num=Integer.parseInt(text.getText());
sum +=num;
s=String.valueOf(sum);
output.setText("0");
text.setText("0");
if(num<0)
calc.setEnabled(false);

}

}
Oct 22 '09 #1
1 1281
mrjohn
32
I'm no expert with applets 'n ActionListeners, but I think you need to change
Expand|Select|Wrap|Line Numbers
  1. public class test1 extends Applet
to
Expand|Select|Wrap|Line Numbers
  1. public class test1 extends Applet implements ActionListener
Kinda hard to say more until you explain what your applet is supposed to do.
Oct 23 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: nathanlaan | last post by:
This is the stupidest thing I have ever seen. Java 1.2, 1.3, and 1.4.1, and 1.4.2 all define the Applet.getDocumentBase() method differently! How am I supposed to get the directory of the document...
0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
1
by: Charlie Kim | last post by:
Here is gnome applet source of mine. -------------------------------------------------- #!/usr/bin/env python import pydic import gtk import gnome.applet
8
by: DKM | last post by:
Here are the source code files to a Java applet that utilizes LiveConnect to communicate with Javascript, and the HTML file. The thing works both in IE 6.0 and FireFox 1.4. but with some...
0
by: ankur | last post by:
WHEN I RUN THIS WEB APPLICATION ON Tomcat5.5.9 SERVER MY HttpChatApplet sccessfully Loaded from ChatDispatch but running on some another PC HttpChatApplet not loaded my Coad ...
4
by: tudyfruity18 | last post by:
I'm suppose to write an applet that contains two buttons Investment calculator and Loan Calculator. When the Investment Calculator button is clicked, a frame appears in a new window for calculating...
2
by: Amzul | last post by:
hello all i have a problam its a bit strang hope you can help me: i am trying to put a table inside a div and i dont want the table to overflow the div size i did this <div...
3
by: zivon | last post by:
I'm making a reminder, and I want to select all the notes that thier time is passed already. this is the code I'm trying: LSQL = "select ReminderMark,ReminderDate,ReminderTime from Calls WHERE...
1
by: =?Utf-8?B?a2F3aXNo?= | last post by:
hi i have some problam in msoffice documents, problam is.... i m open ms word or ms excel file but it asking file conversion n i dont see my save document... my documents save in english language...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.