IADCS Diploma Course Swing Programming U Nyein Oo COO/Director(IT) Myanma Computer Co.,
Java Foundation Classes? <ul><li>Set of Java Class Libraries provides as part of J2SE </li></ul><ul><li>Support building G...
Features of JFC <ul><li>Abstract Windowing Toolkits </li></ul><ul><li>Java 2D </li></ul><ul><li>Swing GUI Components </li>...
MVC Architecture <ul><li>Design pattern to Swing UI for JFC </li></ul><ul><li>Used for constructing entire UI Components <...
MVC Design Pattern Model Controller View Inform the view to update visual Read the contents Update the contents Inform vie...
What MVC means? <ul><li>Model   is the piece that represents the state and low level behavior of the component. </li></ul>...
Benefits using MVC <ul><li>To divded large program to views of documents. </li></ul><ul><li>A view provides a window into ...
Swing Programming <ul><li>AWT is the heave weight component and it has a peer object for the native GUI </li></ul><ul><li>...
Why Swing? <ul><li>Uses fewer system resources </li></ul><ul><li>Add a lot of more sophisticated components </li></ul><ul>...
Swing Basic <ul><li>Swing is set of packages build on top of the AWT with number of prebuild classes(over 250 classes and ...
Structure of Swing Components JContainer Classes JComponent Classes All Swing Components
Swing Components <ul><li>Windows </li></ul><ul><li>Menus </li></ul><ul><li>AbstractButton </li></ul><ul><li>Panels </li></...
Sub Classes of the JComponent Class <ul><li>JComponent is the superclass of all swing components. All the components begin...
Swing Packages Swing Package Description javax.swing Contains components, adapters, component models and interfaces. It is...
Swing Event Handling <ul><li>For a Java program to run, the interface should be made receptive to user events   </li></ul>...
Look and Feel <ul><li>Swing is a real improvement to the AWT, since it supplies rich set of platform GUI components   </li...
Look and Feel Cont; <ul><li>The look and feel consists of the way the program is presented to the user (looks) & the way u...
Thank You
1. Frame Test
3. Label Test
4. Button Test
6. Text Area Test
7. CheckBox and Radio Button
8. Listtest Test
9. Color Change Test
10. Editable TextArea Test
11. Border Test
12. Calcuator
13. Combo Example
14. Menu Example
15. Popup Menu Example
16. DialogBox Test
17. Table Test
18. Progress Bar Test
19. Tooltips Test
20. Color Chooser Test
21. File Chooser Test
Upcoming SlideShare
Loading in …5
×

Windows Programming with Swing

2,284 views
2,204 views

Published on

Published in: Business, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,284
On SlideShare
0
From Embeds
0
Number of Embeds
25
Actions
Shares
0
Downloads
89
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Windows Programming with Swing

  1. 1. IADCS Diploma Course Swing Programming U Nyein Oo COO/Director(IT) Myanma Computer Co.,
  2. 2. Java Foundation Classes? <ul><li>Set of Java Class Libraries provides as part of J2SE </li></ul><ul><li>Support building GUI and graphics functionality for Java based Client Application </li></ul><ul><li>Run on Microsoft Platform and others like Mac OSX and Linux </li></ul><ul><li>Easily deployed over the web </li></ul><ul><li>Rich clients for web services </li></ul>
  3. 3. Features of JFC <ul><li>Abstract Windowing Toolkits </li></ul><ul><li>Java 2D </li></ul><ul><li>Swing GUI Components </li></ul><ul><li>Accessibility </li></ul><ul><li>Internationalization </li></ul>
  4. 4. MVC Architecture <ul><li>Design pattern to Swing UI for JFC </li></ul><ul><li>Used for constructing entire UI Components </li></ul><ul><li>Each component has a Model, a View and a Controller. </li></ul><ul><li>The model, view ,and controller pieces can change even while the component is in use. </li></ul>
  5. 5. MVC Design Pattern Model Controller View Inform the view to update visual Read the contents Update the contents Inform view of state change
  6. 6. What MVC means? <ul><li>Model is the piece that represents the state and low level behavior of the component. </li></ul><ul><li>(stored the data or stage of object) </li></ul><ul><li>View is the piece that manage the visual display of the state represented by the model </li></ul><ul><li>Controller is the piece that manages user interaction with the model.(handle the event) </li></ul>
  7. 7. Benefits using MVC <ul><li>To divded large program to views of documents. </li></ul><ul><li>A view provides a window into document </li></ul><ul><li>Multiple views can provide multiple windows into the document. </li></ul>
  8. 8. Swing Programming <ul><li>AWT is the heave weight component and it has a peer object for the native GUI </li></ul><ul><li>When the components are created they take help of the underlying O/S </li></ul><ul><li>Java offers Light weight components that do not have a peer object. </li></ul><ul><li>It now popular by Swing UI components </li></ul>
  9. 9. Why Swing? <ul><li>Uses fewer system resources </li></ul><ul><li>Add a lot of more sophisticated components </li></ul><ul><li>Tailor the Look and Feel of program and </li></ul><ul><li>Extensing of Existing Components for </li></ul><ul><li>- Layout Management </li></ul><ul><li>- Event handling </li></ul><ul><li>- Thread and Swing </li></ul><ul><li>- Printing ….etc </li></ul>
  10. 10. Swing Basic <ul><li>Swing is set of packages build on top of the AWT with number of prebuild classes(over 250 classes and 40UI components) </li></ul><ul><li>All swing UI components are started with J for use the terms JFC and Swing interchangeabily </li></ul>
  11. 11. Structure of Swing Components JContainer Classes JComponent Classes All Swing Components
  12. 12. Swing Components <ul><li>Windows </li></ul><ul><li>Menus </li></ul><ul><li>AbstractButton </li></ul><ul><li>Panels </li></ul><ul><li>Layouts </li></ul><ul><li>Icons </li></ul><ul><li>Borders </li></ul><ul><li>Toolbars </li></ul><ul><li>Labels </li></ul><ul><li>Buttons </li></ul><ul><li>List Boxes </li></ul><ul><li>Combo Boxes </li></ul><ul><li>Check Boxes </li></ul><ul><li>Tables </li></ul><ul><li>Trees </li></ul>
  13. 13. Sub Classes of the JComponent Class <ul><li>JComponent is the superclass of all swing components. All the components begin with the letter ‘J’. JComponent has the following subclasses: </li></ul><ul><ul><li>AbstractButton class </li></ul></ul><ul><ul><li>JButton & JLabel class </li></ul></ul><ul><ul><li>JButton </li></ul></ul><ul><ul><li>JLabel </li></ul></ul><ul><ul><li>JComboBox class </li></ul></ul><ul><ul><li>JCheckBox class </li></ul></ul><ul><ul><li>Jlist </li></ul></ul><ul><ul><li>Jmenu </li></ul></ul><ul><ul><li>JPopupMenu </li></ul></ul><ul><ul><li>JProgressBar </li></ul></ul><ul><ul><li>JScrollBar </li></ul></ul><ul><ul><li>JRadioButton </li></ul></ul><ul><ul><li>Jseparator </li></ul></ul><ul><ul><li>Jtable </li></ul></ul><ul><ul><li>JTextComponent </li></ul></ul><ul><ul><li>JToolBar </li></ul></ul><ul><ul><li>JTree </li></ul></ul>
  14. 14. Swing Packages Swing Package Description javax.swing Contains components, adapters, component models and interfaces. It is the highest-level swing package. javax.swing.basic Contains the user interface classes that implement the look and feel for swing components. javax.swing.border Declares the border interface, and classes defining the specific border styles. javax.swing.plaf Contains the plugable look and feel API. javax.swing.table Contains the interfaces and classes supporting the swing table component. javax.swing.text Contains the support classes for the swing document framework. javax.swing.event Defines the events and event listeners. javax.swing.tree Provides classes and interfaces that support the JTree component. javax.swing.undo Provides support classes for undo/redo operations.
  15. 15. Swing Event Handling <ul><li>For a Java program to run, the interface should be made receptive to user events </li></ul><ul><li>Swing handles events with a set of classes called ‘event listeners’ </li></ul><ul><li>javax.swing.event package defines a set of event listening interfaces and event classes so that they can used with Swing components </li></ul><ul><li>There are various events defined in the javax.swing.event package, such as: </li></ul><ul><ul><li>ChangeEvent </li></ul></ul><ul><ul><li>DragEvent </li></ul></ul><ul><ul><li>ListDataEvent </li></ul></ul><ul><ul><li>ListSelectionEvent </li></ul></ul><ul><ul><li>TableModelEvent </li></ul></ul><ul><ul><li>TableColumnEvent </li></ul></ul>
  16. 16. Look and Feel <ul><li>Swing is a real improvement to the AWT, since it supplies rich set of platform GUI components </li></ul><ul><li>Platform independence means the components within it are supported across all Java ports </li></ul><ul><li>Enables the look and feel of the components to be easily tailored </li></ul><ul><li>This is called as Pluggable Look and Feel (L&F) of the swing components </li></ul><ul><li>This helps us to create applets and applications that have a look and feel independent to the window platform in which they are executed </li></ul>
  17. 17. Look and Feel Cont; <ul><li>The look and feel consists of the way the program is presented to the user (looks) & the way user interacts with it (feels). </li></ul><ul><li>Swing provides the capability to change the look and feel of the applet or application. </li></ul><ul><li>Swing components are not tied to GUI components. It is because of this that we can create applets or applications that will use a specific look and feel. Look and feel is a function of view and controller. </li></ul>
  18. 18. Thank You
  19. 19. 1. Frame Test
  20. 20. 3. Label Test
  21. 21. 4. Button Test
  22. 22. 6. Text Area Test
  23. 23. 7. CheckBox and Radio Button
  24. 24. 8. Listtest Test
  25. 25. 9. Color Change Test
  26. 26. 10. Editable TextArea Test
  27. 27. 11. Border Test
  28. 28. 12. Calcuator
  29. 29. 13. Combo Example
  30. 30. 14. Menu Example
  31. 31. 15. Popup Menu Example
  32. 32. 16. DialogBox Test
  33. 33. 17. Table Test
  34. 34. 18. Progress Bar Test
  35. 35. 19. Tooltips Test
  36. 36. 20. Color Chooser Test
  37. 37. 21. File Chooser Test

×