SlideShare une entreprise Scribd logo
1  sur  18
Quiz Application using Swings
BY
SANA MATEEN
Containers
• A container holds a group of components.
• Thus, a container is a special type of component that is designed to hold other
components.
• Furthermore, in order for a component to be displayed, it must be held within
a container.
• Thus, all Swing GUIs will have at least one container.
• Because containers are components, a container can also hold other
containers.
• This enables Swing to define what is called a containment hierarchy, at the top
of which must be a top-level container.
• Swing defines two types of containers.
• The first are top-level containers: JFrame, JApplet, JWindow, and JDialog.
These containers do not inherit JComponent. They do, however, inherit the
AWT classes Component and Container. Unlike Swing’s other components,
which are lightweight, the top-level containers are heavyweight. This makes
the top-level containers a special case in the Swing component library.
Java JFrame
• The javax.swing.JFrame class is a type of container which inherits the
java.awt.Frame class. JFrame works like the main window where
components like labels, buttons, textfields are added to create a GUI.
• Unlike Frame, JFrame has the option to hide or close the window with the
help of setDefaultCloseOperation(int) method.
Constructor Description
JFrame() It constructs a new frame that is initially
invisible.
JFrame(GraphicsConfiguration gc) It creates a Frame in the specified
GraphicsConfiguration of a screen device and
a blank title.
JFrame(String title) It creates a new, initially invisible Frame
with the specified title.
JFrame(String title,
GraphicsConfiguration gc)
It creates a JFrame with the specified title
and the specified GraphicsConfiguration of a
screen device.
JLabel
• The class JLabel can display either text, an image, or both. Label's
contents are aligned by setting the vertical and horizontal alignment in its
display area. By default, labels are vertically centered in their display area.
Text-only labels are leading edge aligned, by default; image-only labels are
horizontally centered, by default.
• Following is the declaration for javax.swing.JLabel class −
• public class JLabel extends JComponent implements SwingConstants,
Accessible
Constructor Description
JLabel() Creates a JLabel instance with no image and
with an empty string for the title.
JLabel(String s) Creates a JLabel instance with the specified
text.
JLabel(Icon i) Creates a JLabel instance with the specified
image.
JLabel(String s, Icon i, int
horizontalAlignment)
Creates a JLabel instance with the specified
text, image, and horizontal alignment.
Constructor & Description
1
JLabel()
Creates a JLabel instance with no image and with an empty
string for the title.
2
JLabel(Icon image)
Creates a JLabel instance with the specified image.
3
JLabel(Icon image, int horizontalAlignment)
Creates a JLabel instance with the specified image and
horizontal alignment.
4
JLabel(String text)
Creates a JLabel instance with the specified text.
5
JLabel(String text, Icon icon, int horizontalAlignment)
Creates a JLabel instance with the specified text, image, and
horizontal alignment.
6
JLabel(String text, int horizontalAlignment)
Creates a JLabel instance with the specified text and horizontal
alignment.
Java JPanel
• The JPanel is a simplest container class. It provides space in which an
application can attach any other component. It inherits the JComponents
class.
• It doesn't have title bar.
• JPanel class declaration
• public class JPanel extends JComponent implements Accessible
Constructor Description
JPanel() It is used to create a new JPanel
with a double buffer and a flow
layout.
JPanel(boolean
isDoubleBuffered)
It is used to create a new JPanel
with FlowLayout and the specified
buffering strategy.
JPanel(LayoutManager
layout)
It is used to create a new JPanel
with the specified layout manager.
JRadioButton
• The JRadioButton class is used to create a radio button. It is used to choose one
option from multiple options. It is widely used in exam systems or quiz.
• It should be added in ButtonGroup to select one radio button only.
• JRadioButton class declaration
• Let's see the declaration for javax.swing.JRadioButton class.
• public class JRadioButton extends JToggleButton implements Accessible
Constructor Description
JRadioButton() Creates an unselected radio
button with no text.
JRadioButton(String s) Creates an unselected radio
button with specified text.
JRadioButton(String s, boolean
selected)
Creates a radio button with the
specified text and selected
status.
Elements are then added to the button group via the following
method:
void add(AbstractButton ab)
Here, ab is a reference to the button to be added to the group.
A JRadioButton generates action events, item events, and change
events each time the button selection changes.
Most often, it is the action event that is handled, which means that
you will normally implement the ActionListener interface.
Java JButton
• The JButton class is used to create a labeled button that has platform
independent implementation.
• The application result in some action when the button is pushed. It
inherits AbstractButton class.
• JButton class declaration
• void setIcon(Icon b)It is used to set the specified Icon on the button.
• public class JButton extends AbstractButton implements Accessible
Constructor Description
JButton() It creates a button with no text and icon.
JButton(String s) It creates a button with the specified text.
JButton(Icon i) It creates a button with the specified icon
object.
Java JTabbedPane
• The JTabbedPane class is used to switch between a group of components
by clicking on a tab with a given title or icon. It inherits JComponent class.
• JTabbedPane class declaration
• Let's see the declaration for javax.swing.JTabbedPane class.
• public class JTabbedPane extends JComponent implements Serializable, A
ccessible, SwingConstants
Constructor Description
JTabbedPane() Creates an empty TabbedPane
with a default tab placement of
JTabbedPane.Top.
JTabbedPane(int tabPlacement) Creates an empty TabbedPane
with a specified tab placement.
JTabbedPane(int tabPlacement,
int tabLayoutPolicy)
Creates an empty TabbedPane
with a specified tab placement
and tab layout policy.
Java JDialog
• The JDialog control represents a top level window with a border and a title
used to take some form of input from the user. It inherits the Dialog class.
• Unlike JFrame, it doesn't have maximize and minimize buttons.
• JDialog class declaration
• Let's see the declaration for javax.swing.JDialog class.
• public class JDialog extends Dialog implements WindowConstants, Accessible,
RootPaneContainer
Constructor Description
JDialog() It is used to create a modeless
dialog without a title and without
a specified Frame owner.
JDialog(Frame owner) It is used to create a modeless
dialog with specified Frame as its
owner and an empty title.
JDialog(Frame owner, String title,
boolean modal)
It is used to create a dialog with
the specified title, owner Frame
and modality.
Quiz app(j tabbed pane,jdialog,container,actionevent,jradiobutton,buttongroup,jpanel)
Quiz app(j tabbed pane,jdialog,container,actionevent,jradiobutton,buttongroup,jpanel)
Quiz app(j tabbed pane,jdialog,container,actionevent,jradiobutton,buttongroup,jpanel)
Quiz app(j tabbed pane,jdialog,container,actionevent,jradiobutton,buttongroup,jpanel)
Quiz app(j tabbed pane,jdialog,container,actionevent,jradiobutton,buttongroup,jpanel)
Quiz app(j tabbed pane,jdialog,container,actionevent,jradiobutton,buttongroup,jpanel)
Quiz app(j tabbed pane,jdialog,container,actionevent,jradiobutton,buttongroup,jpanel)

Contenu connexe

Tendances

Swing and Graphical User Interface in Java
Swing and Graphical User Interface in JavaSwing and Graphical User Interface in Java
Swing and Graphical User Interface in Javababak danyal
 
Graphical User Interface (Gui)
Graphical User Interface (Gui)Graphical User Interface (Gui)
Graphical User Interface (Gui)Bilal Amjad
 
Z blue introduction to gui (39023299)
Z blue   introduction to gui (39023299)Z blue   introduction to gui (39023299)
Z blue introduction to gui (39023299)Narayana Swamy
 
Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1PRN USM
 
Complete java swing
Complete java swingComplete java swing
Complete java swingjehan1987
 
Ajp notes-chapter-02
Ajp notes-chapter-02Ajp notes-chapter-02
Ajp notes-chapter-02Ankit Dubey
 
PDF ON JAVA - JFC CONCEPT
PDF ON JAVA - JFC CONCEPTPDF ON JAVA - JFC CONCEPT
PDF ON JAVA - JFC CONCEPTNAVYA RAO
 
GUI Programming in JAVA (Using Netbeans) - A Review
GUI Programming in JAVA (Using Netbeans) -  A ReviewGUI Programming in JAVA (Using Netbeans) -  A Review
GUI Programming in JAVA (Using Netbeans) - A ReviewFernando Torres
 
Java awt tutorial javatpoint
Java awt tutorial   javatpointJava awt tutorial   javatpoint
Java awt tutorial javatpointRicardo Garcia
 
GUI Programming In Java
GUI Programming In JavaGUI Programming In Java
GUI Programming In Javayht4ever
 
Java Beans Unit 4(part 2)
Java Beans Unit 4(part 2)Java Beans Unit 4(part 2)
Java Beans Unit 4(part 2)SURBHI SAROHA
 
Console to GUI
Console to GUIConsole to GUI
Console to GUIChloe Choi
 

Tendances (20)

Swing and Graphical User Interface in Java
Swing and Graphical User Interface in JavaSwing and Graphical User Interface in Java
Swing and Graphical User Interface in Java
 
Graphical User Interface (Gui)
Graphical User Interface (Gui)Graphical User Interface (Gui)
Graphical User Interface (Gui)
 
Z blue introduction to gui (39023299)
Z blue   introduction to gui (39023299)Z blue   introduction to gui (39023299)
Z blue introduction to gui (39023299)
 
Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1
 
Complete java swing
Complete java swingComplete java swing
Complete java swing
 
Java swing
Java swingJava swing
Java swing
 
Ajp notes-chapter-02
Ajp notes-chapter-02Ajp notes-chapter-02
Ajp notes-chapter-02
 
PDF ON JAVA - JFC CONCEPT
PDF ON JAVA - JFC CONCEPTPDF ON JAVA - JFC CONCEPT
PDF ON JAVA - JFC CONCEPT
 
GUI Programming in JAVA (Using Netbeans) - A Review
GUI Programming in JAVA (Using Netbeans) -  A ReviewGUI Programming in JAVA (Using Netbeans) -  A Review
GUI Programming in JAVA (Using Netbeans) - A Review
 
Java awt
Java awtJava awt
Java awt
 
Gui
GuiGui
Gui
 
Swing
SwingSwing
Swing
 
Java awt tutorial javatpoint
Java awt tutorial   javatpointJava awt tutorial   javatpoint
Java awt tutorial javatpoint
 
Awt and swing in java
Awt and swing in javaAwt and swing in java
Awt and swing in java
 
tL19 awt
tL19 awttL19 awt
tL19 awt
 
Graphic Programming
Graphic ProgrammingGraphic Programming
Graphic Programming
 
GUI Programming In Java
GUI Programming In JavaGUI Programming In Java
GUI Programming In Java
 
Java Beans Unit 4(part 2)
Java Beans Unit 4(part 2)Java Beans Unit 4(part 2)
Java Beans Unit 4(part 2)
 
GUI components in Java
GUI components in JavaGUI components in Java
GUI components in Java
 
Console to GUI
Console to GUIConsole to GUI
Console to GUI
 

En vedette

Jsp elements
Jsp elementsJsp elements
Jsp elementsNuha Noor
 
Reading init param
Reading init paramReading init param
Reading init paramNuha Noor
 
Http request and http response
Http request and http responseHttp request and http response
Http request and http responseNuha Noor
 
Jdbc in servlets
Jdbc in servletsJdbc in servlets
Jdbc in servletsNuha Noor
 
Understanding layout managers
Understanding layout managersUnderstanding layout managers
Understanding layout managersNuha Noor
 
Using cookies and sessions
Using cookies and sessionsUsing cookies and sessions
Using cookies and sessionsNuha Noor
 

En vedette (13)

Jsp elements
Jsp elementsJsp elements
Jsp elements
 
Reading init param
Reading init paramReading init param
Reading init param
 
Http request and http response
Http request and http responseHttp request and http response
Http request and http response
 
Xml schema
Xml schemaXml schema
Xml schema
 
Dom parser
Dom parserDom parser
Dom parser
 
Xml dtd
Xml dtdXml dtd
Xml dtd
 
Xml dom
Xml domXml dom
Xml dom
 
Jdbc in servlets
Jdbc in servletsJdbc in servlets
Jdbc in servlets
 
Understanding layout managers
Understanding layout managersUnderstanding layout managers
Understanding layout managers
 
Using cookies and sessions
Using cookies and sessionsUsing cookies and sessions
Using cookies and sessions
 
Xhtml
XhtmlXhtml
Xhtml
 
Intro xml
Intro xmlIntro xml
Intro xml
 
Events1
Events1Events1
Events1
 

Similaire à Quiz app(j tabbed pane,jdialog,container,actionevent,jradiobutton,buttongroup,jpanel)

DSJ_Unit III.pdf
DSJ_Unit III.pdfDSJ_Unit III.pdf
DSJ_Unit III.pdfArumugam90
 
Advanced java programming
Advanced java programmingAdvanced java programming
Advanced java programmingKaviya452563
 
Unit-2 swing and mvc architecture
Unit-2 swing and mvc architectureUnit-2 swing and mvc architecture
Unit-2 swing and mvc architectureAmol Gaikwad
 
JAVA Jcheckbox in simple and easy .pptx
JAVA Jcheckbox in simple and  easy .pptxJAVA Jcheckbox in simple and  easy .pptx
JAVA Jcheckbox in simple and easy .pptxPrajwalGowda320238
 
SWING USING JAVA WITH VARIOUS COMPONENTS
SWING USING  JAVA WITH VARIOUS COMPONENTSSWING USING  JAVA WITH VARIOUS COMPONENTS
SWING USING JAVA WITH VARIOUS COMPONENTSbharathiv53
 
Programming Java GUI using SWING, Event Handling
Programming Java GUI using SWING, Event HandlingProgramming Java GUI using SWING, Event Handling
Programming Java GUI using SWING, Event HandlingJadavsejal
 
Chap 1 - Introduction GUI.pptx
Chap 1 - Introduction GUI.pptxChap 1 - Introduction GUI.pptx
Chap 1 - Introduction GUI.pptxTadeseBeyene
 
JAVA Programming: Topic -AWT(Abstract Window Tool )
JAVA Programming: Topic -AWT(Abstract Window Tool )JAVA Programming: Topic -AWT(Abstract Window Tool )
JAVA Programming: Topic -AWT(Abstract Window Tool )Navya Francis
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01Ankit Dubey
 
Awt, Swing, Layout managers
Awt, Swing, Layout managersAwt, Swing, Layout managers
Awt, Swing, Layout managersswapnac12
 

Similaire à Quiz app(j tabbed pane,jdialog,container,actionevent,jradiobutton,buttongroup,jpanel) (20)

13457272.ppt
13457272.ppt13457272.ppt
13457272.ppt
 
DSJ_Unit III.pdf
DSJ_Unit III.pdfDSJ_Unit III.pdf
DSJ_Unit III.pdf
 
Swing
SwingSwing
Swing
 
Swings
SwingsSwings
Swings
 
Swing basics
Swing basicsSwing basics
Swing basics
 
Advanced java programming
Advanced java programmingAdvanced java programming
Advanced java programming
 
Unit-2 swing and mvc architecture
Unit-2 swing and mvc architectureUnit-2 swing and mvc architecture
Unit-2 swing and mvc architecture
 
Chap1 1 1
Chap1 1 1Chap1 1 1
Chap1 1 1
 
Chap1 1.1
Chap1 1.1Chap1 1.1
Chap1 1.1
 
JAVA Jcheckbox in simple and easy .pptx
JAVA Jcheckbox in simple and  easy .pptxJAVA Jcheckbox in simple and  easy .pptx
JAVA Jcheckbox in simple and easy .pptx
 
SWING USING JAVA WITH VARIOUS COMPONENTS
SWING USING  JAVA WITH VARIOUS COMPONENTSSWING USING  JAVA WITH VARIOUS COMPONENTS
SWING USING JAVA WITH VARIOUS COMPONENTS
 
Programming Java GUI using SWING, Event Handling
Programming Java GUI using SWING, Event HandlingProgramming Java GUI using SWING, Event Handling
Programming Java GUI using SWING, Event Handling
 
Chap 1 - Introduction GUI.pptx
Chap 1 - Introduction GUI.pptxChap 1 - Introduction GUI.pptx
Chap 1 - Introduction GUI.pptx
 
GUI.pdf
GUI.pdfGUI.pdf
GUI.pdf
 
JAVA Programming: Topic -AWT(Abstract Window Tool )
JAVA Programming: Topic -AWT(Abstract Window Tool )JAVA Programming: Topic -AWT(Abstract Window Tool )
JAVA Programming: Topic -AWT(Abstract Window Tool )
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01
 
Awt, Swing, Layout managers
Awt, Swing, Layout managersAwt, Swing, Layout managers
Awt, Swing, Layout managers
 
11basic Swing
11basic Swing11basic Swing
11basic Swing
 
Java Swing
Java SwingJava Swing
Java Swing
 
JavaAdvUnit-1.pptx
JavaAdvUnit-1.pptxJavaAdvUnit-1.pptx
JavaAdvUnit-1.pptx
 

Dernier

Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxnuruddin69
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...Health
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsvanyagupta248
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stageAbc194748
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptMsecMca
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projectssmsksolar
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...HenryBriggs2
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersMairaAshraf6
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...soginsider
 

Dernier (20)

Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptx
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stage
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 

Quiz app(j tabbed pane,jdialog,container,actionevent,jradiobutton,buttongroup,jpanel)

  • 1. Quiz Application using Swings BY SANA MATEEN
  • 2. Containers • A container holds a group of components. • Thus, a container is a special type of component that is designed to hold other components. • Furthermore, in order for a component to be displayed, it must be held within a container. • Thus, all Swing GUIs will have at least one container. • Because containers are components, a container can also hold other containers. • This enables Swing to define what is called a containment hierarchy, at the top of which must be a top-level container. • Swing defines two types of containers. • The first are top-level containers: JFrame, JApplet, JWindow, and JDialog. These containers do not inherit JComponent. They do, however, inherit the AWT classes Component and Container. Unlike Swing’s other components, which are lightweight, the top-level containers are heavyweight. This makes the top-level containers a special case in the Swing component library.
  • 3. Java JFrame • The javax.swing.JFrame class is a type of container which inherits the java.awt.Frame class. JFrame works like the main window where components like labels, buttons, textfields are added to create a GUI. • Unlike Frame, JFrame has the option to hide or close the window with the help of setDefaultCloseOperation(int) method. Constructor Description JFrame() It constructs a new frame that is initially invisible. JFrame(GraphicsConfiguration gc) It creates a Frame in the specified GraphicsConfiguration of a screen device and a blank title. JFrame(String title) It creates a new, initially invisible Frame with the specified title. JFrame(String title, GraphicsConfiguration gc) It creates a JFrame with the specified title and the specified GraphicsConfiguration of a screen device.
  • 4. JLabel • The class JLabel can display either text, an image, or both. Label's contents are aligned by setting the vertical and horizontal alignment in its display area. By default, labels are vertically centered in their display area. Text-only labels are leading edge aligned, by default; image-only labels are horizontally centered, by default. • Following is the declaration for javax.swing.JLabel class − • public class JLabel extends JComponent implements SwingConstants, Accessible Constructor Description JLabel() Creates a JLabel instance with no image and with an empty string for the title. JLabel(String s) Creates a JLabel instance with the specified text. JLabel(Icon i) Creates a JLabel instance with the specified image. JLabel(String s, Icon i, int horizontalAlignment) Creates a JLabel instance with the specified text, image, and horizontal alignment.
  • 5. Constructor & Description 1 JLabel() Creates a JLabel instance with no image and with an empty string for the title. 2 JLabel(Icon image) Creates a JLabel instance with the specified image. 3 JLabel(Icon image, int horizontalAlignment) Creates a JLabel instance with the specified image and horizontal alignment. 4 JLabel(String text) Creates a JLabel instance with the specified text. 5 JLabel(String text, Icon icon, int horizontalAlignment) Creates a JLabel instance with the specified text, image, and horizontal alignment. 6 JLabel(String text, int horizontalAlignment) Creates a JLabel instance with the specified text and horizontal alignment.
  • 6. Java JPanel • The JPanel is a simplest container class. It provides space in which an application can attach any other component. It inherits the JComponents class. • It doesn't have title bar. • JPanel class declaration • public class JPanel extends JComponent implements Accessible Constructor Description JPanel() It is used to create a new JPanel with a double buffer and a flow layout. JPanel(boolean isDoubleBuffered) It is used to create a new JPanel with FlowLayout and the specified buffering strategy. JPanel(LayoutManager layout) It is used to create a new JPanel with the specified layout manager.
  • 7. JRadioButton • The JRadioButton class is used to create a radio button. It is used to choose one option from multiple options. It is widely used in exam systems or quiz. • It should be added in ButtonGroup to select one radio button only. • JRadioButton class declaration • Let's see the declaration for javax.swing.JRadioButton class. • public class JRadioButton extends JToggleButton implements Accessible Constructor Description JRadioButton() Creates an unselected radio button with no text. JRadioButton(String s) Creates an unselected radio button with specified text. JRadioButton(String s, boolean selected) Creates a radio button with the specified text and selected status.
  • 8. Elements are then added to the button group via the following method: void add(AbstractButton ab) Here, ab is a reference to the button to be added to the group. A JRadioButton generates action events, item events, and change events each time the button selection changes. Most often, it is the action event that is handled, which means that you will normally implement the ActionListener interface.
  • 9. Java JButton • The JButton class is used to create a labeled button that has platform independent implementation. • The application result in some action when the button is pushed. It inherits AbstractButton class. • JButton class declaration • void setIcon(Icon b)It is used to set the specified Icon on the button. • public class JButton extends AbstractButton implements Accessible Constructor Description JButton() It creates a button with no text and icon. JButton(String s) It creates a button with the specified text. JButton(Icon i) It creates a button with the specified icon object.
  • 10. Java JTabbedPane • The JTabbedPane class is used to switch between a group of components by clicking on a tab with a given title or icon. It inherits JComponent class. • JTabbedPane class declaration • Let's see the declaration for javax.swing.JTabbedPane class. • public class JTabbedPane extends JComponent implements Serializable, A ccessible, SwingConstants Constructor Description JTabbedPane() Creates an empty TabbedPane with a default tab placement of JTabbedPane.Top. JTabbedPane(int tabPlacement) Creates an empty TabbedPane with a specified tab placement. JTabbedPane(int tabPlacement, int tabLayoutPolicy) Creates an empty TabbedPane with a specified tab placement and tab layout policy.
  • 11. Java JDialog • The JDialog control represents a top level window with a border and a title used to take some form of input from the user. It inherits the Dialog class. • Unlike JFrame, it doesn't have maximize and minimize buttons. • JDialog class declaration • Let's see the declaration for javax.swing.JDialog class. • public class JDialog extends Dialog implements WindowConstants, Accessible, RootPaneContainer Constructor Description JDialog() It is used to create a modeless dialog without a title and without a specified Frame owner. JDialog(Frame owner) It is used to create a modeless dialog with specified Frame as its owner and an empty title. JDialog(Frame owner, String title, boolean modal) It is used to create a dialog with the specified title, owner Frame and modality.