java app

Ads

 
 

Share on Google+Share on Google+

jenifer
java app
1 Answer(s)      6 years and 4 months ago
Posted in : Applet

create an applet to display the Fibonacci numbers

Ads
View Answers

May 4, 2011 at 11:23 AM


1)AppletExample.java:

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

public class AppletExample extends Applet implements ActionListener{
  TextField text;
  TextArea area;
  Label label1,label2;
  Button button;

  public void init(){
    setLayout(null);
    label1 = new Label("How many numbers do you want in Series: ");
    label1.setBounds(20,20,250,20);
    add(label1);

    text=new TextField(20);
    text.setBounds(300,20,100,20);
    add(text);

    label2 = new Label("Fibonacci Series: ");
    label2.setBounds(20,50,250,20);
    add(label2);

    area=new TextArea(5,15);
    area.setBounds(300,50,100,80);
    add(area);

    button = new Button("Find");
    button.setBounds(300,140,100,20);
    add(button);

    button.addActionListener(this);
    }
    public void actionPerformed(ActionEvent ae){
    StringBuffer buffer=new StringBuffer();
    int num = Integer.parseInt(text.getText());
    int f1=0,f2=0,f3=1;
    for(int i=1;i<=num;i++){
        buffer.append(f3);
        buffer.append("\n");
        f1=f2;
        f2=f3;
        f3=f1+f2;
    }
    area.setText(buffer.toString());
    }
}

2)applet.html:

<HTML>
<BODY>
<APPLET ALIGN="CENTER" CODE="AppletExample.class" width = "700" height = "400"></APPLET>
</BODY>
</HTML>

Ads









Related Tutorials/Questions & Answers:
java app
java app  create an applet to display the Fibonacci numbers   1)AppletExample.java: import java.awt.*; import java.applet.*; import java.awt.event.*; public class AppletExample extends Applet implements ActionListener
Client Server Java app
Client Server Java app  I developed a client server based java networking Instant Messaging app. The client program is needed to be run on the client... heroku techniques for java but its hard for me to understand
Advertisements
Java Shapes Bouncing App
Java Shapes Bouncing App  hi guys, im trying to implement the following into my java app code: Here's my code: first ill post the main class, then the animation panel class, then moving shape and moving rectangle class
Java App - Add, Delete, Reorder elements of the buttons
Java App - Add, Delete, Reorder elements of the buttons  Hello, I'm developing a Java application. I created this interface with MockupScreens. Please look at these pictures. At first time, there's only one element
Help needed on java standalone app and default browser interaction.
Help needed on java standalone app and default browser interaction.  Hi Developers and tutors, Is anyone able to guide on how am i able to extract the url thats displaying on my default browser to my java standalone application
how to establish connection b/w java app and mobile phone
how to establish connection b/w java app and mobile phone  hello... to send SMS from our phone to a java application situated on a remote server... i.e.., we don't know how to send and receive SMS to java server.We don't know what
How can I open my Java desktop app by clicking on its file?
How can I open my Java desktop app by clicking on its file?  How can I open my Java desktop app by clicking on the file it creates? This app creates... for this app. For instance, imagine I create an editor app called BlueSky
App Developer
App Developer  Hi, Who is App Developer? Thanks   Hi, App Developer is the term used for the programmers or companies developing mobile applications. Mobile application or simply app is the hot trend there days
App Development
App Development  Hi, Which is the best App Development in India?   Hi, The terms app is used for mobile applications in general. There are many companies providing App Development services in India and around
rate and review app iphone
rate and review app iphone  How to rate and review app in iphone
delete app from iphone
delete app from iphone  How to delete an existing app from itunes
Mobile App Development Company
Mobile App Development Company  Hi, Which is most reliable Mobile App Development Company? Thanks
Mobile App Development
Mobile App Development  Hi, What is the process of Mobile App Development? How I can outsource my mobile application development project and developed by an Indian developer? Thanks
Version of com.factati>app dependency
List of Version of com.factati>app dependency
Version of com.rightutils>app dependency
List of Version of com.rightutils>app dependency
iPad App to store data
iPad App to store data  Hi, How to add data support iPad application? Thanks
Android app development company
Android app development company  Hi, Which is most reliable Android app development company in India? Thanks   Hi, Rose India... various types of applications for their clients. Contact at: Mobile app
iphone app development
iphone app development  hey my first view file name is cardviewcontroller n second is carddetailview n btn name is clkHere so how i used btn to go frm 1 to 2 view
iPhone App Development
iPhone App Development  Hi, Can anyone explain me about iPhone App... for creating applications for these devices. If you are looking for iPhone App Development service in India and search for iOS developers then contact us at: Mobile app
Mobile Application Development iOS App Android App
Mobile Application Development iOS App Android App  Hi, I have a business and we are now planning to release applications. Our business is food dispatch into city. I want application to be developed so that users can login
iOS app development
iOS app development  Hi, What is iOS app development? Thanks   Hi iOS is platform and operating system for mobile application from... at: Mobile app development company in India A Newspaper Mobile Application Allows
J2me app with servlets
J2me app with servlets  Can we send and receive message from our servlet website to mobile? if yes,then how.. without using any router..code plz??   Please visit the following link: http://www.roseindia.net
Version of com.nthportal>app-shell_2.12 dependency
List of Version of com.nthportal>app-shell_2.12 dependency
Version of com.nthportal>app-shell_2.12 dependency
List of Version of com.nthportal>app-shell_2.12 dependency
Version of com.quicklib>quicklib-app dependency
List of Version of com.quicklib>quicklib-app dependency
Version of com.shamanland>xdroid-app dependency
List of Version of com.shamanland>xdroid-app dependency
Is there a limitation on the number of files in an iphone app?
Is there a limitation on the number of files in an iphone app?  hello all Is there a limitation on the number of files in an iphone app? My app will contain about 2000 or more text files.Would i be in trouble?   yes
Mobile app development India
Mobile app development India  Hi, Which company is good for getting... to contact further: Mobile app development company in India Mobile Application... Service RoseIndia Mobile Theme Design Mobile App Development A Crossword Mobile
rate my app iphone SDK
rate my app iphone SDK  How can i enable "Rate and Review Application" feature of my application on iTune
Mobile App Marketing Strategies
10 Mobile App Marketing Strategies You Must Know Getting your app visible and coming up the search results is the biggest priority for most app marketers. App stores in all platforms including IOS, Android, Windows and other platforms
iPhone Make Call from App
App. I am just wondering how to make a call programmatically... is there any..."); UIApplication *app = [UIApplication sharedApplication... = [NSURL URLWithString:dialThis]; [app openURL:url