WDD_lec_10 - Web Design & Development Lecture 10 Basics of...

Info iconThis preview shows pages 1–15. Sign up to view the full content.

View Full Document Right Arrow Icon
Web Design & Development Lecture 10
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Basics of GUI
Background image of page 2
GUI ?
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Support for GUI in Java
Background image of page 4
Support for GUI Abstract Windowing Toolkit (AWT) & Swing packages Provides rich set of user interface components java.awt & javax.swing Old (AWT) VS. New(Swing) Components in awt & swing (start with J) Frame, JFrame Menu, JMenu Button, JButton TextField, JTextFiled Label, JLabel and many more…. Use Java API Documentation well, its your FRIEND.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Abstract Windowing Toolkit AWT The original GUI components Referred as “Heavy Weight Components (HWC)” Tied directly to the local platform’s GUI capabilities Provides robust event-handling model Layout Managers
Background image of page 6
Swing Swing Newest GUI components, Names start with J can be identified “replacement” to the AWT Referred as “Light Weight Components (LWC)” Swing components are written, manipulated and displayed completely in java So they are not “weighed down” by the GUI capabilities of local platform Several Swing components are still HWC like JFrame etc. Allows uniform “look & feel” across all platforms
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
A Part of the Framework Object Component Container JComponent JPanel Window Frame JFrame AbstractButton JButton
Background image of page 8
GUI Creation Steps
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
GUI Creation Steps 1. import required package e.g. swing, awt 1. Setup the top level container e.g. JFrame myframe = new JFrame();
Background image of page 10
GUI Creation Steps (cont.) 1. Get the component Area of the top level Container Container c = myFrame.getContentPane(); System Area Component Area
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
GUI Creation Steps (cont.) 1. Apply layout to that Area c.setLayout(new FlowLayout()); 1. Create & add components JButton b1 = new JButton(“Hello”); c.add(b1); 1. Set size of Frame and make it Visible myFrame.setSize(200,200); myFrame.setVisible(true);
Background image of page 12
Example GUI
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
GUI: Example Code //Step 1: import packages import java.awt.*; import javax.swing.*; public class GUITest { JFrame myFrame ; JTextField tf; JButton b1; public void initGUI ( ) { //method used for setting layout of GUI //Step 2: setup the top level container
Background image of page 14
Image of page 15
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/01/2010 for the course CS CS506 taught by Professor mr. umair javed during the Spring '10 term at Virtual University of Pakistan.

Page1 / 39

WDD_lec_10 - Web Design & Development Lecture 10 Basics of...

This preview shows document pages 1 - 15. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online