SlideShare ist ein Scribd-Unternehmen logo
1 von 5
Downloaden Sie, um offline zu lesen
/* CODE COMPILED AND CREATED BY
   SHALABH PAREEK
   LECTURER
   GEETANJALI INSTITUTE OF TECHNICAL STUDIES
   UDAIPUR(RAJ.)
*/


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

class PinGame extends JFrame implements ActionListener
{

   JTextField [] tf ;
   JLabel [] tl;
   JButton submit,clear;
   JLabel lscore;
   JTextField tfscore ;
   String [] stf   = {"X1","X2","RESET OUT","SOD","SID",
                       "TRAP","RST 7.5","RST 6.5","RST 5.5","INTR","INTA",
                       "AD0","AD1","AD2","AD3","AD4","AD5","AD6","AD7","VSS",
                       "A8","A9","A10","A11","A12","A13","A14","A15",
                       "S0","ALE","WR","RD","S1","IO/M","READY","RESET IN",
                       "CLK (OUT)","HLDA","HOLD","VCC" };

   PinGame ()
   {
        super("Pin Diagram ­ 8085");
        setLayout(null);
        setBounds(0,0,1100,750);
        setBackground(Color.gray);


                 JLabel in1 = new JLabel("INSTRUCTIONS :");
                 JLabel in2 = new JLabel("1. ENTER NAME OF EACH PIN IN GIVEN 
TEXTFIELD");
                 JLabel in3 = new JLabel("2. YOU WILL EARN ONE POINT FOR EVERY RIGHT 
ANSWER");
        JLabel in4 = new JLabel("3. NO NEGATIVE MARKING");
        JLabel in5 = new JLabel("4. ENTER PIN NAMES IN UPPERCASE ONLY ");
        JLabel in6 = new JLabel("5. WRITE ACTIVE LOW SIGNALS WITHOUT COMPLEMENT 
SIGN ");
        JLabel in7 = new JLabel("6. WHEN DONE CLICK ON SUBMIT TO GET RESULT");

        in1.setBounds(550,10,400,80 );
        in2.setBounds(550,50,400,80 );
        in3.setBounds(550,90,400,80 );
        in4.setBounds(550,130,400,80 );
        in5.setBounds(550,170,400,80 );
        in6.setBounds(550,210,400,80 );
        in7.setBounds(550,250,400,80 );

        add(in1);
        add(in2);
        add(in3);
        add(in4);
        add(in5);
        add(in6);
        add(in7);

        Font f1 = new Font ("Bookman Old Style",Font.BOLD,16);

        tf = new JTextField[40];
        tl = new JLabel[40];

        submit = new JButton("SUBMIT");
        clear  = new JButton("CLEAR");
        lscore = new JLabel("YOU SCORED = " );
        tfscore = new JTextField();
        submit.setBounds(450,400,80,20 );
        lscore.setBounds(600,400,120,20 );
        tfscore.setBounds(750,400,80,20 );
        clear.setBounds(450,500,80,20 );
        add(submit);
        add(lscore);
        add(tfscore);
        add(clear);

        submit.addActionListener(this);
        clear.addActionListener(this);



         String[] sl = {"1","2","3","4","5","6","7","8","9","10",
                         "11","12","13","14","15","16","17","18","19","20",
                         "21","22","23","24","25","26","27","28","29","30",
                         "31","32","33","34","35","36","37","38","39","40"};



        int tfx = 20, tfy = 10,length = 80,width = 28;
        for(int i = 0; i<20;i++)
        {

            tf[i] = new JTextField();
            tf[i].setBounds(tfx,tfy,length,width);
            tfy = tfy + 30;
            add(tf[i]);
        }
        tfx = 325;
        for(int i = 20; i<40;i++)
        {
            tfy = tfy ­ 30;
            tf[i] = new JTextField();
            tf[i].setBounds(tfx,tfy,length,width);

            add(tf[i]);
        }

         for(int i = 0; i<40;i++)
        {
            tf[i].setFont(new Font ("Century Schoolbook",Font.BOLD,12));

        }



        int lx = 150, ly = 10,llength = 80,lwidth = 28;
        for(int i = 0; i<20;i++)
        {

            tl[i] = new JLabel(sl[i]);
            tl[i].setBounds(lx,ly,llength,lwidth);
            ly = ly + 30;
            add(tl[i]);
        }
        lx = 250;
        for(int i = 20; i<40;i++)
        {
            ly = ly ­ 30;
            tl[i] = new JLabel(sl[i]);
            tl[i].setBounds(lx,ly,llength,lwidth);
            add(tl[i]);
        }

        addWindowListener(new END());
        setVisible(true) ;

    }


    public static void main(String[] args)
    {
          new PinGame();


    }
    public void actionPerformed(ActionEvent ae)
    {
       int score = 0;



    if(ae.getSource()==submit)
    {
       String[] s3 = new String[40];

       for(int i = 0;i<40;i++)
        {
         s3[i] = tf[i].getText();
        // s3[i] = String.toUpperCase(s3[i]);
        }

       for (int i = 0;i<40;i++)
        {
           if( s3[i].equals(stf[i]) )
            {
              score++;
            }

           else
            {
              tf[i].setText("TRY AGAIN");
            }

        }

        Integer i1 = new Integer(score);
        tfscore.setText(i1.toString());
    }

    if(ae.getSource()==clear)
    {
      for(int i = 0; i<40;i++)
        {
            tfscore.setText("");
            tf[i].setText("");

        }


    }



    }
}

class END extends WindowAdapter
{
    public void windowClosing(WindowEvent e)
    {
      System.exit(0);
    }

}

Weitere ähnliche Inhalte

Ähnlich wie Pingame

The Australian-The Deal Magazine
The Australian-The Deal MagazineThe Australian-The Deal Magazine
The Australian-The Deal Magazine
drocallaghan
 
Introduction aux Macros
Introduction aux MacrosIntroduction aux Macros
Introduction aux Macros
univalence
 
Архитектура коммутаторов Cisco Catalyst 6500
Архитектура коммутаторов Cisco Catalyst 6500Архитектура коммутаторов Cisco Catalyst 6500
Архитектура коммутаторов Cisco Catalyst 6500
Cisco Russia
 

Ähnlich wie Pingame (14)

Beauty and the beast - Haskell on JVM
Beauty and the beast  - Haskell on JVMBeauty and the beast  - Haskell on JVM
Beauty and the beast - Haskell on JVM
 
Eta
EtaEta
Eta
 
jQuery Mobile & PhoneGap
jQuery Mobile & PhoneGapjQuery Mobile & PhoneGap
jQuery Mobile & PhoneGap
 
The Australian-The Deal Magazine
The Australian-The Deal MagazineThe Australian-The Deal Magazine
The Australian-The Deal Magazine
 
Don't Be Afraid of Abstract Syntax Trees
Don't Be Afraid of Abstract Syntax TreesDon't Be Afraid of Abstract Syntax Trees
Don't Be Afraid of Abstract Syntax Trees
 
Avoiding JavaScript Pitfalls Through Tree Hugging
Avoiding JavaScript Pitfalls Through Tree HuggingAvoiding JavaScript Pitfalls Through Tree Hugging
Avoiding JavaScript Pitfalls Through Tree Hugging
 
Spark Summit EU talk by Ted Malaska
Spark Summit EU talk by Ted MalaskaSpark Summit EU talk by Ted Malaska
Spark Summit EU talk by Ted Malaska
 
Return Oriented Programming, an introduction
Return Oriented Programming, an introductionReturn Oriented Programming, an introduction
Return Oriented Programming, an introduction
 
Endevor api an introduction to the endevor application programming interface
Endevor api   an introduction to the endevor application programming interface Endevor api   an introduction to the endevor application programming interface
Endevor api an introduction to the endevor application programming interface
 
Security Challenges in Node.js
Security Challenges in Node.jsSecurity Challenges in Node.js
Security Challenges in Node.js
 
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
 
Introduction aux Macros
Introduction aux MacrosIntroduction aux Macros
Introduction aux Macros
 
Batteries included: Advantages of an End-to-end solution
Batteries included: Advantages of an End-to-end solutionBatteries included: Advantages of an End-to-end solution
Batteries included: Advantages of an End-to-end solution
 
Архитектура коммутаторов Cisco Catalyst 6500
Архитектура коммутаторов Cisco Catalyst 6500Архитектура коммутаторов Cisco Catalyst 6500
Архитектура коммутаторов Cisco Catalyst 6500
 

Kürzlich hochgeladen

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Kürzlich hochgeladen (20)

Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 

Pingame