Download presentation
Presentation is loading. Please wait.
Published byTorbjørg Bjerke Modified over 5 years ago
1
Java 2 Swing B.Ramamurthy 5/1/2019 B.Ramamurthy
2
Topics for Discussion Review Abstract Window Toolkit JDK1.2 Additions
Java Foundation classes Collection classes Swing Package Swing Demo Summary 5/1/2019 B.Ramamurthy
3
Review of AWT (partial list)
Component CheckBox Button TextComponent Container MenuComponent TextField TextArea Menu MenuBar MenuItem Panel Window Applet Frame Dialog 5/1/2019 B.Ramamurthy
4
JDK1.2 Additions JFC java2D(3D) AWT Drag&Drop Swing Accessibility
(Speech, Sight API) Collection classes Bug fixes JDK1.2 changes 5/1/2019 B.Ramamurthy
5
Swing package Swing provides components for developing UI and event (user) driven applications. EX; menus, toolbars, etc. Swing is a major enhancement of AWT. Can AWT and Swing coexist? YES How is Swing component different from an AWT component? 5/1/2019 B.Ramamurthy
6
Swing Component Two distinguishing characteristics are :
1. It supports pluggable Look and Feel. Besides run-anywhere, appearance of a component may be changed at run-time to look and feel like the system on which it is running. 2. Swing components are Lightweight components: they do not dependent on any native system classes. 5/1/2019 B.Ramamurthy
7
Speed Issue When using java Speed is an important issue to be concerned with. Right now Java is slow: Suggestions for improvement in your environment: 1. Faster hardware 2. Speed up techniques: Speed up JVM, use JIT (just in Time compiler) to by pass JVM when ever acceptable. 3. Use lightweight components 5/1/2019 B.Ramamurthy
8
Software/Hardware Push/Pull
demand Software Hardware supply EX: 1000Mhz intel CPU 5/1/2019 B.Ramamurthy
9
Lightweight Components
Motivation for lightweight components is two-fold: run-anywhere, speedup application 1. Lightweight 2. Normal 3. Bypass JVM; Use Native code ( JIT) Button 3 1 2 JVM Operating System 5/1/2019 B.Ramamurthy
10
Swing Lineage java.lang.Object java.awt.Component java.awt.Container
java.Swing.JComponent Note : This is my approach to studying a class/package. Exploring the lineage should be the starting point 5/1/2019 B.Ramamurthy
11
Swing Components (controls)
JApplet JButton JCheckBox JTable JTextPane JSlider JTree JPopupMenu Jtooltip JScrollBar JScrollPane JDialog JMenuBar etc. Note : J prefix to distinguish it from regular AWT components. 5/1/2019 B.Ramamurthy
12
Swing Demo Lets see what it offers through a demo.
This is available in : jdk1.2/demo/jfc/SwingSet/SwingSetApplet.java 5/1/2019 B.Ramamurthy
13
Java Development Kit (JDK 1.2)
Supports development of applications in Java by providing packages of classes to accomplish various commonly used functions, their complete source code, documentation for the API (application programmer’s interface). Tools : compiler (javac), runtime (java, appletviewer), documentation generator (javadoc) 5/1/2019 B.Ramamurthy
14
Javadoc Parses declarations and documentation comments in a set of Java source files and produces a set of HTML pages describing the public and protected classes, interfaces, constructors, methods and fields. Generates one .html file for each .java file and each package. Also generates a class hierarchy (tree.html) and index files of the members (AllNames.html) 5/1/2019 B.Ramamurthy
15
Commenting the Source Code
All comments with the format given below and immediately before a class, interface, method or field is recognized and used by javadoc. Format /** * This class is for running the show * This is next line * This is another line of comment */ 5/1/2019 B.Ramamurthy
16
How to use Javadoc? After your application is ready for deployment, run it through javadoc to generate the programmer’s manual : javadoc {options} java source file names/package names A complete hypertext version of programmer’s manual for your application will be ready in minutes. 5/1/2019 B.Ramamurthy
17
Browse through Javadoc generated documentation?
Javadoc generated documents usually start off at an index.html. Use any html browser to open up this file associated with the application and follow the links. 5/1/2019 B.Ramamurthy
18
Summary Discussed salient features of Swing.
AWT and Swing components may co-exist. Swing offers LookAndFeel of host environment and lightweight components. Discussed use of Javadoc tool for preparing documentation for applications. 5/1/2019 B.Ramamurthy
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.