Skip to main content

About the Components


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!




Comments

  1. Interesting Stuff to read , Keep It Up ! 😊
    Thanks for sharing such a good blog.✨

    ReplyDelete
  2. Great work. Quite informative. Keep doing itπŸ˜‡✨

    ReplyDelete
  3. Pretty precise !! Great job done !!!

    ReplyDelete
  4. This is a very informative blog. Well done guys.

    ReplyDelete
    Replies
    1. Thanks!!Wait for some more informative and interesting stuff!

      Delete
  5. Good read. Eagerly waiting to play this one.

    ReplyDelete
  6. I think you should open a website .... really helpful and easily understandable ��

    ReplyDelete
    Replies
    1. Thanks!!We will definitely think upon that!!Thanks for your genuine opinion!!

      Delete
  7. Interesting and informative stuff. Well done.

    ReplyDelete

Post a Comment