0% found this document useful (0 votes)
29 views9 pages

Swing Class: Object Oriented Programming

The document discusses several Swing components in Java. It explains that JComponent is the base class for most Swing components whose names start with "J", and provides functionality like tooltips, painting, borders, look and feel, properties, layout support, accessibility, drag and drop, and double buffering. It then describes the purposes and key features of JLabel, JTextComponent, JTextField, JTextArea, JList, JComboBox, and JScrollPane.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views9 pages

Swing Class: Object Oriented Programming

The document discusses several Swing components in Java. It explains that JComponent is the base class for most Swing components whose names start with "J", and provides functionality like tooltips, painting, borders, look and feel, properties, layout support, accessibility, drag and drop, and double buffering. It then describes the purposes and key features of JLabel, JTextComponent, JTextField, JTextArea, JList, JComboBox, and JScrollPane.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 9

SWING CLASS

Object Oriented Programming

JComponent Class
2

All Swing components except top-level


containers whose names begin with
Jdescend from the JComponent class
(e.g., JPanel, JScrollPane, and
JButton).

Events and Event Handling

JComponent Class
3

The JComponent class provides the


following functionality to its descendants:
Tool

tips
Painting and borders
Application-wide pluggable look and feel
Custom properties
Support for layout
Support for accessibility
Support for drag and drop
Double buffering
Key bindings
Events and Event Handling

JLabel Class
4

A JLabel object can display either text or


an image, or both. It cannot react to input
events but is instead commonly used to
provide a label identifier for a nearby
object that does.
The JLabel class uses three constants to
align the component horizontally.
1.
2.
3.

JLabel.LEFT
JLabel.RIGHT
JLabel.CENTER
Events and Event Handling

JTextComponent Class
5

The JTextComponent class provides a


base class for Swing components that
handle editable text.
It provides the functionalities for
entering and editing text information
nearly all the features of a text editor.
JTextComponent has three direct
subclassesJTextField, JTextArea, and
JEditorPane.
Events and Event Handling

JTextComponent Class
6

JTextField provides a component for


entering and editing a single line of text.
A JTextArea object displays multiple
lines of text in a single font and style and
optionally allows the user to edit the
text.
JTextArea

does not handle scrolling, but


implements the swing Scrollableinterface.

Events and Event Handling

JList Class
7

JList class is used to display a list of


items, such as list of students, a list of
files, and so forth.
A JList object is constructed in a manner
similar to the way a JComboBox object is
constructed, that is, by passing an array
of String.

Events and Event Handling

JComboBox Class
8

The JComboBox is a component that


combines two features:
1.
2.

display area showing an option, and


a list box containing additional options.

Events and Event Handling

JScrollPane Class
9

The JScrollPane container can hold


components that require more display
area than they have been allocated.

Events and Event Handling

You might also like