SlideShare a Scribd company logo
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 (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
Mahmoud 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 31
Mahmoud 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 88
Mahmoud 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 88
Mahmoud 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 210
Mahmoud 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 88
Mahmoud 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 212
Mahmoud 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 202
Mahmoud 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 210
Mahmoud 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 181
Mahmoud 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 184
Mahmoud 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 202
Mahmoud 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 88
Mahmoud Samir Fayed
 
Qtp best tutorial
Qtp best tutorialQtp best tutorial
Qtp best tutorial
Ramu Palanki
 
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
Mahmoud 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 30
Mahmoud 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 84
Mahmoud Samir Fayed
 
Punto fijo multivariante
Punto fijo multivariantePunto fijo multivariante
Punto fijo multivariante
Remigio Pérez Palomino
 
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
Mahmoud 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 212
Mahmoud Samir Fayed
 
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
Mahmoud 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 31
Mahmoud 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 88
Mahmoud 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 88
Mahmoud 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 210
Mahmoud 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 88
Mahmoud 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 212
Mahmoud 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 202
Mahmoud 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 210
Mahmoud 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 181
Mahmoud 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 184
Mahmoud 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 202
Mahmoud 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 88
Mahmoud 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 84
Mahmoud 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 30
Mahmoud 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 84
Mahmoud 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 212
Mahmoud 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 212
Mahmoud Samir Fayed
 

Viewers also liked (14)

Assedio moral nas escolas - SEPE
Assedio moral  nas escolas - SEPEAssedio moral  nas escolas - SEPE
Assedio moral nas escolas - SEPE
Adriana De Moraes
 
NYC Venues
NYC VenuesNYC Venues
NYC Venues
lkittredge
 
Lms final ppt
Lms final pptLms final ppt
Lms final ppt
Invictus Consulting (P) Limited
 
Leave management system
Leave management systemLeave management system
Leave management system
Ayushi Gaur
 
Leave management System
Leave management SystemLeave management System
Leave management System
Greytip Software
 
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
Smart Schooling
 
Leave Management System Documentation
Leave Management System DocumentationLeave Management System Documentation
Leave Management System Documentation
muzammil 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 Presentation
Ibrahim Abdel Fattah Mohamed
 
Employee Management System
Employee Management SystemEmployee Management System
Employee Management System
Anjali Agrawal
 
Leave management System
Leave management SystemLeave management System
Leave management System
pratikmahorey
 
Inventory management
Inventory managementInventory management
Inventory management
Kuldeep Uttam
 
Leave management system chp 1 4
Leave management system chp 1 4Leave management system chp 1 4
Leave management system chp 1 4
Einstein 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/MBA
AJ Raina
 
Assedio moral nas escolas - SEPE
Assedio moral  nas escolas - SEPEAssedio moral  nas escolas - SEPE
Assedio moral nas escolas - SEPE
Adriana De Moraes
 
Leave management system
Leave management systemLeave management system
Leave management system
Ayushi 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 India
Smart Schooling
 
Leave Management System Documentation
Leave Management System DocumentationLeave Management System Documentation
Leave Management System Documentation
muzammil 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 Presentation
Ibrahim Abdel Fattah Mohamed
 
Employee Management System
Employee Management SystemEmployee Management System
Employee Management System
Anjali Agrawal
 
Leave management System
Leave management SystemLeave management System
Leave management System
pratikmahorey
 
Inventory management
Inventory managementInventory management
Inventory management
Kuldeep Uttam
 
Leave management system chp 1 4
Leave management system chp 1 4Leave management system chp 1 4
Leave management system chp 1 4
Einstein 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/MBA
AJ Raina
 
Ad

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

ch20.pptx
ch20.pptxch20.pptx
ch20.pptx
EnriqueMartinezTelle2
 
Chapter 5 GUI for introduction of java and gui .ppt
Chapter 5 GUI  for  introduction of java and gui .pptChapter 5 GUI  for  introduction of java and gui .ppt
Chapter 5 GUI for introduction of java and gui .ppt
HabibMuhammed2
 
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
Muhammad Shebl Farag
 
Swing basics
Swing basicsSwing basics
Swing basics
Medi-Caps University
 
Awt
AwtAwt
Awt
Rakesh Patil
 
swing_compo.pptxsfdsfffdfdfdfdgwrwrwwtry
swing_compo.pptxsfdsfffdfdfdfdgwrwrwwtryswing_compo.pptxsfdsfffdfdfdfdgwrwrwwtry
swing_compo.pptxsfdsfffdfdfdfdgwrwrwwtry
zmulani8
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
nidhileena
 
1 How do you create a frame (AWT or swing)How do you set th
1 How do you create a frame (AWT or swing)How do you set th1 How do you create a frame (AWT or swing)How do you set th
1 How do you create a frame (AWT or swing)How do you set th
hirstcruz
 
Gui programming a review - mixed content
Gui programming   a review - mixed contentGui programming   a review - mixed content
Gui programming a review - mixed content
Yogesh Kumar
 
GUI programming
GUI programmingGUI programming
GUI programming
Vineeta Garg
 
Labels and buttons
Labels and buttonsLabels and buttons
Labels and buttons
myrajendra
 
it's about the swing programs in java language
it's about the swing programs in  java languageit's about the swing programs in  java language
it's about the swing programs in java language
arunkumarg271
 
Chap 1 - Introduction GUI.pptx
Chap 1 - Introduction GUI.pptxChap 1 - Introduction GUI.pptx
Chap 1 - Introduction GUI.pptx
TadeseBeyene
 
GUI Programming using NetBeans.pptx
GUI Programming using NetBeans.pptxGUI Programming using NetBeans.pptx
GUI Programming using NetBeans.pptx
Sumalee Sonamthiang
 
GUI Programming using NetBeans (1).pptx
GUI Programming using NetBeans (1).pptxGUI Programming using NetBeans (1).pptx
GUI Programming using NetBeans (1).pptx
Sumalee Sonamthiang
 
Unit-2 swing and mvc architecture
Unit-2 swing and mvc architectureUnit-2 swing and mvc architecture
Unit-2 swing and mvc architecture
Amol Gaikwad
 
03_GUI.ppt
03_GUI.ppt03_GUI.ppt
03_GUI.ppt
DrDGayathriDevi
 
Introduction to java netbeans
Introduction to java netbeansIntroduction to java netbeans
Introduction to java netbeans
Shrey Goswami
 
Advanced java programming
Advanced java programmingAdvanced java programming
Advanced java programming
Kaviya452563
 
Jp notes
Jp notesJp notes
Jp notes
Sreedhar Chowdam
 
Chapter 5 GUI for introduction of java and gui .ppt
Chapter 5 GUI  for  introduction of java and gui .pptChapter 5 GUI  for  introduction of java and gui .ppt
Chapter 5 GUI for introduction of java and gui .ppt
HabibMuhammed2
 
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
Muhammad Shebl Farag
 
swing_compo.pptxsfdsfffdfdfdfdgwrwrwwtry
swing_compo.pptxsfdsfffdfdfdfdgwrwrwwtryswing_compo.pptxsfdsfffdfdfdfdgwrwrwwtry
swing_compo.pptxsfdsfffdfdfdfdgwrwrwwtry
zmulani8
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
nidhileena
 
1 How do you create a frame (AWT or swing)How do you set th
1 How do you create a frame (AWT or swing)How do you set th1 How do you create a frame (AWT or swing)How do you set th
1 How do you create a frame (AWT or swing)How do you set th
hirstcruz
 
Gui programming a review - mixed content
Gui programming   a review - mixed contentGui programming   a review - mixed content
Gui programming a review - mixed content
Yogesh Kumar
 
Labels and buttons
Labels and buttonsLabels and buttons
Labels and buttons
myrajendra
 
it's about the swing programs in java language
it's about the swing programs in  java languageit's about the swing programs in  java language
it's about the swing programs in java language
arunkumarg271
 
Chap 1 - Introduction GUI.pptx
Chap 1 - Introduction GUI.pptxChap 1 - Introduction GUI.pptx
Chap 1 - Introduction GUI.pptx
TadeseBeyene
 
GUI Programming using NetBeans.pptx
GUI Programming using NetBeans.pptxGUI Programming using NetBeans.pptx
GUI Programming using NetBeans.pptx
Sumalee Sonamthiang
 
GUI Programming using NetBeans (1).pptx
GUI Programming using NetBeans (1).pptxGUI Programming using NetBeans (1).pptx
GUI Programming using NetBeans (1).pptx
Sumalee Sonamthiang
 
Unit-2 swing and mvc architecture
Unit-2 swing and mvc architectureUnit-2 swing and mvc architecture
Unit-2 swing and mvc architecture
Amol Gaikwad
 
Introduction to java netbeans
Introduction to java netbeansIntroduction to java netbeans
Introduction to java netbeans
Shrey Goswami
 
Advanced java programming
Advanced java programmingAdvanced java programming
Advanced java programming
Kaviya452563
 
Ad

Recently uploaded (20)

Sustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive LearningSustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive Learning
Leonel Morgado
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptxUnit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
Exploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle SchoolExploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle School
Marie
 
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptxROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
Belicia R.S
 
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
Quiz Club of PSG College of Arts & Science
 
Vikas Bansal Himachal Pradesh: A Visionary Transforming Himachal’s Educationa...
Vikas Bansal Himachal Pradesh: A Visionary Transforming Himachal’s Educationa...Vikas Bansal Himachal Pradesh: A Visionary Transforming Himachal’s Educationa...
Vikas Bansal Himachal Pradesh: A Visionary Transforming Himachal’s Educationa...
Himalayan Group of Professional Institutions (HGPI)
 
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdfFEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
ChristinaFortunova
 
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptxPEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
Arshad Shaikh
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdfThe Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
How to Manage Multi Language for Invoice in Odoo 18
How to Manage Multi Language for Invoice in Odoo 18How to Manage Multi Language for Invoice in Odoo 18
How to Manage Multi Language for Invoice in Odoo 18
Celine George
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil DisobediencePaper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition IILDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti MpdBasic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
GEOGRAPHY-Study Material [ Class 10th] .pdf
GEOGRAPHY-Study Material [ Class 10th] .pdfGEOGRAPHY-Study Material [ Class 10th] .pdf
GEOGRAPHY-Study Material [ Class 10th] .pdf
SHERAZ AHMAD LONE
 
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptxRai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Dr. Ravi Shankar Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
How to Create an Event in Odoo 18 - Odoo 18 Slides
How to Create an Event in Odoo 18 - Odoo 18 SlidesHow to Create an Event in Odoo 18 - Odoo 18 Slides
How to Create an Event in Odoo 18 - Odoo 18 Slides
Celine George
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptxWhat is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptxjune 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
Nice Dream.pdf /
Nice Dream.pdf                              /Nice Dream.pdf                              /
Nice Dream.pdf /
ErinUsher3
 
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big CycleRay Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
 
Sustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive LearningSustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive Learning
Leonel Morgado
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptxUnit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
Exploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle SchoolExploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle School
Marie
 
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptxROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
Belicia R.S
 
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdfFEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
ChristinaFortunova
 
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptxPEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
Arshad Shaikh
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdfThe Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
How to Manage Multi Language for Invoice in Odoo 18
How to Manage Multi Language for Invoice in Odoo 18How to Manage Multi Language for Invoice in Odoo 18
How to Manage Multi Language for Invoice in Odoo 18
Celine George
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil DisobediencePaper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition IILDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti MpdBasic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
GEOGRAPHY-Study Material [ Class 10th] .pdf
GEOGRAPHY-Study Material [ Class 10th] .pdfGEOGRAPHY-Study Material [ Class 10th] .pdf
GEOGRAPHY-Study Material [ Class 10th] .pdf
SHERAZ AHMAD LONE
 
How to Create an Event in Odoo 18 - Odoo 18 Slides
How to Create an Event in Odoo 18 - Odoo 18 SlidesHow to Create an Event in Odoo 18 - Odoo 18 Slides
How to Create an Event in Odoo 18 - Odoo 18 Slides
Celine George
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptxWhat is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptxjune 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
Nice Dream.pdf /
Nice Dream.pdf                              /Nice Dream.pdf                              /
Nice Dream.pdf /
ErinUsher3
 
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big CycleRay Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
 

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