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



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


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


create an applet to display the Fibonacci numbers


Advertisement
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>


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
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
iPad App to store data
iPad App to store data  Hi, How to add data support iPad application? Thanks
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
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
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
rate my app iphone SDK
rate my app iphone SDK  How can i enable "Rate and Review Application" feature of my application on iTune
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
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
PayPal integration in iPhone native app
PayPal integration in iPhone native app  I am looking for some help in integrating the paypal in iPhone application. Please help. Thanks.   Instead of integrating the paypal into the app .. you can open it within
Sun App Server - JSP-Servlet
Sun App Server  Dear Roseindia Team, I am Ragavendran.R.. I need to be clarified with a thing regarding J2EE1.4 Sun App server.. As everyone is aware, the web application can be executed using say http://localhost
the App Store does not accept or distribute web apps
the App Store does not accept or distribute web apps  the App Store does not accept or distribute web apps We found the user interface of your app is not of sufficient quality to be appropriate for the App Store What could
how to create a reminder app using threads in Servlets?
how to create a reminder app using threads in Servlets?  I want to make a Reminder application in Servlets. When the date and/or time is matched... get re-directed!". I have used threads for core java, but never used for Servlets
Using netbeans 6.9.1 create a mobile app. J2ME.
Using netbeans 6.9.1 create a mobile app. J2ME.   Can anybody help me with my school's project? I need to create a mobile pizza ordering app. Using just checkboxes to select sizes, crusts, topping, shape
app crashed in ipad 2 running iOS 5.0.1
app crashed in ipad 2 running iOS 5.0.1  i developed a universal... iPad. But apple has rejected it twice saying that.. "We found your app crashed in ipad 2 running iOS 5.0.1, witch is not in compliance with the App Store Review
(List)Web server n app. server
(List)Web server n app. server  Hi,I have searched list of web server & app server lists,but every time i got shuffled ,Kindly any responsible person tell me the names of web server & app server.   Hi Please
RunTime Exception in stand alone app with hibernate. - Hibernate
RunTime Exception in stand alone app with hibernate.  I have written small stand alone application using hibernate-3.2. When I run the application, It causes following types of exceptions. log4j:WARN Please initialize
how to deploy struts2 app in Intellij idea
how to deploy struts2 app in Intellij idea  I have choosed idea as my ide, but till now i have used ant to make a build file. Manually i deployed... way to deploy web-app. like eclipse , if you select the project and clicked
how to deploy struts2 app in Intellij idea
how to deploy struts2 app in Intellij idea  I have choosed idea as my ide, but till now i have used ant to make a build file. Manually i deployed... way to deploy web-app. like eclipse , if you select the project and clicked
how to deploy struts2 app in Intellij idea
how to deploy struts2 app in Intellij idea  I have choosed idea as my ide, but till now i have used ant to make a build file. Manually i deployed... way to deploy web-app. like eclipse , if you select the project and clicked
how to deploy struts2 app in Intellij idea
how to deploy struts2 app in Intellij idea  I have choosed idea as my ide, but till now i have used ant to make a build file. Manually i deployed... way to deploy web-app. like eclipse , if you select the project and clicked
how to deploy struts2 app in Intellij idea
how to deploy struts2 app in Intellij idea  I have choosed idea as my ide, but till now i have used ant to make a build file. Manually i deployed... way to deploy web-app. like eclipse , if you select the project and clicked
how to deploy struts2 app in Intellij idea
how to deploy struts2 app in Intellij idea  I have choosed idea as my ide, but till now i have used ant to make a build file. Manually i deployed... way to deploy web-app. like eclipse , if you select the project and clicked
 

 

 

DMCA.com