In last blog, we discussed about selecting a framework. Now, we will discuss about the basic components of Swing. Basically, these basic components are classes itself and we will use their attributes in the GUI implementations.
So here are these components:
1. Panel:
The panel is nothing but simplest container class as
it inherits the container class. It does not contain title bar and menu bar. It
can attach any other component. It can be declared as
public class Panel extends Container implements Accessible
2. Text field:
Text field inherits TextComponent class. The object of
this class is text component that allows the editing of a single line text. It
can be declared as
public class TextField extends TextComponent
3. Label:
Label is used for displaying a single line of read
only text. The object of this class is a component for placing a text in a
container. User cannot edit this text directly but an application can change
it. It can be declares as
public class Label extends Component implements Accessible
4. Button:
This class is used to create a labeled button. Button
has platform independent implementation. When the button is pushed, the
application results in some action. This class can be declared as
public class Button extends Component implements Accessible
5. Frame:
Frame is also a container. It can contain title bar, menu
bar and border.
6. Layout:
Two types of layout components are used.
1)Border
Layout-
This is the
default layout of frame or window. The border Layout is used for arranging the
components in five regions namely east, west, south, north and center. Each
region contain s maximum one component only. It provides five constants for each
region .
Constructors for BorderLayout
class are BorderLayout(), JBorderLayout( int hgap ,int vgap)
2)Grid Layout-
This is the
default layout of panel. It is used to arrange the components in rectangular
grid. One component is displayed in each rectangle.
GridLayout(),
GridLayout(int rows, int columns), GridLayout(int rows, int columns, int hgap,
int vgap) are constructors for grid layout.
So, in this blog we elaborated the SWING components.
In the next blog we will be writing about how we used them in our project.
Until then HAPPY CODING!
Interesting Stuff to read , Keep It Up ! π
ReplyDeleteThanks for sharing such a good blog.✨
Thanks!!Wait for some more interesting stuff!!
DeleteInformative
ReplyDeleteThanks!!
DeleteVery nice... Informative π΅
ReplyDeleteThanks Sir!Keep motivating us!!!!
DeleteGreat work. Quite informative. Keep doing itπ✨
ReplyDeleteThanks Sir!!
DeletePretty precise !! Great job done !!!
ReplyDeleteThis is a very informative blog. Well done guys.
ReplyDeleteThanks!!Wait for some more informative and interesting stuff!
DeleteVery Informative blog.
ReplyDeleteThanks a lot!Keep supporting us!
DeleteWell written!!Good job!!
ReplyDeleteInteresting stuff!!
ReplyDeleteNicely done
ReplyDeleteGood read. Eagerly waiting to play this one.
ReplyDeleteThanks!!
Deletenice info
ReplyDeleteWell put!
ReplyDeleteI think you should open a website .... really helpful and easily understandable ��
ReplyDeleteThanks!!We will definitely think upon that!!Thanks for your genuine opinion!!
DeleteInteresting and informative stuff. Well done.
ReplyDeleteThank you so much!
Delete