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

JApplet Class In Applet

                                   JApplet class in Applet

As we prefer Swing to AWT. Now we can use JApplet that can have all
the controls of swing. The JApplet class extends the Applet class.

Applet in JApplet class

Fig: JApplet In Applet 

Example of EventHandling in JApplet:

    import java.applet.*;   
    import javax.swing.*;   
    import java.awt.event.*;   
    public class EventJApplet extends JApplet implements ActionListener{  
    JButton b;  
    JTextField tf;  
    public void init(){    
t   f=new JTextField();  
t   f.setBounds(30,40,150,20);  
    b=new JButton("Click");   
    b.setBounds(80,150,70,40);   
    add(b);add(tf);   
    b.addActionListener(this);  
    setLayout(null);  
    }  
    public void actionPerformed(ActionEvent e){  
t   f.setText("Welcome");     
    } 

myapplet.html 

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

No comments:

Post a Comment