What is Swing in java
What is Swing in java
what is Swing
Swing in java is part of Java foundation class which is lightweight and platform independent. It is used for creating window based applications. It includes components like button, scroll bar, text field etc. Putting together all these components makes a graphical user interface. Swing is the collection of user interface components for Java programs. It is part of Java Foundation classes that are referred to as JFC. In simple words, Swing is the graphical user interface toolkit that is used for developing windows based java applications or programs. It is the successor of AWT, which is known as Abstract window toolkit API for Java, and AWT components are mainly heavyweight. Swing is still used heavily, and will continue to be for a long while -- after all, it was the only choice for Java for a loooong time. JavaFX , however, is refreshingly nice, and very-much-so worth learning Swing Framework contains a set of classes that provides more powerful and flexible GUI components than those of AWT. It provides the look and feel of modern Java GUI. Swing library is an official Java GUI tool kit released by Sun Micro-systems. It is used to create graphical user interface with Java.Main Features of Swing Toolkit
- Platform Independent
- Customizable
- Extensible
- Configurable
- Lightweight
- Rich Controls
- Pluggable Look and Feel
-
Swing offers two key features:
- Swing components are lightweight and don't rely on peers.
- Swing supports a pluggable look and feel. The three PLAFs available to all users are Metal (default), Windows, and Motif.
AWT and Swing
AWT stands for Abstract Windowing Toolkit. It was the original toolkit and is more limited in features than Swing.
They are graphical user interface (GUI) libraries, which can be used to create applications with a graphical interactive front-end.Swing was introduced in 1998. It implemented many extra features and was designed to have a pluggable look and feel - enabling it to emulate the look and feel of the platform it's running on
Swing is a GUI widget toolkit for Java. It is part of Oracle's Java Foundation Classes (JFC) – an API for providing a graphical user interface (GUI) for Java programs. Swing was developed to provide a more sophisticated set of GUI components than the earlier Abstract Window Toolkit (AWT). Swing and JFC JFC is an abbreviation for Java Foundation classes that includes a set of characteristics to build Graphical User Interfaces (GUI) and add wealthy graphical characteristics and interactivity to Java apps. Java Swing belongs to the Java Classes Foundation (JFC).Features of JFC
- Swing GUI components.
- Look and Feel support.
- Java 2D.
Swing and like that kind of development platform, you will like GWT too. We evaluated it when it first came out, but later decided to develop the web app natively with HTML+CSS+JS because we have full control on what we write rather than depending on the GWT compiler to produce the JS code. Nevertheless it is a good framework for someone who wants to develop UI in Java.
Swing components
Below are the different components of swing in java:
- ImageIcon. The ImageIcon component creates an icon sized-image from an image residing at the source URL. ...
- JButton. JButton class is used to create a push-button on the UI.
- JLabel. ...
- JTextField. ...
- JTextArea. ...
- JPasswordField. ...
- JCheckBox. ...
- JRadioButton.
Java technology is a high-level programming and a platform-independent language. Java is designed to work in a distributed environment on the Internet. It has GUI features that provide you better "look and feel" over the C++ language, moreover it is easier to use than C++ and works on the concept of the object-oriented programming model.
Java enables us to play online games, video, audio, chat with people around the world, Banking Application, view 3D image, and Shopping Cart. It is finds its extensive use in the intranet applications and other e-business solutions that are the grassroots of corporate computing.
Java, regarded as the most well-described and planned language to develop applications for the Web. It is a well-known technology which allows you for software designed and written only once for a "virtual machine" to run on different computers, supports various Operating System like Windows PCs, Macintoshes, and Unix computers.
On the web aspect, Java is popular on web servers, used by many of the largest interactive websites. Java is used to create standalone applications that may run on a single computer or in a distributed network. It is also be used to create a small application program based on the applet, which is further used for the Web page. Applets make it easy and possible to interact with the Web page.
Features of Java
- Scalability: When developers need to improve the response time and the performance of a web application made in Java, less invasive coding is required and less time is needed from developers.
- Cross-Platform: The web app can be used on any device and in any operating system. Java Virtual Machine (JVM) can be used as an autonomous “machine” that can be superimposed on any operating system and on any hardware that exists.
- Memory Management: Java has its own built-in mechanism for ‘garbage collection’ and deleting unneeded objects over the heap. Thus, it helps in boosting the speed & effectiveness of the web application.
- Multi-threading: Java web applications allow several users at the same time. This can be done by creating threads for each user within the same program instead of executing multiple copies on the same hardware.
Uses of Java
- Web-based Applications: Java is also used to develop web applications. It provides vast support for web applications through Servlets, Struts, or JSPs. With the help of these technologies, you can develop any kind of web application that you require. The easy coding and high security offered by this programming language allow the development of a large number of applications for health, social security, education, and insurance.
- Enterprise Applications: Java is the first choice of many software developers for writing applications and Java Enterprise Edition (Java EE) is a very popular platform that provides API and runtime environment for scripting. It also includes network applications and web-services. JavaEE is also considered as the backbone for a variety of banking applications which have Java running on the UI to back server end.