Tuesday, 26 July 2016

Java Swing Application

Java Swing Application

Swing (Java) is a platform-independent, Model-View-Controller GUI framework for Java and implementation of (Look-and-Feel). 

Model–View–Controller (MVC) is a software architecture, currently considered an architectural pattern used in software engineering.

Swing is a highly partitioned architecture, which allows for the "plugging" of various custom implementations of specified framework interfaces: Users can provide their own custom implementation(s) of these components to override the default implementations. In general, Swing users can extend the framework by extending existing (framework) classes or providing alternative implementations of core components.

Swing is a component-based framework. 
The distinction between objects and components is a fairly subtle point: concisely, a component is a well-behaved object with a specified characteristic pattern of behavior. Swing objects asynchronously fire events, have "bound" properties, and respond to a well-known set of commands (specific to the component.) Specifically, Swing components are Java Beans components, compliant with the Java Beans Component Architecture specifications.

Since early versions of Java, a portion of the Abstract Window Toolkit (AWT) has provided platform-independent APIs for user interface components. In AWT, each component is rendered and controlled by a native peer component specific to the underlying windowing system.

By contrast, Swing components are often described as lightweight because they do not require allocation of native resources in the operating system's windowing toolkit. The AWT components are referred to as heavyweight components.

Example
import javax.swing.*; public class FirstSwingApplication extends JFrame { public static void main(String args[]) { new FirstSwingApplication(); } FirstSwingApplication() { JLabel jlbSwing = new JLabel("This is My First Swing Application Test"); add(jlbSwing); this.setSize(300, 300); setVisible(true); } } 

# To Run The Example Just Create a java Class named FirstSwingApplication.java and Copy The Code to The Class and Run the Class You Can Use jCreator or NetBeans IDE To Practice # 

There I Will Show A Complete Desktop Application With JavaSwing

No comments:

Post a Comment