SlideShare a Scribd company logo
1 of 14
Download to read offline
GETTING STARTED WITH GUI PROGRAMMING 2


By .Muhammad Shebl
OBJECTIVES
 1.   Labels & Images
 2.   Buttons
 3.   Text Fields & Text Area
 4.   Combo Boxes
 5.   Check box
 6.   Set bounds layout
 7.   Pack() & setResizable()
 8.   Menus
Labels :
 JLabel lab=new JLabel(“MUFIX”);


 ImageIcon icon = new ImageIcon("sigin.png");
JLabel lab=new JLabel(icon );
BUTTONS :
  Adding Event :
 JButton jbt = new JButton("OK");
 jbt.addActionListener(this );


  Add icon image :
  ImageIcon icon = new
    ImageIcon("sigin.png");
 JButton jbt = new JButton(icon);
BUTTONS :
Roll over icon :
   ImageIcon icon = new
    ImageIcon("sigin.png");
 JButton jbt = new JButton(icon);
 Jbt.setRolloverIcon(icon);
BUTTONS:
Roll Pressedicon :


  ImageIcon icon = new
  ImageIcon("sigin.png");
JButton jbt = new JButton(icon);
jbt.setPressedIcon(icon);
TEXT AREA
 If you want to let the user enter multiple
  lines of text, you have to create several
  instances of JTextField. A better alternative
  is to use JTextArea, which enables the user
  to enter multiple lines of text.


 JTextArea jtaNote = new JTextArea(5, 20);
TEXT FIELDS KEY LISTNERS :
// Create a text field with text "Type Name Here"
JTextField jtfName = new JTextField("Type Name Here");


jtfName .addKeyListener(this);
Array of Text Fields
    You can create Array of Text fields by:

    JTextField[][] txt = new JTextField[x][y];

    for (int i = 0; i < x; i++) {

            for (int j = 0; j < y; j++) {

          txt[i][j] = new JTextField(10);

                 panel.add(txt[i][j]);

    txt[i][j].setHorizontalAlignment(JTextField.CENTER);

                 if (i == j) {

                   txt[i][j].setText("1");

                   txt[i][j].setEditable(false);

                 } txt[i][j].addKeyListener(this);

            }}
Combo box
 To Create Combo box :
 JComboBox operations_txt= new JComboBox(new String[]{"<=", "=", ">="});

Operation_txt. getSelectedItem();
Check box :
// Create a check box with text bold
JCheckBox jchkBold = new JCheckBox("Bold");


 jchkBold.addActionListener(new ActionListener() {

       public void actionPerformed(ActionEvent e) {
         if (jchkBold.isSelected()) {
             // your Action
         }
       }
    });
QUESTIONS ?!!
TASK : FULL CALCULATOR
Thank You

More Related Content

What's hot

The Ring programming language version 1.8 book - Part 68 of 202
The Ring programming language version 1.8 book - Part 68 of 202The Ring programming language version 1.8 book - Part 68 of 202
The Ring programming language version 1.8 book - Part 68 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 18 of 31
The Ring programming language version 1.4.1 book - Part 18 of 31The Ring programming language version 1.4.1 book - Part 18 of 31
The Ring programming language version 1.4.1 book - Part 18 of 31Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 44 of 88
The Ring programming language version 1.3 book - Part 44 of 88The Ring programming language version 1.3 book - Part 44 of 88
The Ring programming language version 1.3 book - Part 44 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 49 of 88
The Ring programming language version 1.3 book - Part 49 of 88The Ring programming language version 1.3 book - Part 49 of 88
The Ring programming language version 1.3 book - Part 49 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 77 of 210
The Ring programming language version 1.9 book - Part 77 of 210The Ring programming language version 1.9 book - Part 77 of 210
The Ring programming language version 1.9 book - Part 77 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 43 of 88
The Ring programming language version 1.3 book - Part 43 of 88The Ring programming language version 1.3 book - Part 43 of 88
The Ring programming language version 1.3 book - Part 43 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 78 of 212
The Ring programming language version 1.10 book - Part 78 of 212The Ring programming language version 1.10 book - Part 78 of 212
The Ring programming language version 1.10 book - Part 78 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 70 of 202
The Ring programming language version 1.8 book - Part 70 of 202The Ring programming language version 1.8 book - Part 70 of 202
The Ring programming language version 1.8 book - Part 70 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 71 of 210
The Ring programming language version 1.9 book - Part 71 of 210The Ring programming language version 1.9 book - Part 71 of 210
The Ring programming language version 1.9 book - Part 71 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 64 of 181
The Ring programming language version 1.5.2 book - Part 64 of 181The Ring programming language version 1.5.2 book - Part 64 of 181
The Ring programming language version 1.5.2 book - Part 64 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 70 of 184
The Ring programming language version 1.5.3 book - Part 70 of 184The Ring programming language version 1.5.3 book - Part 70 of 184
The Ring programming language version 1.5.3 book - Part 70 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 67 of 202
The Ring programming language version 1.8 book - Part 67 of 202The Ring programming language version 1.8 book - Part 67 of 202
The Ring programming language version 1.8 book - Part 67 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 47 of 88
The Ring programming language version 1.3 book - Part 47 of 88The Ring programming language version 1.3 book - Part 47 of 88
The Ring programming language version 1.3 book - Part 47 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 46 of 84
The Ring programming language version 1.2 book - Part 46 of 84The Ring programming language version 1.2 book - Part 46 of 84
The Ring programming language version 1.2 book - Part 46 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.4 book - Part 16 of 30
The Ring programming language version 1.4 book - Part 16 of 30The Ring programming language version 1.4 book - Part 16 of 30
The Ring programming language version 1.4 book - Part 16 of 30Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 41 of 84
The Ring programming language version 1.2 book - Part 41 of 84The Ring programming language version 1.2 book - Part 41 of 84
The Ring programming language version 1.2 book - Part 41 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 77 of 212
The Ring programming language version 1.10 book - Part 77 of 212The Ring programming language version 1.10 book - Part 77 of 212
The Ring programming language version 1.10 book - Part 77 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 74 of 212
The Ring programming language version 1.10 book - Part 74 of 212The Ring programming language version 1.10 book - Part 74 of 212
The Ring programming language version 1.10 book - Part 74 of 212Mahmoud Samir Fayed
 

What's hot (20)

The Ring programming language version 1.8 book - Part 68 of 202
The Ring programming language version 1.8 book - Part 68 of 202The Ring programming language version 1.8 book - Part 68 of 202
The Ring programming language version 1.8 book - Part 68 of 202
 
The Ring programming language version 1.4.1 book - Part 18 of 31
The Ring programming language version 1.4.1 book - Part 18 of 31The Ring programming language version 1.4.1 book - Part 18 of 31
The Ring programming language version 1.4.1 book - Part 18 of 31
 
The Ring programming language version 1.3 book - Part 44 of 88
The Ring programming language version 1.3 book - Part 44 of 88The Ring programming language version 1.3 book - Part 44 of 88
The Ring programming language version 1.3 book - Part 44 of 88
 
The Ring programming language version 1.3 book - Part 49 of 88
The Ring programming language version 1.3 book - Part 49 of 88The Ring programming language version 1.3 book - Part 49 of 88
The Ring programming language version 1.3 book - Part 49 of 88
 
The Ring programming language version 1.9 book - Part 77 of 210
The Ring programming language version 1.9 book - Part 77 of 210The Ring programming language version 1.9 book - Part 77 of 210
The Ring programming language version 1.9 book - Part 77 of 210
 
The Ring programming language version 1.3 book - Part 43 of 88
The Ring programming language version 1.3 book - Part 43 of 88The Ring programming language version 1.3 book - Part 43 of 88
The Ring programming language version 1.3 book - Part 43 of 88
 
The Ring programming language version 1.10 book - Part 78 of 212
The Ring programming language version 1.10 book - Part 78 of 212The Ring programming language version 1.10 book - Part 78 of 212
The Ring programming language version 1.10 book - Part 78 of 212
 
The Ring programming language version 1.8 book - Part 70 of 202
The Ring programming language version 1.8 book - Part 70 of 202The Ring programming language version 1.8 book - Part 70 of 202
The Ring programming language version 1.8 book - Part 70 of 202
 
The Ring programming language version 1.9 book - Part 71 of 210
The Ring programming language version 1.9 book - Part 71 of 210The Ring programming language version 1.9 book - Part 71 of 210
The Ring programming language version 1.9 book - Part 71 of 210
 
The Ring programming language version 1.5.2 book - Part 64 of 181
The Ring programming language version 1.5.2 book - Part 64 of 181The Ring programming language version 1.5.2 book - Part 64 of 181
The Ring programming language version 1.5.2 book - Part 64 of 181
 
The Ring programming language version 1.5.3 book - Part 70 of 184
The Ring programming language version 1.5.3 book - Part 70 of 184The Ring programming language version 1.5.3 book - Part 70 of 184
The Ring programming language version 1.5.3 book - Part 70 of 184
 
The Ring programming language version 1.8 book - Part 67 of 202
The Ring programming language version 1.8 book - Part 67 of 202The Ring programming language version 1.8 book - Part 67 of 202
The Ring programming language version 1.8 book - Part 67 of 202
 
The Ring programming language version 1.3 book - Part 47 of 88
The Ring programming language version 1.3 book - Part 47 of 88The Ring programming language version 1.3 book - Part 47 of 88
The Ring programming language version 1.3 book - Part 47 of 88
 
Qtp best tutorial
Qtp best tutorialQtp best tutorial
Qtp best tutorial
 
The Ring programming language version 1.2 book - Part 46 of 84
The Ring programming language version 1.2 book - Part 46 of 84The Ring programming language version 1.2 book - Part 46 of 84
The Ring programming language version 1.2 book - Part 46 of 84
 
The Ring programming language version 1.4 book - Part 16 of 30
The Ring programming language version 1.4 book - Part 16 of 30The Ring programming language version 1.4 book - Part 16 of 30
The Ring programming language version 1.4 book - Part 16 of 30
 
The Ring programming language version 1.2 book - Part 41 of 84
The Ring programming language version 1.2 book - Part 41 of 84The Ring programming language version 1.2 book - Part 41 of 84
The Ring programming language version 1.2 book - Part 41 of 84
 
Punto fijo multivariante
Punto fijo multivariantePunto fijo multivariante
Punto fijo multivariante
 
The Ring programming language version 1.10 book - Part 77 of 212
The Ring programming language version 1.10 book - Part 77 of 212The Ring programming language version 1.10 book - Part 77 of 212
The Ring programming language version 1.10 book - Part 77 of 212
 
The Ring programming language version 1.10 book - Part 74 of 212
The Ring programming language version 1.10 book - Part 74 of 212The Ring programming language version 1.10 book - Part 74 of 212
The Ring programming language version 1.10 book - Part 74 of 212
 

Viewers also liked

Assedio moral nas escolas - SEPE
Assedio moral  nas escolas - SEPEAssedio moral  nas escolas - SEPE
Assedio moral nas escolas - SEPEAdriana De Moraes
 
Leave management system
Leave management systemLeave management system
Leave management systemAyushi Gaur
 
RFID Based Student Attendance Management System in India
RFID Based Student Attendance Management System in IndiaRFID Based Student Attendance Management System in India
RFID Based Student Attendance Management System in IndiaSmart Schooling
 
Leave Management System Documentation
Leave Management System DocumentationLeave Management System Documentation
Leave Management System Documentationmuzammil siddiq
 
Java Based RFID Attendance Management System Graduation Project Presentation
Java Based RFID Attendance Management System Graduation Project PresentationJava Based RFID Attendance Management System Graduation Project Presentation
Java Based RFID Attendance Management System Graduation Project PresentationIbrahim Abdel Fattah Mohamed
 
Employee Management System
Employee Management SystemEmployee Management System
Employee Management SystemAnjali Agrawal
 
Leave management System
Leave management SystemLeave management System
Leave management Systempratikmahorey
 
Inventory management
Inventory managementInventory management
Inventory managementKuldeep Uttam
 
Leave management system chp 1 4
Leave management system chp 1 4Leave management system chp 1 4
Leave management system chp 1 4Einstein Balaara
 
Leave Management System: Software Requirements Specification Document(SRS)
Leave Management System: Software Requirements Specification Document(SRS) Leave Management System: Software Requirements Specification Document(SRS)
Leave Management System: Software Requirements Specification Document(SRS) Abhilasha Lahigude
 
Inventory Management - a ppt for PGDM/MBA
Inventory Management - a ppt for PGDM/MBAInventory Management - a ppt for PGDM/MBA
Inventory Management - a ppt for PGDM/MBAAJ Raina
 

Viewers also liked (14)

Assedio moral nas escolas - SEPE
Assedio moral  nas escolas - SEPEAssedio moral  nas escolas - SEPE
Assedio moral nas escolas - SEPE
 
NYC Venues
NYC VenuesNYC Venues
NYC Venues
 
Lms final ppt
Lms final pptLms final ppt
Lms final ppt
 
Leave management system
Leave management systemLeave management system
Leave management system
 
Leave management System
Leave management SystemLeave management System
Leave management System
 
RFID Based Student Attendance Management System in India
RFID Based Student Attendance Management System in IndiaRFID Based Student Attendance Management System in India
RFID Based Student Attendance Management System in India
 
Leave Management System Documentation
Leave Management System DocumentationLeave Management System Documentation
Leave Management System Documentation
 
Java Based RFID Attendance Management System Graduation Project Presentation
Java Based RFID Attendance Management System Graduation Project PresentationJava Based RFID Attendance Management System Graduation Project Presentation
Java Based RFID Attendance Management System Graduation Project Presentation
 
Employee Management System
Employee Management SystemEmployee Management System
Employee Management System
 
Leave management System
Leave management SystemLeave management System
Leave management System
 
Inventory management
Inventory managementInventory management
Inventory management
 
Leave management system chp 1 4
Leave management system chp 1 4Leave management system chp 1 4
Leave management system chp 1 4
 
Leave Management System: Software Requirements Specification Document(SRS)
Leave Management System: Software Requirements Specification Document(SRS) Leave Management System: Software Requirements Specification Document(SRS)
Leave Management System: Software Requirements Specification Document(SRS)
 
Inventory Management - a ppt for PGDM/MBA
Inventory Management - a ppt for PGDM/MBAInventory Management - a ppt for PGDM/MBA
Inventory Management - a ppt for PGDM/MBA
 

Similar to Getting started with GUI programming in Java_2

Getting started with GUI programming in Java_1
Getting started with GUI programming in Java_1Getting started with GUI programming in Java_1
Getting started with GUI programming in Java_1Muhammad Shebl Farag
 
Tic Tac Toe game with GUI please dont copy and paste from google. .pdf
Tic Tac Toe game with GUI please dont copy and paste from google. .pdfTic Tac Toe game with GUI please dont copy and paste from google. .pdf
Tic Tac Toe game with GUI please dont copy and paste from google. .pdfformaxekochi
 
Creating a Facebook Clone - Part XLII.pdf
Creating a Facebook Clone - Part XLII.pdfCreating a Facebook Clone - Part XLII.pdf
Creating a Facebook Clone - Part XLII.pdfShaiAlmog1
 
Tic Tac Toe game with GUI written in java.SolutionAnswerimp.pdf
Tic Tac Toe game with GUI written in java.SolutionAnswerimp.pdfTic Tac Toe game with GUI written in java.SolutionAnswerimp.pdf
Tic Tac Toe game with GUI written in java.SolutionAnswerimp.pdfinfomalad
 
Creating a Facebook Clone - Part XV - Transcript.pdf
Creating a Facebook Clone - Part XV - Transcript.pdfCreating a Facebook Clone - Part XV - Transcript.pdf
Creating a Facebook Clone - Part XV - Transcript.pdfShaiAlmog1
 
Creating an Uber Clone - Part IX.pdf
Creating an Uber Clone - Part IX.pdfCreating an Uber Clone - Part IX.pdf
Creating an Uber Clone - Part IX.pdfShaiAlmog1
 
Advanced java programming
Advanced java programmingAdvanced java programming
Advanced java programmingKaviya452563
 
Java Swing JFC
Java Swing JFCJava Swing JFC
Java Swing JFCSunil OS
 
Why am I getting an out of memory error and no window of my .pdf
Why am I getting an out of memory error and no window of my .pdfWhy am I getting an out of memory error and no window of my .pdf
Why am I getting an out of memory error and no window of my .pdfaakarcreations1
 
011 more swings_adv
011 more swings_adv011 more swings_adv
011 more swings_advChaimaa Kabb
 
Creating a Facebook Clone - Part XVI.pdf
Creating a Facebook Clone - Part XVI.pdfCreating a Facebook Clone - Part XVI.pdf
Creating a Facebook Clone - Part XVI.pdfShaiAlmog1
 
Creating a Facebook Clone - Part VII.pdf
Creating a Facebook Clone - Part VII.pdfCreating a Facebook Clone - Part VII.pdf
Creating a Facebook Clone - Part VII.pdfShaiAlmog1
 
Creating a Facebook Clone - Part XLII - Transcript.pdf
Creating a Facebook Clone - Part XLII - Transcript.pdfCreating a Facebook Clone - Part XLII - Transcript.pdf
Creating a Facebook Clone - Part XLII - Transcript.pdfShaiAlmog1
 
Unit-2 swing and mvc architecture
Unit-2 swing and mvc architectureUnit-2 swing and mvc architecture
Unit-2 swing and mvc architectureAmol Gaikwad
 

Similar to Getting started with GUI programming in Java_2 (20)

Swing basics
Swing basicsSwing basics
Swing basics
 
Getting started with GUI programming in Java_1
Getting started with GUI programming in Java_1Getting started with GUI programming in Java_1
Getting started with GUI programming in Java_1
 
ch20.pptx
ch20.pptxch20.pptx
ch20.pptx
 
Tic Tac Toe game with GUI please dont copy and paste from google. .pdf
Tic Tac Toe game with GUI please dont copy and paste from google. .pdfTic Tac Toe game with GUI please dont copy and paste from google. .pdf
Tic Tac Toe game with GUI please dont copy and paste from google. .pdf
 
Creating a Facebook Clone - Part XLII.pdf
Creating a Facebook Clone - Part XLII.pdfCreating a Facebook Clone - Part XLII.pdf
Creating a Facebook Clone - Part XLII.pdf
 
Tic Tac Toe game with GUI written in java.SolutionAnswerimp.pdf
Tic Tac Toe game with GUI written in java.SolutionAnswerimp.pdfTic Tac Toe game with GUI written in java.SolutionAnswerimp.pdf
Tic Tac Toe game with GUI written in java.SolutionAnswerimp.pdf
 
Creating a Facebook Clone - Part XV - Transcript.pdf
Creating a Facebook Clone - Part XV - Transcript.pdfCreating a Facebook Clone - Part XV - Transcript.pdf
Creating a Facebook Clone - Part XV - Transcript.pdf
 
Creating an Uber Clone - Part IX.pdf
Creating an Uber Clone - Part IX.pdfCreating an Uber Clone - Part IX.pdf
Creating an Uber Clone - Part IX.pdf
 
Swings
SwingsSwings
Swings
 
Oop lecture9 10
Oop lecture9 10Oop lecture9 10
Oop lecture9 10
 
Advanced java programming
Advanced java programmingAdvanced java programming
Advanced java programming
 
11basic Swing
11basic Swing11basic Swing
11basic Swing
 
Java Swing JFC
Java Swing JFCJava Swing JFC
Java Swing JFC
 
Why am I getting an out of memory error and no window of my .pdf
Why am I getting an out of memory error and no window of my .pdfWhy am I getting an out of memory error and no window of my .pdf
Why am I getting an out of memory error and no window of my .pdf
 
011 more swings_adv
011 more swings_adv011 more swings_adv
011 more swings_adv
 
Creating a Facebook Clone - Part XVI.pdf
Creating a Facebook Clone - Part XVI.pdfCreating a Facebook Clone - Part XVI.pdf
Creating a Facebook Clone - Part XVI.pdf
 
Creating a Facebook Clone - Part VII.pdf
Creating a Facebook Clone - Part VII.pdfCreating a Facebook Clone - Part VII.pdf
Creating a Facebook Clone - Part VII.pdf
 
Creating a Facebook Clone - Part XLII - Transcript.pdf
Creating a Facebook Clone - Part XLII - Transcript.pdfCreating a Facebook Clone - Part XLII - Transcript.pdf
Creating a Facebook Clone - Part XLII - Transcript.pdf
 
Basic swing
Basic swingBasic swing
Basic swing
 
Unit-2 swing and mvc architecture
Unit-2 swing and mvc architectureUnit-2 swing and mvc architecture
Unit-2 swing and mvc architecture
 

Recently uploaded

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
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 . pdfQucHHunhnh
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 

Recently uploaded (20)

Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).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
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 

Getting started with GUI programming in Java_2

  • 1. GETTING STARTED WITH GUI PROGRAMMING 2 By .Muhammad Shebl
  • 2. OBJECTIVES 1. Labels & Images 2. Buttons 3. Text Fields & Text Area 4. Combo Boxes 5. Check box 6. Set bounds layout 7. Pack() & setResizable() 8. Menus
  • 3. Labels :  JLabel lab=new JLabel(“MUFIX”);  ImageIcon icon = new ImageIcon("sigin.png"); JLabel lab=new JLabel(icon );
  • 4. BUTTONS :  Adding Event :  JButton jbt = new JButton("OK");  jbt.addActionListener(this );  Add icon image :  ImageIcon icon = new ImageIcon("sigin.png");  JButton jbt = new JButton(icon);
  • 5. BUTTONS : Roll over icon :  ImageIcon icon = new ImageIcon("sigin.png");  JButton jbt = new JButton(icon);  Jbt.setRolloverIcon(icon);
  • 6. BUTTONS: Roll Pressedicon : ImageIcon icon = new ImageIcon("sigin.png"); JButton jbt = new JButton(icon); jbt.setPressedIcon(icon);
  • 7. TEXT AREA  If you want to let the user enter multiple lines of text, you have to create several instances of JTextField. A better alternative is to use JTextArea, which enables the user to enter multiple lines of text.  JTextArea jtaNote = new JTextArea(5, 20);
  • 8. TEXT FIELDS KEY LISTNERS : // Create a text field with text "Type Name Here" JTextField jtfName = new JTextField("Type Name Here"); jtfName .addKeyListener(this);
  • 9. Array of Text Fields  You can create Array of Text fields by:  JTextField[][] txt = new JTextField[x][y];  for (int i = 0; i < x; i++) {  for (int j = 0; j < y; j++) {  txt[i][j] = new JTextField(10);  panel.add(txt[i][j]); txt[i][j].setHorizontalAlignment(JTextField.CENTER);  if (i == j) {  txt[i][j].setText("1");  txt[i][j].setEditable(false);  } txt[i][j].addKeyListener(this);  }}
  • 10. Combo box  To Create Combo box :  JComboBox operations_txt= new JComboBox(new String[]{"<=", "=", ">="}); Operation_txt. getSelectedItem();
  • 11. Check box : // Create a check box with text bold JCheckBox jchkBold = new JCheckBox("Bold");  jchkBold.addActionListener(new ActionListener() {  public void actionPerformed(ActionEvent e) {  if (jchkBold.isSelected()) {  // your Action  }  }  });
  • 13. TASK : FULL CALCULATOR