SlideShare una empresa de Scribd logo
1 de 4
Descargar para leer sin conexión
Core Java

Debasish Pratihari

LayoutManager :


LayoutManager determines the way components
will be arranged inside the container.



All container’s have their default LayoutManger.



However You can apply a different
LayoutManager to the containers if required.



LayoutManager Classes are Provided in
java.awt and javax.swing package.

FlowLayoutManager :


FlowLayout Manager lays down the components
in a row and automatically spills components
onto the next row if row is full.



The default positing of the components is
centered in the container, and the default
orientation is from left to right.



Constants to Control FlowLayoutManager:
o LEFT
o RIGHT
o CENTER
o LEADING
TRAILING



Examples:


FlowLayout f= new FlowLayout();



FlowLayout f= new
FlowLayout(FlowLayout.LEFT);



FlowLayout f= new
FlowLayout(FlowLayout.LEFT,10,20);

Lecture/core/awt4/16

Page #1

feel the Technology…
Core Java

Debasish Pratihari

BorderLayoutManager:


The BorderLayoutManager divides the container
into file regions like
o EAST
o WEST
o NORTH
o SOUTH
o CENTER.



Each region can accommodate only one
component.

Example :
import java.awt.*;
class BorderTest extends Frame{
Button b1,b2,b3,b4,b5;
BorderTest(){
b1= new Button("EAST");
b2= new Button("WEST");
b3= new Button("NORTH");
b4= new Button("SOUTH");
b5=new Button("CENTER");
add(b1, BorderLayout.EAST);
add(b2,BorderLayout.WEST);
add(b3,BorderLayout.NORTH);
add(b4,BorderLayout.SOUTH);
add(b5,BorderLayout.CENTER);
setTitle("BorderDemo By Debasish Pratihari");
setSize(200,200);
setVisible(true);
}
public static void main(String args[]){
new BorderTest();
}
}

Lecture/core/awt4/16

Page #2

feel the Technology…
Core Java

Debasish Pratihari

CardLayout:


The CardLayout manager arrange the
components in a stack, one on the top of
another.



The first component will be at the top, so will be
the only visible component.



Methods to operate CardLayout
o void previous(Container parent)
o void first (Container parent)
o void last(Container parent)
o void show(Container parent)

Example :
import java.awt.*;
import java.awt.event.*;
class CardTest extends Frame implements ActionListener{
Button b1,b2,b3,b4,b5;
CardLayout card;
CardTest(){
b1= new Button("JAVA");
b2= new Button("J2EE");
b3= new Button("C");
b4= new Button("C++");
b5=new Button("ORACLE");
card= new CardLayout(20,50);
setLayout(card);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
add(b1,"card
add(b2,"card
add(b3,"card
add(b4,"card
add(b5,"card

1");
2");
3");
4");
5");

setTitle("BorderDemo By Debasish Pratihari");
setSize(200,200);
setVisible(true);
}
public void actionPerformed(ActionEvent e){
card.next(this);
}
}
public static void main(String args[]){
new CardTest();
}
}
Lecture/core/awt4/16

Page #3

feel the Technology…
Core Java

Debasish Pratihari

GridLayout:
 A GridLayout manager arranges components in
a rectangular grid within a container.
Constructors:


GridLayout()



GridLayout(int rows, int cols)



GridLayout(int
vgaps)

rows,int

cols,

int

hgaps,

int

Example :
import java.awt.*;
25%

Note :

class GridTest extends Frame {
GridTest(){
GridLayout layout= new GridLayout(3,3,10,10);
setLayout(layout);
for(int i=1;i<=9;i++)
add(new Button("Button "+i));

If you want the window
to assume the size that
just accommodates the
component it contains,
use pack()

setTitle("GridDemo By Debasish Pratihari");
setVisible(true);
pack();
}
public static void main(String ar[]){
new GridTest();
}
}

Output :

Lecture/core/awt4/16

Page #4

feel the Technology…

Más contenido relacionado

Destacado

Javaday 2009 php e java
Javaday 2009 php e javaJavaday 2009 php e java
Javaday 2009 php e javaMatteo Baccan
 
Confsl 2010 Facebook Framework
Confsl 2010 Facebook FrameworkConfsl 2010 Facebook Framework
Confsl 2010 Facebook FrameworkMatteo Baccan
 
090613 Ideo
090613 Ideo090613 Ideo
090613 Ideoyuu_2003
 
Bolji svet - Uvodni webinar
Bolji svet  - Uvodni webinarBolji svet  - Uvodni webinar
Bolji svet - Uvodni webinarMaja Vujovic
 
The Mighty Gabby Embodying Resistance in the Creative Process
The Mighty Gabby Embodying Resistance in the Creative Process The Mighty Gabby Embodying Resistance in the Creative Process
The Mighty Gabby Embodying Resistance in the Creative Process Ian Walcott-Skinner
 
技术培训
技术培训技术培训
技术培训yamingd
 
Kim Brown, Joint Head of Learning Development & Diversity at London Boroughs ...
Kim Brown, Joint Head of Learning Development & Diversity at London Boroughs ...Kim Brown, Joint Head of Learning Development & Diversity at London Boroughs ...
Kim Brown, Joint Head of Learning Development & Diversity at London Boroughs ...Paul McElvaney
 
Rob Whiteman - Learning Pool Conference
Rob Whiteman - Learning Pool ConferenceRob Whiteman - Learning Pool Conference
Rob Whiteman - Learning Pool ConferencePaul McElvaney
 
Design Challenge | Pelephone Corporate Website
Design Challenge | Pelephone Corporate WebsiteDesign Challenge | Pelephone Corporate Website
Design Challenge | Pelephone Corporate WebsiteUdi Salant
 
Aag presentatie 3 februari
Aag presentatie 3 februariAag presentatie 3 februari
Aag presentatie 3 februariSjef Kerkhofs
 
Pondres Social Marketing Event preso's
Pondres Social Marketing Event preso'sPondres Social Marketing Event preso's
Pondres Social Marketing Event preso'sSjef Kerkhofs
 
Jammy Create presentation
Jammy Create presentationJammy Create presentation
Jammy Create presentationPaul McElvaney
 
The Public Sector Learning Community
The Public Sector Learning CommunityThe Public Sector Learning Community
The Public Sector Learning CommunityPaul McElvaney
 

Destacado (20)

Lecture 18
Lecture 18Lecture 18
Lecture 18
 
Javaday 2009 php e java
Javaday 2009 php e javaJavaday 2009 php e java
Javaday 2009 php e java
 
Confsl 2010 Facebook Framework
Confsl 2010 Facebook FrameworkConfsl 2010 Facebook Framework
Confsl 2010 Facebook Framework
 
090613 Ideo
090613 Ideo090613 Ideo
090613 Ideo
 
Bolji svet - Uvodni webinar
Bolji svet  - Uvodni webinarBolji svet  - Uvodni webinar
Bolji svet - Uvodni webinar
 
I premios bermejos diplomas
I premios bermejos diplomasI premios bermejos diplomas
I premios bermejos diplomas
 
Routines
RoutinesRoutines
Routines
 
Divosa v1.3
Divosa v1.3Divosa v1.3
Divosa v1.3
 
The Mighty Gabby Embodying Resistance in the Creative Process
The Mighty Gabby Embodying Resistance in the Creative Process The Mighty Gabby Embodying Resistance in the Creative Process
The Mighty Gabby Embodying Resistance in the Creative Process
 
技术培训
技术培训技术培训
技术培训
 
Kim Brown, Joint Head of Learning Development & Diversity at London Boroughs ...
Kim Brown, Joint Head of Learning Development & Diversity at London Boroughs ...Kim Brown, Joint Head of Learning Development & Diversity at London Boroughs ...
Kim Brown, Joint Head of Learning Development & Diversity at London Boroughs ...
 
Jane's walk 2012 evolution of ottawa
Jane's walk 2012   evolution of ottawaJane's walk 2012   evolution of ottawa
Jane's walk 2012 evolution of ottawa
 
Rob Whiteman - Learning Pool Conference
Rob Whiteman - Learning Pool ConferenceRob Whiteman - Learning Pool Conference
Rob Whiteman - Learning Pool Conference
 
Colin Paton
Colin PatonColin Paton
Colin Paton
 
Design Challenge | Pelephone Corporate Website
Design Challenge | Pelephone Corporate WebsiteDesign Challenge | Pelephone Corporate Website
Design Challenge | Pelephone Corporate Website
 
Aag presentatie 3 februari
Aag presentatie 3 februariAag presentatie 3 februari
Aag presentatie 3 februari
 
Pondres Social Marketing Event preso's
Pondres Social Marketing Event preso'sPondres Social Marketing Event preso's
Pondres Social Marketing Event preso's
 
Jammy Create presentation
Jammy Create presentationJammy Create presentation
Jammy Create presentation
 
Lezing TNT
Lezing TNTLezing TNT
Lezing TNT
 
The Public Sector Learning Community
The Public Sector Learning CommunityThe Public Sector Learning Community
The Public Sector Learning Community
 

Similar a Lecture 16

Similar a Lecture 16 (20)

3_ppt_Layout.pptxgßbdbdbdbsbsbsbbsbsbsbsbsb
3_ppt_Layout.pptxgßbdbdbdbsbsbsbbsbsbsbsbsb3_ppt_Layout.pptxgßbdbdbdbsbsbsbbsbsbsbsbsb
3_ppt_Layout.pptxgßbdbdbdbsbsbsbbsbsbsbsbsb
 
Swing
SwingSwing
Swing
 
Swing
SwingSwing
Swing
 
java-layoutmanager-151027135512-lva1-app6892.pdf
java-layoutmanager-151027135512-lva1-app6892.pdfjava-layoutmanager-151027135512-lva1-app6892.pdf
java-layoutmanager-151027135512-lva1-app6892.pdf
 
Java layoutmanager
Java layoutmanagerJava layoutmanager
Java layoutmanager
 
Swing
SwingSwing
Swing
 
Chap1 1.4
Chap1 1.4Chap1 1.4
Chap1 1.4
 
Java Programming for Designers
Java Programming for DesignersJava Programming for Designers
Java Programming for Designers
 
GUI Programming In Java
GUI Programming In JavaGUI Programming In Java
GUI Programming In Java
 
Java card and flow layout
Java card and flow layoutJava card and flow layout
Java card and flow layout
 
java swing
java swingjava swing
java swing
 
Graphical User Interface in JAVA
Graphical User Interface in JAVAGraphical User Interface in JAVA
Graphical User Interface in JAVA
 
Java
JavaJava
Java
 
Chap1 1 4
Chap1 1 4Chap1 1 4
Chap1 1 4
 
Javalayout
JavalayoutJavalayout
Javalayout
 
swingbasics
swingbasicsswingbasics
swingbasics
 
Layout manager
Layout managerLayout manager
Layout manager
 
Problem oriented software engineering01
Problem oriented software engineering01Problem oriented software engineering01
Problem oriented software engineering01
 
Java swing
Java swingJava swing
Java swing
 
Advanced Java programming
Advanced Java programmingAdvanced Java programming
Advanced Java programming
 

Más de Debasish Pratihari (19)

Lecture 24
Lecture 24Lecture 24
Lecture 24
 
Lecture 23
Lecture 23Lecture 23
Lecture 23
 
Lecture 22
Lecture 22Lecture 22
Lecture 22
 
Lecture 21
Lecture 21Lecture 21
Lecture 21
 
Lecture 20
Lecture 20Lecture 20
Lecture 20
 
Lecture 19
Lecture 19Lecture 19
Lecture 19
 
Lecture 17
Lecture 17Lecture 17
Lecture 17
 
Lecture 14
Lecture 14Lecture 14
Lecture 14
 
Lecture 10
Lecture 10Lecture 10
Lecture 10
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Lecture 6
Lecture 6Lecture 6
Lecture 6
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Lecture25
Lecture25Lecture25
Lecture25
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 

Último (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

Lecture 16

  • 1. Core Java Debasish Pratihari LayoutManager :  LayoutManager determines the way components will be arranged inside the container.  All container’s have their default LayoutManger.  However You can apply a different LayoutManager to the containers if required.  LayoutManager Classes are Provided in java.awt and javax.swing package. FlowLayoutManager :  FlowLayout Manager lays down the components in a row and automatically spills components onto the next row if row is full.  The default positing of the components is centered in the container, and the default orientation is from left to right.  Constants to Control FlowLayoutManager: o LEFT o RIGHT o CENTER o LEADING TRAILING  Examples:  FlowLayout f= new FlowLayout();  FlowLayout f= new FlowLayout(FlowLayout.LEFT);  FlowLayout f= new FlowLayout(FlowLayout.LEFT,10,20); Lecture/core/awt4/16 Page #1 feel the Technology…
  • 2. Core Java Debasish Pratihari BorderLayoutManager:  The BorderLayoutManager divides the container into file regions like o EAST o WEST o NORTH o SOUTH o CENTER.  Each region can accommodate only one component. Example : import java.awt.*; class BorderTest extends Frame{ Button b1,b2,b3,b4,b5; BorderTest(){ b1= new Button("EAST"); b2= new Button("WEST"); b3= new Button("NORTH"); b4= new Button("SOUTH"); b5=new Button("CENTER"); add(b1, BorderLayout.EAST); add(b2,BorderLayout.WEST); add(b3,BorderLayout.NORTH); add(b4,BorderLayout.SOUTH); add(b5,BorderLayout.CENTER); setTitle("BorderDemo By Debasish Pratihari"); setSize(200,200); setVisible(true); } public static void main(String args[]){ new BorderTest(); } } Lecture/core/awt4/16 Page #2 feel the Technology…
  • 3. Core Java Debasish Pratihari CardLayout:  The CardLayout manager arrange the components in a stack, one on the top of another.  The first component will be at the top, so will be the only visible component.  Methods to operate CardLayout o void previous(Container parent) o void first (Container parent) o void last(Container parent) o void show(Container parent) Example : import java.awt.*; import java.awt.event.*; class CardTest extends Frame implements ActionListener{ Button b1,b2,b3,b4,b5; CardLayout card; CardTest(){ b1= new Button("JAVA"); b2= new Button("J2EE"); b3= new Button("C"); b4= new Button("C++"); b5=new Button("ORACLE"); card= new CardLayout(20,50); setLayout(card); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); b4.addActionListener(this); b5.addActionListener(this); add(b1,"card add(b2,"card add(b3,"card add(b4,"card add(b5,"card 1"); 2"); 3"); 4"); 5"); setTitle("BorderDemo By Debasish Pratihari"); setSize(200,200); setVisible(true); } public void actionPerformed(ActionEvent e){ card.next(this); } } public static void main(String args[]){ new CardTest(); } } Lecture/core/awt4/16 Page #3 feel the Technology…
  • 4. Core Java Debasish Pratihari GridLayout:  A GridLayout manager arranges components in a rectangular grid within a container. Constructors:  GridLayout()  GridLayout(int rows, int cols)  GridLayout(int vgaps) rows,int cols, int hgaps, int Example : import java.awt.*; 25% Note : class GridTest extends Frame { GridTest(){ GridLayout layout= new GridLayout(3,3,10,10); setLayout(layout); for(int i=1;i<=9;i++) add(new Button("Button "+i)); If you want the window to assume the size that just accommodates the component it contains, use pack() setTitle("GridDemo By Debasish Pratihari"); setVisible(true); pack(); } public static void main(String ar[]){ new GridTest(); } } Output : Lecture/core/awt4/16 Page #4 feel the Technology…