SlideShare a Scribd company logo
1 of 22
Java LayoutManagers:
 The LayoutManagers are used to arrange
components in a particular manner.
 The Java LayoutManagers facilitates us to
control the positioning and size of the
components in GUI forms. LayoutManager is
an interface that is implemented by all the
classes of layout managers.
 There are the following classes that
represent the layout managers:
 java.awt.BorderLayout
 java.awt.FlowLayout
 java.awt.GridLayout
 java.awt.CardLayout
 java.awt.GridBagLayout
 javax.swing.BoxLayout
 javax.swing.GroupLayout
 javax.swing.ScrollPaneLayout
 javax.swing.SpringLayout etc.
java FlowLayout:
 The Java FlowLayout class is used to
arrange the components in a line, one after
another (in a flow). It is the default layout of
the applet or panel.
Fields of FlowLayout class:
 public static final int LEFT
 public static final int RIGHT
 public static final int CENTER
 public static final int LEADING
 public static final int TRAILING
Constructors of FlowLayout class:
 FlowLayout(): creates a flow layout with
centered alignment and a default 5 unit
horizontal and vertical gap.
 FlowLayout(int align): creates a flow layout
with the given alignment and a default 5 unit
horizontal and vertical gap.
 FlowLayout(int align, int hgap, int vgap):
creates a flow layout with the given alignment
and the given horizontal and vertical gap.
Example of FlowLayout class: Using FlowLayout()
constructor
FileName: FlowLayoutExample.java
// import statements
import java.awt.*;
import javax.swing.*;
public class FlowLayoutExample
{
JFrame frameObj;
// constructor
FlowLayoutExample()
{
// creating a frame object
frameObj = new JFrame();
// creating the buttons
JButton b1 = new JButton("1");
JButton b2 = new JButton("2");
JButton b3 = new JButton("3");
JButton b4 = new JButton("4");
JButton b5 = new JButton("5");
JButton b6 = new JButton("6");
JButton b7 = new JButton("7");
JButton b8 = new JButton("8");
JButton b9 = new JButton("9");
JButton b10 = new JButton("10");
// adding the buttons to frame
frameObj.add(b1);
frameObj.add(b2);
frameObj.add(b3);
frameObj.add(b4);
frameObj.add(b5);
frameObj.add(b6);
frameObj.add(b7);
frameObj.add(b8);
frameObj.add(b9);
frameObj.add(b10);
// parameter less constructor is used
// therefore, alignment is center
// horizontal as well as the vertical gap is 5
units
frameObj.setLayout(new FlowLayout());
frameObj.setSize(300, 300);
frameObj.setVisible(true);
}
// main method
public static void main(String argvs[])
{
new FlowLayoutExample();
}
} output:
Example of FlowLayout class: Using FlowLayout(int
align) constructor
FileName: MyFlowLayout.java
import java.awt.*;
import javax.swing.*;
public class MyFlowLayout
{
JFrame f;
MyFlowLayout()
{
f=new JFrame();
JButton b1=new JButton("1")
JButton b2=new JButton("2");
JButton b3=new JButton("3");
JButton b4=new JButton("4");
JButton b5=new JButton("5");
// adding buttons to the frame
f.add(b1);
f.add(b2);
f.add(b3);
f.add(b4);
f.add(b5);
// setting flow layout of right alignment
f.setLayout(new FlowLayout(FlowLayout.RIGHT));
f.setSize(300,300);
f.setVisible(true);
}
public static void main(String[] args)
{
new MyFlowLayout();
}
}
Output:
Example of FlowLayout class: Using FlowLayout(int
align, int hgap, int vgap) constructor
FileName: FlowLayoutExample1.java
// import statement
import java.awt.*;
import javax.swing.*;
public class FlowLayoutExample1
{
JFrame frameObj;
// constructor
FlowLayoutExample1()
{
// creating a frame object
frameObj = new JFrame();
// creating the buttons
JButton b1 = new JButton("1");
JButton b2 = new JButton("2");
JButton b3 = new JButton("3");
JButton b4 = new JButton("4");
JButton b5 = new JButton("5");
JButton b6 = new JButton("6");
JButton b7 = new JButton("7");
JButton b8 = new JButton("8");
JButton b9 = new JButton("9");
JButton b10 = new JButton("10");
// adding the buttons to frame
frameObj.add(b1);
frameObj.add(b2);
frameObj.add(b3);
frameObj.add(b4);
frameObj.add(b5);
frameObj.add(b6);
frameObj.add(b7);
frameObj.add(b8);
frameObj.add(b9);
frameObj.add(b10);
// parameterized constructor is used
// where alignment is left
// horizontal gap is 20 units and vertical gap is 25 units.
frameObj.setLayout(new FlowLayout(FlowLayout.LEFT, 20, 2))
frameObj.setSize(300, 300);
frameObj.setVisible(true);
}
// main method
public static void main(String argvs[])
{
new FlowLayoutExample1();
}
}
Output:
Advanced Java programming

More Related Content

Similar to Advanced Java programming

Similar to Advanced Java programming (20)

09 gui
09 gui09 gui
09 gui
 
09 gui
09 gui09 gui
09 gui
 
Java swing
Java swingJava swing
Java swing
 
GUI Programming In Java
GUI Programming In JavaGUI Programming In Java
GUI Programming In Java
 
Chap1 1 1
Chap1 1 1Chap1 1 1
Chap1 1 1
 
Chap1 1.1
Chap1 1.1Chap1 1.1
Chap1 1.1
 
Md10 building java gu is
Md10 building java gu isMd10 building java gu is
Md10 building java gu is
 
Z blue introduction to gui (39023299)
Z blue   introduction to gui (39023299)Z blue   introduction to gui (39023299)
Z blue introduction to gui (39023299)
 
Swing
SwingSwing
Swing
 
Swing
SwingSwing
Swing
 
Swing
SwingSwing
Swing
 
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
 
Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1
 
swings.pptx
swings.pptxswings.pptx
swings.pptx
 
Chap1 1.4
Chap1 1.4Chap1 1.4
Chap1 1.4
 
SwingApplet.pptx
SwingApplet.pptxSwingApplet.pptx
SwingApplet.pptx
 
Lecture 16
Lecture 16Lecture 16
Lecture 16
 
swingbasics
swingbasicsswingbasics
swingbasics
 
Swingpre 150616004959-lva1-app6892
Swingpre 150616004959-lva1-app6892Swingpre 150616004959-lva1-app6892
Swingpre 150616004959-lva1-app6892
 
Swing and AWT in java
Swing and AWT in javaSwing and AWT in java
Swing and AWT in java
 

More from PriyadharshiniVS

R Ramya devi digital image processing
R  Ramya devi digital image processingR  Ramya devi digital image processing
R Ramya devi digital image processingPriyadharshiniVS
 
R ramya devi cloud computing
R ramya devi cloud computingR ramya devi cloud computing
R ramya devi cloud computingPriyadharshiniVS
 
Ramya devi R women empowerment
Ramya devi R women empowermentRamya devi R women empowerment
Ramya devi R women empowermentPriyadharshiniVS
 
R Ramya devi artificial intelligence and machine learning
R Ramya devi  artificial intelligence and machine learningR Ramya devi  artificial intelligence and machine learning
R Ramya devi artificial intelligence and machine learningPriyadharshiniVS
 
Ramya devi R internet of things
Ramya devi R internet of thingsRamya devi R internet of things
Ramya devi R internet of thingsPriyadharshiniVS
 
MOBILE APP DEVELOPMENT USING PYTHON
MOBILE APP DEVELOPMENT USING PYTHONMOBILE APP DEVELOPMENT USING PYTHON
MOBILE APP DEVELOPMENT USING PYTHONPriyadharshiniVS
 
PriyaDharshini distributed operating system
PriyaDharshini distributed operating systemPriyaDharshini distributed operating system
PriyaDharshini distributed operating systemPriyadharshiniVS
 
Vanmathy distributed operating system
Vanmathy distributed operating system Vanmathy distributed operating system
Vanmathy distributed operating system PriyadharshiniVS
 
vanmathy cryptography network security
vanmathy cryptography network securityvanmathy cryptography network security
vanmathy cryptography network securityPriyadharshiniVS
 
vanmathy cryptography network security
vanmathy cryptography network security vanmathy cryptography network security
vanmathy cryptography network security PriyadharshiniVS
 
Vanmathy distributed operating system
Vanmathy distributed operating system Vanmathy distributed operating system
Vanmathy distributed operating system PriyadharshiniVS
 
Cryptography and network security
Cryptography and network securityCryptography and network security
Cryptography and network securityPriyadharshiniVS
 
Graph, graph and network modeling, advantage of graph database
Graph, graph and network modeling, advantage of graph databaseGraph, graph and network modeling, advantage of graph database
Graph, graph and network modeling, advantage of graph databasePriyadharshiniVS
 

More from PriyadharshiniVS (20)

R Ramya devi digital image processing
R  Ramya devi digital image processingR  Ramya devi digital image processing
R Ramya devi digital image processing
 
R ramya devi cloud computing
R ramya devi cloud computingR ramya devi cloud computing
R ramya devi cloud computing
 
Ramya devi R women empowerment
Ramya devi R women empowermentRamya devi R women empowerment
Ramya devi R women empowerment
 
R Ramya devi artificial intelligence and machine learning
R Ramya devi  artificial intelligence and machine learningR Ramya devi  artificial intelligence and machine learning
R Ramya devi artificial intelligence and machine learning
 
Ramya devi R internet of things
Ramya devi R internet of thingsRamya devi R internet of things
Ramya devi R internet of things
 
vs.pptx
vs.pptxvs.pptx
vs.pptx
 
WE.pptx
WE.pptxWE.pptx
WE.pptx
 
IOT.pptx
IOT.pptxIOT.pptx
IOT.pptx
 
cc.pptx
cc.pptxcc.pptx
cc.pptx
 
MOBILE APP DEVELOPMENT USING PYTHON
MOBILE APP DEVELOPMENT USING PYTHONMOBILE APP DEVELOPMENT USING PYTHON
MOBILE APP DEVELOPMENT USING PYTHON
 
Vanmathy python
Vanmathy python Vanmathy python
Vanmathy python
 
PriyaDharshini distributed operating system
PriyaDharshini distributed operating systemPriyaDharshini distributed operating system
PriyaDharshini distributed operating system
 
Vanmathy distributed operating system
Vanmathy distributed operating system Vanmathy distributed operating system
Vanmathy distributed operating system
 
vanmathy cryptography network security
vanmathy cryptography network securityvanmathy cryptography network security
vanmathy cryptography network security
 
vanmathy cryptography network security
vanmathy cryptography network security vanmathy cryptography network security
vanmathy cryptography network security
 
Vanmathy distributed operating system
Vanmathy distributed operating system Vanmathy distributed operating system
Vanmathy distributed operating system
 
Vanmathy no sql
Vanmathy no sql Vanmathy no sql
Vanmathy no sql
 
Cryptography and network security
Cryptography and network securityCryptography and network security
Cryptography and network security
 
No sql
No sql No sql
No sql
 
Graph, graph and network modeling, advantage of graph database
Graph, graph and network modeling, advantage of graph databaseGraph, graph and network modeling, advantage of graph database
Graph, graph and network modeling, advantage of graph database
 

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
 
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
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
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
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
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
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
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
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
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
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
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
 

Recently uploaded (20)

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
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
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
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
 
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
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
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
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
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
 
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
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
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...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
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
 

Advanced Java programming

  • 1.
  • 2.
  • 3. Java LayoutManagers:  The LayoutManagers are used to arrange components in a particular manner.  The Java LayoutManagers facilitates us to control the positioning and size of the components in GUI forms. LayoutManager is an interface that is implemented by all the classes of layout managers.  There are the following classes that represent the layout managers:
  • 4.  java.awt.BorderLayout  java.awt.FlowLayout  java.awt.GridLayout  java.awt.CardLayout  java.awt.GridBagLayout  javax.swing.BoxLayout  javax.swing.GroupLayout  javax.swing.ScrollPaneLayout  javax.swing.SpringLayout etc.
  • 5. java FlowLayout:  The Java FlowLayout class is used to arrange the components in a line, one after another (in a flow). It is the default layout of the applet or panel.
  • 6. Fields of FlowLayout class:  public static final int LEFT  public static final int RIGHT  public static final int CENTER  public static final int LEADING  public static final int TRAILING
  • 7. Constructors of FlowLayout class:  FlowLayout(): creates a flow layout with centered alignment and a default 5 unit horizontal and vertical gap.  FlowLayout(int align): creates a flow layout with the given alignment and a default 5 unit horizontal and vertical gap.  FlowLayout(int align, int hgap, int vgap): creates a flow layout with the given alignment and the given horizontal and vertical gap.
  • 8. Example of FlowLayout class: Using FlowLayout() constructor FileName: FlowLayoutExample.java // import statements import java.awt.*; import javax.swing.*; public class FlowLayoutExample { JFrame frameObj; // constructor FlowLayoutExample() {
  • 9. // creating a frame object frameObj = new JFrame(); // creating the buttons JButton b1 = new JButton("1"); JButton b2 = new JButton("2"); JButton b3 = new JButton("3"); JButton b4 = new JButton("4"); JButton b5 = new JButton("5"); JButton b6 = new JButton("6"); JButton b7 = new JButton("7"); JButton b8 = new JButton("8"); JButton b9 = new JButton("9"); JButton b10 = new JButton("10");
  • 10. // adding the buttons to frame frameObj.add(b1); frameObj.add(b2); frameObj.add(b3); frameObj.add(b4); frameObj.add(b5); frameObj.add(b6); frameObj.add(b7); frameObj.add(b8); frameObj.add(b9); frameObj.add(b10); // parameter less constructor is used
  • 11. // therefore, alignment is center // horizontal as well as the vertical gap is 5 units frameObj.setLayout(new FlowLayout()); frameObj.setSize(300, 300); frameObj.setVisible(true); } // main method public static void main(String argvs[])
  • 13. Example of FlowLayout class: Using FlowLayout(int align) constructor FileName: MyFlowLayout.java import java.awt.*; import javax.swing.*; public class MyFlowLayout { JFrame f; MyFlowLayout() { f=new JFrame();
  • 14. JButton b1=new JButton("1") JButton b2=new JButton("2"); JButton b3=new JButton("3"); JButton b4=new JButton("4"); JButton b5=new JButton("5"); // adding buttons to the frame f.add(b1); f.add(b2); f.add(b3); f.add(b4); f.add(b5); // setting flow layout of right alignment f.setLayout(new FlowLayout(FlowLayout.RIGHT));
  • 15. f.setSize(300,300); f.setVisible(true); } public static void main(String[] args) { new MyFlowLayout(); } }
  • 17. Example of FlowLayout class: Using FlowLayout(int align, int hgap, int vgap) constructor FileName: FlowLayoutExample1.java // import statement import java.awt.*; import javax.swing.*; public class FlowLayoutExample1 { JFrame frameObj; // constructor FlowLayoutExample1()
  • 18. { // creating a frame object frameObj = new JFrame(); // creating the buttons JButton b1 = new JButton("1"); JButton b2 = new JButton("2"); JButton b3 = new JButton("3"); JButton b4 = new JButton("4"); JButton b5 = new JButton("5"); JButton b6 = new JButton("6"); JButton b7 = new JButton("7"); JButton b8 = new JButton("8"); JButton b9 = new JButton("9"); JButton b10 = new JButton("10");
  • 19. // adding the buttons to frame frameObj.add(b1); frameObj.add(b2); frameObj.add(b3); frameObj.add(b4); frameObj.add(b5); frameObj.add(b6); frameObj.add(b7); frameObj.add(b8); frameObj.add(b9); frameObj.add(b10);
  • 20. // parameterized constructor is used // where alignment is left // horizontal gap is 20 units and vertical gap is 25 units. frameObj.setLayout(new FlowLayout(FlowLayout.LEFT, 20, 2)) frameObj.setSize(300, 300); frameObj.setVisible(true); } // main method public static void main(String argvs[]) { new FlowLayoutExample1(); } }