Page 1 :
- Aaa, , , , , , Swings, , , , , , , , Introduction to swing : Swin, Labels, Text Fields, Com, , bo Boxes. Butt, Components : Tabbed Pan 0 uttons:, , 9 features, Ditteronce between AWT and Swing. Swing Components : JApplet, Icons and, = : The JButton, Check Boxes, Radio Buttons, Advanced Swing, 8S, Scroll Panes, Trees, Tables, Progross bar, tool tips, MVC Architecture., , , , , , 21, , , , lass, __Detine Swing. (Ref. Sec. 2.1) (Likely Ques), , Syllabus Topic : Introduction to Swing, , Introduction to Swing, , , , , , , , , @ GUI widget toolkit for Java. It is part off, wa Foundation Classes (JFC) - an API for, @ Graphical User Interface (GUD for Java, , , , , , Swing was developed to provide a more sophisticated, set of GUI components than the earlier Abstract, Window Toolkit (AWT)., , Swing provides a look and feel that emulates the look, and feel of several platforms, and also supports a, pluggable look and feel that allows applications to, have a look and feel unrelated to the underlying, platform., , , , 24.1, , , , Syllabus Topic : Swing Features, , Advantages / Characteristics /, Features of Swing, , , , , , Advantages / Characteristics /, Features of Swing, , 1. Platform Independent, , , , 2. Extensible, 3, Lightweight UI, 4, Independent, , 5, Consistency, , , , 6. Power, , Hh, , Fig. 2.1.1: Features of Swing, 1, Platform Independent, , Swing is platform-independent because it is completely, written in Java, ;, , 2. Extensible, , Extending the functionality of swing is very easy for, programmers., 3. Lightweight UI, , As swing is written in Java, its components are light, weight., 4, Independent, , Swing is not dependent on underlying platform for the, creation of user interface., , Lae, , i)
Page 2 :
MaliTE tem §:Comp/T, , Irrespective of platiorms, the look and feel of swing, components is same in all the environments., > © Power, Swing is used to develop complex and large application, , GUI., 2.1.2 Disadvantages / Drawbacks of Swing, , , , , , ', Fig’2.1.2: Disadvantages of Swing, , > 1. Appearance, The appearance of swing components is same on all, platforms which may be little bit boring for end users., , > 2. Time, Swing components take more time to display on the, screen., , > 3. Dependent, , Swing components are dependent on AWT library., , ——— ee, Syllabus Topic : Difference between AWT, , and Swing, 2.1.3 Difference between AWT and Swing, , re, , , , Swing is a part of, Java Foundation, Class (JFC)., , Tech-Neo Publications 10... Where Authors inspire innovation, , , , , , , , , , , , , , , , , , , , , , , , , , Weight AWT provides Swing provic, heavy weight light weight, | components: _ components,, a ee », Platform AWT components Swing componen,, Dependency are platform are platform, dependent. peependent._, _—<—<—<— —, Number of | AWT contains Swing has a highe,, Components | less number of number of, components. components., MVC AWT does not Swing follows the, follow the MVC MVC architecture, architecture., Look and AWT components | Swing components, Feel are platform are platform, dependent so there | independent so, look and feel there look and fee], changes according | remains constant on, to OS. all the platforms., Speed to Slow compared to | Fast compared to, transfer in | swing.’ AWT., internet, Required AWT components | Swing componenis, tee require more require less, Spee memory space. memory space. _|, Required | java.awt javax.swing, Package, Sane, , 2.1.4 The MVC Architecture and Swing, , , , , f - View-Controller is commonly used !, loping software that divides an application i", three interconnected parts,, , wd SACHIN SHAH Veo”, , zy
Page 5 :
a |, , , , , :\jdk\bin>javac JcExample.java, , , , :\jdk\bin>java JCExample, , , , i, , Syllabus Topic : Swing Components, 2.3. Swing Components, , — Swing has more powerful and flexible components, than AWT., , — In addition to familiar components such as buttons,, check boxes and labels, Swing provides several, advanced components such as tabbed panel, scroll, panes, trees, tables, and lists., , - Unlike AWT components, Swing components are not, implemented by platform-specific code. Instead, they, are written entirely in Java and therefore are platformindependent. The term "lightweight" is used to, describe such an element., , — Swing introduced a mechanism that allowed the look, and feel of every component in an application to be, , altered without making substantial changes to the, application code., , ~The introduction of support for a pluggable look and, feel allows Swing components to follow the, appearance of native components while still retaining, , the benefits of platform independence., , , , , , void add(comp), , , , , , 2.3.1 JApplet, , Fundamental to Swing is the JApplet class, which, , extends Applet. Applets that use Swing must be, subclasses of JApplet. Applet 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., , 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 :, , ceniner prtsculast, , The add( ) method of Container can be used to add a, , component to a content pane. Its form is shown here :, , , , Here, comp is the component to be added to the content, pane., , ——————— ee, , Syllabus Topic : Icons and Labels, , 2.3.2 Icons and Labels, , , , Here we are going to learn icons and labels in Swing., , @ Icons, , Many Swing components, such as labels, buttons, and, tabbed panes, can be decorated with an icon - a fixed, sized picture. An icon is an object that adheres to, the Icon interface.