This presentation is about swing concept in python

riazahamed37 36 views 12 slides Oct 10, 2024
Slide 1
Slide 1 of 12
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12

About This Presentation

This slide discusses about introduction of swing concept in java


Slide Content

JAVA SWING INTRODUCTION TO SWING

Introduction In general, java programs are written that communicate with the end user through a text-based interface Using System.out for output Using Keyboard for input. Java provides two sets of facilities for developing GUIs : The Abstract Window Toolkit ( AWT ): package java.awt Swing : package javax.swing

Abstract Window Toolkit (AWT) The Abstract Window Toolkit is a portable GUI library. AWT provides the connection between the application and the native GUI. AWT components depend on native code counterparts (called peers) to handle their functionality. Thus, these components are often called heavyweight components.

Swing Swing implements GUI components that build on AWT technology. Swing is implemented entirely in Java. Swing components do not depend on peers to handle their functionality. Thus, these components are often called lightweight components.

Visual Difference in Awt and Swing

Visual Difference in Awt and Swing

What is Java swing? Java Swing  is a part of Java Foundation Classes (JFC) that is  used to create window-based applications . It is built on the top of AWT (Abstract Windowing Toolkit) API and entirely written in java. The Java Foundation Classes (JFC) are a set of GUI components which simplify the development of desktop applications. Unlike AWT, Java Swing provides platform-independent and lightweight components. The javax.swing package provides classes for java swing API such as JButton , JTextField , JTextArea , JRadioButton , JCheckbox , JMenu , JColorChooser etc.

Difference between AWT and Swing No. Java AWT Java Swing 1) AWT components are  platform-dependent . Java swing components are  platform-independent . 2) AWT components are   heavyweight . Swing components are  lightweight . 3) AWT  doesn't support pluggable look and feel . Swing  supports pluggable look and feel . 4) AWT provides  less components  than Swing. Swing provides  more powerful components such as tables, lists, scrollpanes , colorchooser , tabbedpane etc. 5) AWT  doesn't follows MVC (Model View Controller) where model represents data, view represents presentation and controller acts as an interface between model and view. Swing  follows MVC .

The javax.swing Package

The javax.swing Package

JApplet Fundamental to Swing is the JApplet class, which extends Applet . Applets that use Swing must be subclasses of JApplet . JApplet is rich with functionality that is not found in Applet . For example, JApplet supports various “panes,” such as the content pane, the glass pane, and the root pane.

Adding a component When adding a component to an instance of JApplet , do not invoke the add( ) method of the applet. Instead , call add( ) for the content pane of the JApplet object. The content pane can be obtained via the method shown here: Container getContentPane ( ) The add( ) method of Container can be used to add a component to a content pane.  Its form is shown here : void add( comp ) Here, comp is the component to be added to the content pane.
Tags