Sunday, 15 February 2026

Tutorial on Swing Components

 Swing library and it's categorization of components and controls


Basically, Swing library provides around 50+ components. These all components are categorized containers, windows and controls etc. based upon their behavior and working style. 

Apart of  these default components, As I wrote in earlier posts, Swing components are customizable and new components can be invented, on need basis. 

Default Swing components and their categorizations are as below:
  • Swing Containers
    • Panel
    • Tabbed Pane
    • Spilt Pane
    • Scroll Pane
    • Tool Bar
    • Internal Frame
    • Desktop Pane
    • Layered Pane
  • Swing Controls
    • Label
    • Button
    • Toggle Button
    • Check Box
    • Radio Button
    • Button Group
    • Combo Box
    • Check Box
    • List
    • Text Field
    • Text Area
    • Scroll Bar
    • Slider etc
  • Swing Windows
    • Dialog
    • Frame
    • Color Chooser
    • File Chooser
    • Option Pane
  • Swing Menus
    • Menu Bar
    • Menu
    • Menu Item
    • Popup Menu
    • Separator
  • Swing Fillers
    • Glue
    • Horizontal Glue
    • Rigid Area
    • Vertical Glue etc.
Example Window with some Controls and containers:

 
Fig 1: Sample Controls from Swing Toolkit



That is all for now. Happy coding!

Tutorial on Swing Containers and Controls

Tutorial on Creating Graphical User Interfaces with Swing and AWT

Graphical User Interface, in short GUI is developed using java programming language's toolkits Swing and AWT. AWT also stands for Abstract Windowing Toolkit.


When Java programming language evolved during the year 1994 - 95,  during it's first version, AWT toolkit was introduced. AWT uses OS graphics which breaks the Java law. i.e Java programming language is platform independent. 


Platform independence means, write once and run anywhere


AWT toolkit, uses operating system resources. Hence, using AWT library is heavy, that means, using it takes maximum computers processing and computation time and slows down the computers performance.

And also, there are very limited widgets or components available. Since the native OS also provides limited widgets for Java programming language to use.


To overcome these all issues, the Java team has invented a toolkit or library called, Swing. Swing is included in JFC, which stands for Java Foundation Classes.

Swing is developed using 100 percent java code and does not depend on native OS's resources at all.

Graphics developed with Swing are very quick in response time and has elegant look. And also, Look and Feel is customizable according to the need.


I write about Look and Feel, also called as PLAF [Pluggable Look And Feel] in Swing terminology, in near future.

I also write about Swing containers and components, How actually components and containers can be created by following best coding practices and adding and changing the components' default properties etc. in coming articles.

One of  the best usecases of using Swing library is, Netbeans IDE. Netbeans is industry endorsed for developing desktop application using AWT and Swing toolkits from Java programming language.

You can download Netbeans IDE from here:

                                         Apache NetBeans Releases


To begin, learning Swing toolkit is installing Netbeans and writing Swing code using Netbeans. 


That is all for now. Happy coding :)



    


  

 

Tutorial on Swing Components

 Swing library and it's categorization of components and controls Basically, Swing library provides around 50+ components. These all com...