SlideShare a Scribd company logo
1 of 7
UNIQUE COMPUTER


AWT- Close
import java.awt.*;
import java.awt.event.*;
public class awt_close
{
  public static void main(String[] args)
{
  Frame frame = new Frame("Close Operation Frame");
  Label lbl = new Label("Welcome to Unique Computer: ",Label.CENTER);
  frame.add(lbl);
  frame.setSize(400,400);
  frame.setVisible(true);
  frame.addWindowListener(new WindowAdapter()
         {
                  public void windowClosing(WindowEvent we)
                  {
                          System.exit(0);
                  }
         }
         );
  }
}


Data-1

import java.awt.*;
import java.awt.event.*;
class data extends Frame implements ActionListener
{
        TextField txt=new TextField(20);
        TextField txt2=new TextField(20);
        Label lbl=new Label("Name",Label.LEFT);
        Label lbl2=new Label("Output");
        Button input_b=new Button("Input");
        Button exit_b=new Button("Exit");
        public data(String title)
        {
                 super(title);
                 setLayout(new FlowLayout());
                 add(lbl);
                 add(txt);
                 add(lbl2);
                 txt2.setEditable(false);
                 add(txt2);
                 add(input_b);
                 input_b.setBackground(Color.yellow);
                 input_b.setForeground(Color.red);
UNIQUE COMPUTER


                 add(exit_b);
                 input_b.addActionListener(this);
                 exit_b.addActionListener(this);


          }
          public void actionPerformed(ActionEvent e)
          {
                   if(e.getSource()==input_b)
                   {
                            String a=txt.getText();
                            txt2.setText(a);
                   }
                   if(e.getSource()==exit_b)
                   {
                            System.exit(0);
                   }
          }
          public static void main(String args[])
          {
                   data t=new data("Testing Component");
                   t.setSize(250,250);
                   t.show();
          }
}


Data- 2

import java.awt.*;
import java.awt.event.*;
class data_2 extends Frame implements ActionListener
{
        TextField txt=new TextField(20);
        TextField txt2=new TextField(20);
        Label lbl=new Label("Name",Label.LEFT);
        Label lbl2=new Label("Output");
        Button input_b=new Button("Input");
        Button exit_b=new Button("Exit");
        public data_2(String title)
        {
                 super(title);
                 setLayout(new FlowLayout());
                 add(lbl);
                 add(txt);
                 add(lbl2);
                 txt2.setEditable(false);
                 add(txt2);
UNIQUE COMPUTER


               add(input_b);
               input_b.setBackground(Color.yellow);
               input_b.setForeground(Color.red);
               add(exit_b);
               input_b.addActionListener(this);
               exit_b.addActionListener(this);


       }
       public void actionPerformed(ActionEvent e)
       {
                if(e.getSource()==input_b)
                {
                         int num=Integer.parseInt(txt.getText());
                         int sq=num*num;
                         txt2.setText(String.valueOf(sq));
                }
                if(e.getSource()==exit_b)
                {
                         System.exit(0);
                }
       }
       public static void main(String args[])
       {
                data_2 t=new data_2("Testing Component");
                t.setSize(250,250);
                t.show();
       }
}




Frame Demo

import java.awt.*;
class framedemo extends Frame
{
         public framedemo(String title)
         {
                  super(title);
         }
         public static void main(String args[])
         {
                  framedemo obj=new framedemo("I have been Frame");
                  obj.setSize(500,500);
                  obj.setVisible(true);
         }
}
UNIQUE COMPUTER


Panel

import java.awt.*;
class paneldemo extends Panel
{
        public paneldemo()
        {

        }
        public static void main(String args[])
        {
                 paneldemo obj=new paneldemo();
                 Frame f=new Frame("Testing a Panel");
                 f.add(obj);
                 f.setSize(500,500);
                 f.setVisible(true);

        }
}


Label

import java.awt.*;
import java.awt.event.*;
class t_label extends Frame implements ActionListener
{
         TextField txt=new TextField(20);
         Label lbl=new Label("Name");
         Button exit_b=new Button("Exit");
         public t_label(String title)
         {
                  super(title);
                  setLayout(new FlowLayout());
                  add(lbl);
                  add(txt);
                  System.out.println();
                  add(exit_b);
                  exit_b.addActionListener(this);


        }
        public void actionPerformed(ActionEvent e)
        {
                if(e.getSource()==exit_b)
                {
                         System.exit(0);
                }
UNIQUE COMPUTER


       }
       public static void main(String args[])
       {
                t_label t=new t_label("Testing Component");
                t.setSize(250,250);
                t.show();
       }
}



                                             APPLET
Applet-Life Cycle:

import java.awt.*;
import java.applet.*;

public class applet_demo1 extends Applet
{
        public void init()
        {
                setBackground(Color.cyan);
                setForeground(Color.red);
        }
        public void start()
        {

       }
       public void stop()
       {

       }
       public void destroy()
       {
       }
       public void paint(Graphics g)
       {

       }
}
UNIQUE COMPUTER


Applet-String 1:

import java.awt.*;
import java.applet.*;
/*
<applet code="applet_demo2" width=300 height=100>
</applet>
*/
public class applet_demo2 extends Applet
{
        String msg;
        public void init()
        {
        setBackground(Color.cyan);
        setForeground(Color.red);
        msg="Inside init()";
        }
        public void start()
        {
        msg+=" Inside_Start()";
        }
        public void stop()
        {
        }
        public void destroy()
        {
        }
        public void paint(Graphics g)
        {
        msg+=" Inside_Paint()";
        g.drawString(msg,40,40);
        }
}


Applet String- Scrolling:
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.util.*;
/*
<applet code="applet_demo3" width=300 height=100>
</applet>
*/
UNIQUE COMPUTER


public class applet_demo3 extends Applet implements Runnable
{
        String msg;
        Thread t=null;
        char c;
        public void init()
        {
        setBackground(Color.cyan);
        setForeground(Color.red);
        msg=" A simple banner ";
        }
        public void start()
        {
                try
                {
                  t=new Thread(this);
                  t.start();
                }catch(Exception e){}
        }
        public void stop()
        {
        }
        public void destroy()
        {
        }
        public void paint(Graphics g)
        {
                g.drawString(msg,50,50);
        }
        public void run()
        {
                for(;;)
                {
                  try
                  {
                         repaint();
                         t.sleep(300);
                         c=msg.charAt(0);
                         msg=msg.substring(1,msg.length());
                         msg=msg+c;
                  }catch(Exception e){}
                 }
        }
}

More Related Content

What's hot

Java simple programs
Java simple programsJava simple programs
Java simple programsVEERA RAGAVAN
 
Cleanup and new optimizations in WPython 1.1
Cleanup and new optimizations in WPython 1.1Cleanup and new optimizations in WPython 1.1
Cleanup and new optimizations in WPython 1.1PyCon Italia
 
The Ring programming language version 1.5.4 book - Part 33 of 185
The Ring programming language version 1.5.4 book - Part 33 of 185The Ring programming language version 1.5.4 book - Part 33 of 185
The Ring programming language version 1.5.4 book - Part 33 of 185Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 9 of 31
The Ring programming language version 1.4.1 book - Part 9 of 31The Ring programming language version 1.4.1 book - Part 9 of 31
The Ring programming language version 1.4.1 book - Part 9 of 31Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 31 of 180
The Ring programming language version 1.5.1 book - Part 31 of 180The Ring programming language version 1.5.1 book - Part 31 of 180
The Ring programming language version 1.5.1 book - Part 31 of 180Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 40 of 210
The Ring programming language version 1.9 book - Part 40 of 210The Ring programming language version 1.9 book - Part 40 of 210
The Ring programming language version 1.9 book - Part 40 of 210Mahmoud Samir Fayed
 
Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.Nishan Barot
 
Advanced Java Practical File
Advanced Java Practical FileAdvanced Java Practical File
Advanced Java Practical FileSoumya Behera
 
The Ring programming language version 1.5.3 book - Part 10 of 184
The Ring programming language version 1.5.3 book - Part 10 of 184The Ring programming language version 1.5.3 book - Part 10 of 184
The Ring programming language version 1.5.3 book - Part 10 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.4 book - Part 9 of 30
The Ring programming language version 1.4 book - Part 9 of 30The Ring programming language version 1.4 book - Part 9 of 30
The Ring programming language version 1.4 book - Part 9 of 30Mahmoud Samir Fayed
 
4. Обработка ошибок, исключения, отладка
4. Обработка ошибок, исключения, отладка4. Обработка ошибок, исключения, отладка
4. Обработка ошибок, исключения, отладкаDEVTYPE
 
The Ring programming language version 1.3 book - Part 23 of 88
The Ring programming language version 1.3 book - Part 23 of 88The Ring programming language version 1.3 book - Part 23 of 88
The Ring programming language version 1.3 book - Part 23 of 88Mahmoud Samir Fayed
 
Java practice programs for beginners
Java practice programs for beginnersJava practice programs for beginners
Java practice programs for beginnersishan0019
 
The Ring programming language version 1.10 book - Part 101 of 212
The Ring programming language version 1.10 book - Part 101 of 212The Ring programming language version 1.10 book - Part 101 of 212
The Ring programming language version 1.10 book - Part 101 of 212Mahmoud Samir Fayed
 

What's hot (19)

Java simple programs
Java simple programsJava simple programs
Java simple programs
 
Cleanup and new optimizations in WPython 1.1
Cleanup and new optimizations in WPython 1.1Cleanup and new optimizations in WPython 1.1
Cleanup and new optimizations in WPython 1.1
 
The Ring programming language version 1.5.4 book - Part 33 of 185
The Ring programming language version 1.5.4 book - Part 33 of 185The Ring programming language version 1.5.4 book - Part 33 of 185
The Ring programming language version 1.5.4 book - Part 33 of 185
 
The Ring programming language version 1.4.1 book - Part 9 of 31
The Ring programming language version 1.4.1 book - Part 9 of 31The Ring programming language version 1.4.1 book - Part 9 of 31
The Ring programming language version 1.4.1 book - Part 9 of 31
 
The Ring programming language version 1.5.1 book - Part 31 of 180
The Ring programming language version 1.5.1 book - Part 31 of 180The Ring programming language version 1.5.1 book - Part 31 of 180
The Ring programming language version 1.5.1 book - Part 31 of 180
 
The Ring programming language version 1.9 book - Part 40 of 210
The Ring programming language version 1.9 book - Part 40 of 210The Ring programming language version 1.9 book - Part 40 of 210
The Ring programming language version 1.9 book - Part 40 of 210
 
Oop lecture9 13
Oop lecture9 13Oop lecture9 13
Oop lecture9 13
 
Java file
Java fileJava file
Java file
 
Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.
 
Advanced Java Practical File
Advanced Java Practical FileAdvanced Java Practical File
Advanced Java Practical File
 
The Ring programming language version 1.5.3 book - Part 10 of 184
The Ring programming language version 1.5.3 book - Part 10 of 184The Ring programming language version 1.5.3 book - Part 10 of 184
The Ring programming language version 1.5.3 book - Part 10 of 184
 
Javascript
JavascriptJavascript
Javascript
 
The Ring programming language version 1.4 book - Part 9 of 30
The Ring programming language version 1.4 book - Part 9 of 30The Ring programming language version 1.4 book - Part 9 of 30
The Ring programming language version 1.4 book - Part 9 of 30
 
Sam wd programs
Sam wd programsSam wd programs
Sam wd programs
 
4. Обработка ошибок, исключения, отладка
4. Обработка ошибок, исключения, отладка4. Обработка ошибок, исключения, отладка
4. Обработка ошибок, исключения, отладка
 
The Ring programming language version 1.3 book - Part 23 of 88
The Ring programming language version 1.3 book - Part 23 of 88The Ring programming language version 1.3 book - Part 23 of 88
The Ring programming language version 1.3 book - Part 23 of 88
 
Java File
Java FileJava File
Java File
 
Java practice programs for beginners
Java practice programs for beginnersJava practice programs for beginners
Java practice programs for beginners
 
The Ring programming language version 1.10 book - Part 101 of 212
The Ring programming language version 1.10 book - Part 101 of 212The Ring programming language version 1.10 book - Part 101 of 212
The Ring programming language version 1.10 book - Part 101 of 212
 

Similar to Awt

Chat application in java using swing and socket programming.
Chat application in java using swing and socket programming.Chat application in java using swing and socket programming.
Chat application in java using swing and socket programming.Kuldeep Jain
 
Java весна 2013 лекция 2
Java весна 2013 лекция 2Java весна 2013 лекция 2
Java весна 2013 лекция 2Technopark
 
Advanced Java - Practical File
Advanced Java - Practical FileAdvanced Java - Practical File
Advanced Java - Practical FileFahad Shaikh
 
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_04-Mar-2021_L14...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_04-Mar-2021_L14...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_04-Mar-2021_L14...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_04-Mar-2021_L14...MaruMengesha
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple ProgramsUpender Upr
 
Java programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarJava programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarROHIT JAISWAR
 
code for quiz in my sql
code for quiz  in my sql code for quiz  in my sql
code for quiz in my sql JOYITAKUNDU1
 
java slip for bachelors of business administration.pdf
java slip for bachelors of business administration.pdfjava slip for bachelors of business administration.pdf
java slip for bachelors of business administration.pdfkokah57440
 
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdfModify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdfarjuncorner565
 
I dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdfI dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdfarchanaemporium
 
JEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistJEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistAnton Arhipov
 
OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdfakkhan101
 

Similar to Awt (20)

Java programs
Java programsJava programs
Java programs
 
Chat application in java using swing and socket programming.
Chat application in java using swing and socket programming.Chat application in java using swing and socket programming.
Chat application in java using swing and socket programming.
 
Java весна 2013 лекция 2
Java весна 2013 лекция 2Java весна 2013 лекция 2
Java весна 2013 лекция 2
 
Advanced Java - Practical File
Advanced Java - Practical FileAdvanced Java - Practical File
Advanced Java - Practical File
 
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_04-Mar-2021_L14...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_04-Mar-2021_L14...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_04-Mar-2021_L14...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_04-Mar-2021_L14...
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
 
Java programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarJava programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswar
 
Java oops features
Java oops featuresJava oops features
Java oops features
 
code for quiz in my sql
code for quiz  in my sql code for quiz  in my sql
code for quiz in my sql
 
TDD Hands-on
TDD Hands-onTDD Hands-on
TDD Hands-on
 
662305 11
662305 11662305 11
662305 11
 
java slip for bachelors of business administration.pdf
java slip for bachelors of business administration.pdfjava slip for bachelors of business administration.pdf
java slip for bachelors of business administration.pdf
 
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdfModify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
 
JDK 8
JDK 8JDK 8
JDK 8
 
Awt components
Awt componentsAwt components
Awt components
 
I dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdfI dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdf
 
TechTalk - Dotnet
TechTalk - DotnetTechTalk - Dotnet
TechTalk - Dotnet
 
JEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistJEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with Javassist
 
OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdf
 
Nabil code
Nabil  codeNabil  code
Nabil code
 

Recently uploaded

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Recently uploaded (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Awt

  • 1. UNIQUE COMPUTER AWT- Close import java.awt.*; import java.awt.event.*; public class awt_close { public static void main(String[] args) { Frame frame = new Frame("Close Operation Frame"); Label lbl = new Label("Welcome to Unique Computer: ",Label.CENTER); frame.add(lbl); frame.setSize(400,400); frame.setVisible(true); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { System.exit(0); } } ); } } Data-1 import java.awt.*; import java.awt.event.*; class data extends Frame implements ActionListener { TextField txt=new TextField(20); TextField txt2=new TextField(20); Label lbl=new Label("Name",Label.LEFT); Label lbl2=new Label("Output"); Button input_b=new Button("Input"); Button exit_b=new Button("Exit"); public data(String title) { super(title); setLayout(new FlowLayout()); add(lbl); add(txt); add(lbl2); txt2.setEditable(false); add(txt2); add(input_b); input_b.setBackground(Color.yellow); input_b.setForeground(Color.red);
  • 2. UNIQUE COMPUTER add(exit_b); input_b.addActionListener(this); exit_b.addActionListener(this); } public void actionPerformed(ActionEvent e) { if(e.getSource()==input_b) { String a=txt.getText(); txt2.setText(a); } if(e.getSource()==exit_b) { System.exit(0); } } public static void main(String args[]) { data t=new data("Testing Component"); t.setSize(250,250); t.show(); } } Data- 2 import java.awt.*; import java.awt.event.*; class data_2 extends Frame implements ActionListener { TextField txt=new TextField(20); TextField txt2=new TextField(20); Label lbl=new Label("Name",Label.LEFT); Label lbl2=new Label("Output"); Button input_b=new Button("Input"); Button exit_b=new Button("Exit"); public data_2(String title) { super(title); setLayout(new FlowLayout()); add(lbl); add(txt); add(lbl2); txt2.setEditable(false); add(txt2);
  • 3. UNIQUE COMPUTER add(input_b); input_b.setBackground(Color.yellow); input_b.setForeground(Color.red); add(exit_b); input_b.addActionListener(this); exit_b.addActionListener(this); } public void actionPerformed(ActionEvent e) { if(e.getSource()==input_b) { int num=Integer.parseInt(txt.getText()); int sq=num*num; txt2.setText(String.valueOf(sq)); } if(e.getSource()==exit_b) { System.exit(0); } } public static void main(String args[]) { data_2 t=new data_2("Testing Component"); t.setSize(250,250); t.show(); } } Frame Demo import java.awt.*; class framedemo extends Frame { public framedemo(String title) { super(title); } public static void main(String args[]) { framedemo obj=new framedemo("I have been Frame"); obj.setSize(500,500); obj.setVisible(true); } }
  • 4. UNIQUE COMPUTER Panel import java.awt.*; class paneldemo extends Panel { public paneldemo() { } public static void main(String args[]) { paneldemo obj=new paneldemo(); Frame f=new Frame("Testing a Panel"); f.add(obj); f.setSize(500,500); f.setVisible(true); } } Label import java.awt.*; import java.awt.event.*; class t_label extends Frame implements ActionListener { TextField txt=new TextField(20); Label lbl=new Label("Name"); Button exit_b=new Button("Exit"); public t_label(String title) { super(title); setLayout(new FlowLayout()); add(lbl); add(txt); System.out.println(); add(exit_b); exit_b.addActionListener(this); } public void actionPerformed(ActionEvent e) { if(e.getSource()==exit_b) { System.exit(0); }
  • 5. UNIQUE COMPUTER } public static void main(String args[]) { t_label t=new t_label("Testing Component"); t.setSize(250,250); t.show(); } } APPLET Applet-Life Cycle: import java.awt.*; import java.applet.*; public class applet_demo1 extends Applet { public void init() { setBackground(Color.cyan); setForeground(Color.red); } public void start() { } public void stop() { } public void destroy() { } public void paint(Graphics g) { } }
  • 6. UNIQUE COMPUTER Applet-String 1: import java.awt.*; import java.applet.*; /* <applet code="applet_demo2" width=300 height=100> </applet> */ public class applet_demo2 extends Applet { String msg; public void init() { setBackground(Color.cyan); setForeground(Color.red); msg="Inside init()"; } public void start() { msg+=" Inside_Start()"; } public void stop() { } public void destroy() { } public void paint(Graphics g) { msg+=" Inside_Paint()"; g.drawString(msg,40,40); } } Applet String- Scrolling: import java.awt.*; import java.applet.*; import java.awt.event.*; import java.util.*; /* <applet code="applet_demo3" width=300 height=100> </applet> */
  • 7. UNIQUE COMPUTER public class applet_demo3 extends Applet implements Runnable { String msg; Thread t=null; char c; public void init() { setBackground(Color.cyan); setForeground(Color.red); msg=" A simple banner "; } public void start() { try { t=new Thread(this); t.start(); }catch(Exception e){} } public void stop() { } public void destroy() { } public void paint(Graphics g) { g.drawString(msg,50,50); } public void run() { for(;;) { try { repaint(); t.sleep(300); c=msg.charAt(0); msg=msg.substring(1,msg.length()); msg=msg+c; }catch(Exception e){} } } }