TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Saturday, 11 April 2020

Event Handling In Applet | Mouse Event Handling In Applet

                           Event Handling in Applet

As we perform event handling in AWT or Swing, we can perform it in
 applet also.The simple example of event handling in applet that
 prints a message by click on the button.

Example of EventHandling in applet:

 import java.applet.*;   import java.awt.*;   import java.awt.event.*;  
      public class EventApplet extends Applet implements ActionListener{    
      Button b;  
      TextField tf;       
       public void init(){  
t      f=new TextField();  
t      f.setBounds(30,40,150,20);   
       b=new Button("Click");   
       b.setBounds(80,150,60,50);  
       add(b);add(tf);   
       b.addActionListener(this);  
       setLayout(null);  
       }  
       public void actionPerformed(ActionEvent e){  
       tf.setText("Welcome");  
       }   

myapplet.html

     <html>  
     <body>  
     <applet code="EventApplet.class" width="300" height="300">  
     </applet>  
     </body>  
      </html>  

mouse event handling in applet

Fig: Event Handling In Applet 

No comments:

Post a Comment