Share on Google+Share on Google+

praveen
AWT Tutorials
1 Answer(s)      6 years and 2 months ago
Posted in : Applet

How can i create multiple labels using AWT????

Ads

View Answers

February 16, 2011 at 11:37 AM


Java Applet Example multiple labels

1)AppletExample.java:

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

    public class AppletExample extends Applet implements ActionListener {
      TextField input1,input2,output;
      Label label1,label2,label3;
      Button b1;
      int num1,num2, sum = 0;
      public void init(){
        label1 = new Label("Number 1: ");
        add(label1);
        input1 = new TextField(5);
        add(input1);
        label2 = new Label("Number 2: ");
        add(label2);
        input2 = new TextField(5);
        add(input2);
        label3 = new Label("Sum : ");
        add(label3);
        output = new TextField(10);
        add(output);
        b1 = new Button("Add");
        add(b1);
        b1.addActionListener(this);
           }
      public void actionPerformed(ActionEvent ae){
        try{
          num1 = Integer.parseInt(input1.getText());
          num2 = Integer.parseInt(input2.getText());
          sum = num1+num2;
          output.setText(Integer.toString(sum));
         }
        catch(NumberFormatException e){
        }
      }
    }

2)applet.html:

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









Related Tutorials/Questions & Answers:
AWT Tutorials
AWT Tutorials  How can i create multiple labels using AWT????   Java Applet Example multiple labels 1)AppletExample.java: import javax.swing.*; import java.applet.*; import java.awt.*; import
AWT
AWT  How to set size of button in awt
Advertisements
awt
Java AWT Applet example  how to display data using JDBC in awt/applet
awt
JDBC and AWT to display data  how to display data using JDBC in awt/applet
awt
JDBC in awt applet  how to display data using JDBC in awt/applet
awt
JDBC in awt  how to display data using JDBC in awt/applet
AWT basics
? Here we have provided you the links to our AWT tutorials. AWT stands... good GUI for windows applications. Here are the links to AWT Tutorials: AWT... AWT tutorials Thanks
AWT & SWING
AWT & SWING  What is diffennce between AWT & SWING
AWT programmes - Swing AWT
AWT programmes  I need few programs for menus in AWT. how to open a filed dialog window, and how to save a image in the save window when we press... has all AWT programms which must open,save and make changes to a particular
AWT-swings tutorial - Swing AWT
AWT-swings tutorial  hello sir, i am learnings swings and applets.. i want some tutorials and some examples related to swings.. thank you sir..waiting for your answer.  Hi friend, I am sending you a link
tutorials - EJB
ejb tutorial for beginners free  Can anyone give me the reference of EJB tutorials for beginners
awt in java
awt in java  using awt in java gui programming how to false the maximization property of a frame
Photoshop tutorials
Photoshop tutorials  Hi, Where to learn Photoshop? Thanks   Hello, Check Photoshop tutorials home page. Thanks
JSP Tutorials
JSP Tutorials  Hi, I am confident in core java. I have learned if from roseindia.net. Now I want to learn JSP. Can anyone tell me JSP tutorials url... roseindia.net. Now you can learn Java Server pages at our JSP Tutorials section
Java AWT
Java AWT  What interface is extended by AWT event listeners
awt jdbc
awt jdbc  programm in java to accept the details of doctor (dno,dname,salary)user & insert it into the database(use prerparedstatement class&awt
java tutorials
java tutorials  Hi, Much appreciated response. i am looking for the links of java tutorials which describes both core and advanced java concepts in detail with examples in a systematic order.few links i found are discussing
SWINGS - Swing AWT
more information,Examples and Tutorials on Swing,AWT visit to : http://www.roseindia.net/java/example/java/awt/ http://www.roseindia.net/java/example/java
C++Tutorials
other tutorials, such as C++: Annotations by Frank Brokken and Karel Kubat...; The CPlusPlus Language Tutorial These tutorials explain the C++ language.... We have a series of online courses and tutorials that will teach you either
awt - Swing AWT
awt  dear sir my proble is , i have applet code which is stock market chart this code made using "AWT" . in this chart one textbox when user.../java/awt/ Thanks
Java AWT
Java AWT  What is meant by controls and what are different types of controls in AWT
Photoshop - Photoshop Tutorials
Photoshop - Photoshop Tutorials
JSP Tutorials - Page 3
JSP Tutorials - Page 3
awt swings - Swing AWT
awt swings  hello sir, My requirement is to insert captured image from cam onto a frame and from that place i hve to save it in the database(MySql).its urgent sir.it is a part of my project..if code is available
Roseindia Tutorials
Roseindia.net website Tutorials brings you the best tutorials for different computing platforms and programming languages like Java Tutorials, JSP Tutorials, Hibernate Tutorials, Struts Tutorials, JSF Tutorials, MySQL Tutorials, Spring
java awt calender
java awt calender  java awt code for calender to include beside a textfield
JAVA AWT BASE PROJECT
JAVA AWT BASE PROJECT  suggest meaningful java AWT-base project
Tutorials on Java
Tutorials on Java Tutorials on Java topics help programmers to learn... anywhere can make use of them. Tutorials along with Video tutorials, examples.... These tutorials are part of online Java course that is provided by RoseIndia which help
Good tutorials for beginners in Java
Good tutorials for beginners in Java   Hi, I am beginners in Java, can someone help me in knowing if there any tutorials which can provide me in details about good tutorials for beginners in Java with example? Thanks.   
Java AWT event hierarchy
Java AWT event hierarchy  What class is the top of the AWT event hierarchy?  The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy
awt list item* - Swing AWT
awt list item*  how do i make an item inside my listitem not visible  Hi friend, import java.awt.*; import java.awt.event.... information. http://www.roseindia.net/java/example/java/awt/ Thanks
Tutorials   
Java Spring Hibernate Struts Training Error in calling javascript function from java prg Creating an Applet java program Display Java in JSP Draw bufferimage in jpanel using netbeans Moving Applet Problem c programming Attendence Management system java program of different shapes help applet printing p applet dought Help please, some strange errors Write an applet to display scrolling image in an applet window using thread. Simple Java applet that need usernam, password and textfield. conversion Applet java program java program java program scrolling text in applet java java applet java applet project in java using applet and servlet...which tool i should use?eclipse or netbeans? java user input to database user input to database user input to database button to accept user input jframe what is web .config method Can any one please help me in this ,,,,,,, need java code for this ,,,,please anyone applet question Write an Applet which display current date and time on the web page?? Write an Applet which display current date and time on the web page?? Java Applet - Adding a Button to Decrease a Total Applet Application how to drag top most images which is draw on applet. convert java Application to Java Applet convert java Application to Java Applet Problem In applet Its run on browser but hang and blinking when image is draging some where. how to access database in applet How to add dropdown list in a row of a sort table applet? java project topics plz anyone can solve my Layout Manager Project Guidance applet is running but no display

Ads

 
Advertisement null

Ads