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




Have Programming Question? Ask it here!
 
 
 


jenifer
java app
1 Answer(s)      3 years and 3 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
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
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
Iphone keypad app
Iphone keypad app The given sample "Iphone keypad app" is going to show you how to hide keyboard or number pad and return to the actual screen. We can see it with the help of this example...in which we are going to take
How to implement link in Web app lead to report with print and save features
How to implement link in Web app lead to report with print and save features   Hi friends, I developed a web application based on Java MVC architecture and Struts framework with Tomcat appserv, and I need to implement link lead
iPhone Quiz App Tutorial
iPhone Quiz App Tutorial In this simple iPhone quiz application tutorial, we are going to learn how to create simple quiz in iphone. Creating a simple quiz in iPhone is really easy..Just follow the given steps to create the quiz
difference between the APp server and the web server in detail - Servlet Interview Questions
difference between the APp server and the web server in detail  Can just explain the difference between the web server and the app server. thanks for the help dude.  Hi Please Follow this link to found your query
how to use a JInternalFrame in a JFrame to create a chat window in a client/server app?
/server app?  how to use a JInternalFrame within a JFrame? i want to create a client/server app. i know that JIternalFrame should be used with JDeskTopPane but i want a chat window which can be moved within the app(just like
your app crashed in ipad 2 running iOS 5.0.1
your app crashed in ipad 2 running iOS 5.0.1  I submit my universal...... "We found your app crashed in ipad 2 running iOS 5.0.1, witch is not in compliance with the App Store Review Guidelines." Can anyone please tell me how
how to test iphone app on iphone without developer program
how to test iphone app on iphone without developer program  Is it possible to test the iPhone application on different device without the UDID Key... to prevent broad non-app-store distribution, and the UDID/certificate is what
The app was not installed on iphone because its resources have been modified
The app was not installed on iphone because its resources have been modified  Hi, I am getting following error while my client is installing my AdHoc build on his iPhone: "The app was not installed on iphone because its
Writing a web page to test drive each method in the web app
Writing a web page to test drive each method in the web app  I got an assignment in my university. I need to write a single web page, that lists all the classes in the particular web app. Selecting a class, the page should list
How to delete and update from Jtable cell in swing app
How to delete and update from Jtable cell in swing app  Hii Sir, I am developing a swing app for adding,updating and deleting from jtable... { // The driver allows you to query the database with Java // forName
how to develop free app download from Inapp purchase using objective C - Development process
how to develop free app download from Inapp purchase using objective C ... to give free app downloading. while user to buy any app from inapp purchase before that free app will downloaded is necessary.. i need this particular function
how do i make a phone call from my app without quitting my application
how do i make a phone call from my app without quitting my application  hi, I am working on creating a call application, i am making a call from my app through NSURL *targetUrl = [NSURL URLWithString:@"tel:123456789
Embedding HTML in iPhone App
Embedding HTML in iPhone App This example illustrate you how to embed the HTML in iPhone application. To embed the HTML file we required a UIWebView... to embed HTML into UIWebView iphone app - (void)viewDidLoad { NSString
 

 

 

DMCA.com