FRESHERSHOME
Freshers Forum

Claculator in Java..?

This is a discussion on Claculator in Java..? within the JAVA forums, part of the Languages category; I am building the calculator using java programming. I have taken 10 button array now the problem is that when ...


Go Back   Jobs in India Forum > Programming > Languages > JAVA

Notices

JAVA JAVA Discussion Forum, Jave Related help

 
Reply
 
Thread Tools Display Modes
  #1  
Old 02-04-2008, 06:35 PM
YahooHoo
 
Join Date: Jul 2007
Posts: 11
Default Claculator in Java..?

I am building the calculator using java programming. I have taken 10 button array now the problem is that when i am clicking on the buttons the number should be appeared in the textfield but it not doing so... the follwing is my code :--
import java.awt.*;
import java.awt.event.*;
class MyCalci extends Frame implements ActionListener
{
TextField t;
Button b[]=new Button[10];
Panel p;
MyCalci(String s)
{
super(s);
p=new Panel();
t=new TextField(10);
setLayout(new GridLayout(3,2));
for(int i=0;i<b.length;i++)
{
b[i]=new Button(Integer.toString(i));
p.add(b[i]);
}
for(int i=0;i<b.length;i++)
{
b[i].addActionListener(this); }
p.add(t);
add(p);
setSize(300,300);
setLocation(120,120);
setVisible(true);}
public void actionPerformed(ActionEvent e)
{
for(int i=0;i<b.length;i++)
{
if(e.getSource()==b[i]){
t.setText(b[i]);}
}
}public static void main(String[] args) {
MyCalci mc=new MyCalci("My");}
}
I am Sorry for the previous mistake done...
Thanx,
Neha.
__________________
Powered by Yahoo! Answers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 02-04-2008, 06:36 PM
YahooHoo
 
Join Date: Feb 2008
Posts: 3
Default

cant believe u actually wrote that. what does it do actually???
__________________
Powered by Yahoo!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 02-04-2008, 06:41 PM
YahooHoo
 
Join Date: Jun 2007
Posts: 4
Default

Refer to java-a complete reference by naughton & schildt

Refer to Java in a nutshell by Flanagan
__________________
Powered by Yahoo! Answers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
java claculator

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump

Sitemap
Jobs by Location: Advertising and Marketing Jobs - IT Software Jobs - Walk-in Jobs - BPO Jobs - Government Jobs - Sales / BD Jobs - Tele Communication Jobs App Programming - Network Admin

Jobs By Location: Jobs in Bangalore - Jobs In India - Jobs in Delhi - Jobs in Hyderabad - Jobs in Kochi - Jobs in Mumbai - Jobs in Trivandrum - Jobs in pune - Jobs in Jonida - Jobs in Chennai - Jobs in Coimbator

Jobs Type: Full Time Jobs - Part Time Jobs
Latest Jobs - Accounting Jobs - Engineering Jobs - IT Jobs - Walkins - How to Face Interview - HR Round Tips - Career Info - Guide For Freshers - Apply for Jobs - Future Studies - Jobs Forums - Freshers IT Software Salary Details


All times are GMT +6.5. The time now is 05:28 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
FreshersHome.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62