GUI Components: Part 1

Size: px
Start display at page:

Download "GUI Components: Part 1"

Transcription

1 GUI Components: Part 1 Do you think I can listen all day to such stuff? Lewis Carroll Even a minor event in the life of a child is an event of that child s world and thus a world event. Gaston Bachelard You pays your money and you takes your choice. Punch Guess if you can, choose if you dare. Pierre Corneille Pearson Education Inc. All rights reserved. OBJECTIVES In this chapter you will learn: The design principles of graphical user interfaces (GUIs). To build GUIs and handle events generated by user interactions with GUIs. To understand the packages containing GUI components, event-handling classes and interfaces. To create and manipulate buttons, labels, lists, text fields and panels. To handle mouse events and keyboard events. To use layout managers to arrange GUI components Introduction 11.2 Simple GUI-Based Input/Output with 11.3 Overview of Swing Components 11. Displaying Text and Images in a Window 11.5 Text Fields and an Introduction to Event Handling with Nested Classes 11.6 Common GUI Event Types and Listener Interfaces 11.7 How Event Handling Works Buttons That Maintain State and Using an Anonymous Inner Class for Event Handling Multiple-Selection Lists Mouse Event Handling 11.1 Adapter Classes Sublcass for Drawing with the Mouse Key-Event Handling Layout Managers Introduction Graphical user interface (GUI) Presents a user-friendly mechanism for interacting with an application Often contains title bar, menu bar containing menus, buttons and combo boxes Built from GUI components Using Panels to Manage More Complex Layouts Wrap-Up 1

2 7 Look-and-Feel Observation 11.1 button menus title bar menu bar combo box Consistent user interfaces enable a user to learn new applications faster. scroll bars Fig Internet Explorer window with GUI components Simple GUI-Based Input/Output with Dialog boxes Used by applications to interact with the user Provided by Java s class Contains input dialogs and message dialogs 9 1 ##% && '( 2 ##% ) 3 % *##% 5 Show input dialog to receive first 6 + integer 7 ",-% %./0 + 9 ## ) % 10 -%)12 -%)12 Show input dialog to receive 11 3 %,56)%5 56)%50* second integer 12 -%12 -% %,56%5 56%50* 1 15 ##"-%" ) 16 &23% 3,)1 17 '23% 3, &7'* 2&7'*## Show message dialog to output 20 sum to user 21 ## % % 22 % %, )3%5 5-)3% :6--60* 2 ;## 25 ;## 10 Input dialog displayed by lines Prompt to the user When the user clicks OK, 3 % returns to the program the 100 typed by the user as a -%. The program must convert the -% to an title bar Input dialog displayed by lines Text field in which the user types a value Look-and-Feel Observation 11.2 The prompt in an input dialog typically uses sentence-style capitalization a style that capitalizes only the first letter of the first word in the text unless the word is a proper noun (for example, Deitel). Message dialog displayed by lines When the user clicks OK, the message dialog is dismissed (removed from the screen) 2

3 13 1 Look-and-Feel Observation 11.3 The title bar of a window typically uses book-title capitalization a style that capitalizes the first letter of each significant word in the text and does not end with any punctuation (for example, Capitalization in a Book Title). Message dialog type 6: :6--6 <131:6--6 =>6-31:6--6 Icon Description A dialog that indicates an error to the user. A dialog with an informational message to the user. A dialog warning the user of a potential problem. A dialog that poses a question to the user. This dialog normally requires a response, such as clicking a Yes or a No button. 31:6--6 no icon A dialog that contains a message, but no icon. Fig static constants for message dialogs Overview of Swing Components Swing GUI components Declared in package % Most are pure Java components Part of the Java Foundation Classes (JFC) Component Description Displays uneditable text or icons. Enables user to enter data from the keyboard. Can also be used to display editable or uneditable text. Triggers an event when clicked with the mouse. Specifies an option that can be selected or not selected. Provides a drop-down list of items from which the user can make a selection by clicking an item or possibly by typing into the box. Provides a list of items from which the user can make a selection by clicking on any item in the list. Multiple elements can be selected. Provides an area in which components can be placed and organized. Can also be used as a drawing area for graphics. Fig. 11. Some basic GUI components. Swing vs. AWT Abstract Window Toolkit (AWT) Precursor to Swing Declared in package Does not provide consistent, cross-platform look-and-feel 17 Portability Tip 11.1 Swing components are implemented in Java, so they are more portable and flexible than the original Java GUI components from package, which were based on the GUI components of the underlying platform. For this reason, Swing GUI components are generally preferred. 1 3

4 Lightweight vs. Heavyweight GUI Components Lightweight components Not tied directly to GUI components supported by underlying platform Heavyweight components Tied directly to the local platform AWT components Some Swing components 19 Look-and-Feel Observation 11. The look and feel of a GUI defined with heavyweight GUI components from package may vary across platforms. Because heavyweight components are tied to the localplatform GUI, the look and feel varies from platform to platform. 20 Superclasses of Swing s Lightweight GUI Components Class (package ) Subclass of! Declares many behaviors and attributes common to GUI components Class (package ) Subclass of Organizes s Class (package %) Subclass of Superclass of all lightweight Swing components 21 Software Engineering Observation 11.1 Study the attributes and behaviors of the classes in the class hierarchy of Fig These classes declare the features that are common to most Swing components Superclasses of Swing s Lightweight GUI Components Common lightweight component features Pluggable look-and-feel to customize the appearance of components Shortcut keys (called mnemonics) Common event-handling capabilities Brief description of component s purpose (called tool tips) Support for localization 2 Fig Common superclasses of many of the Swing components.

5 11. Displaying Text and Images in a Window 25 Labeling GUI Components 26 Class Most windows are an instance or subclass of this class Provides title bar Provides buttons to minimize, maximize and close the application Label Text instructions or information stating the purpose of each component Created with class 27 2 Look-and-Feel Observation 11.5 Text in a normally uses sentence-style capitalization. Specifying the Layout Laying out containers Determines where components are placed in the container Done in Java with layout managers One of which is class Set with the method of class 1 ##% &&?( 2 ## % 3 *##) % % *##" ) 5 % *## % 6 % -% *## -% 7 % 3*##) % % 3 %3*## % " &*##! 13 " '*## ## 17, ,,5% 50* 20,,0##) ## %93 % % 2 3%2 3 %3,%,0 %,5%& %)500* 0 29 '2,5 59%9 9%9 30 -% -% 6 31 ',5 '5 32, '## ' 33 % 5 3,%## AB,-% 6160* @ 1 ;## 2 ;## ## % % 23 &2,5 5 2 &,5 &5 25, &## & 26 5

6 1 ##% && D( 2 ##% 3 % * 31 Creating and Attaching & " ",-% %./ ,0*## 10 ), 6E3:1:-60* 11 -B,'DF 'DF9 9&GH &GH ##) B 12 C, ## ) 13 ;## ## 1 ;## Method of class Specifies the tool tip Method of class Adds a component to a container 33 3 Common Programming Error 11.1 If you do not explicitly add a GUI component to a container, the GUI component will not be displayed when the container appears on the screen. Look-and-Feel Observation 11.6 Use tool tips to add descriptive text to your GUI components. This text helps the user determine the GUI component s purpose in the user interface Creating and Attaching ' Creating and Interface 3 Other methods Can be added to a with the 3 method % and Implemented by class 3 %3 Interface -% Declares a set of common integer constants such as those used to set the alignment of components Can be used with methods AB % and C % For setting and retrieving the text of a label %3 and 3 For setting and retrieving the icon displayed in the label %AB and AB For setting and retrieving the horizontal position of the text displayed in the label 6

7 37 Creating and Displaying a Window 3 Other methods Constant Horizontal-position constants -% 6 -% 616 -% 3A Vertical-position constants -% -% 616 -% Description Place text on the left. Place text in the center. Place text on the right. Place text at the top. Place text in the center. Place text at the bottom. ) Dictates how the application reacts when the user clicks the close button -B Specifies the width and height of the window C Determines whether the window is displayed () or not () ) Fig. 11. Some basic GUI components Text Fields and an Introduction to Event Handling with Nested Classes Text Fields and an Introduction to Event Handling with Nested Classes 0 GUIs are event-driven A user interaction creates an event Common events are clicking a button, typing in a text field, selecting an item from a menu, closing and window and moving the mouse The event causes a call to a method called an event handler Class Superclass of Superclass of Adds echo character to hide text input in component Allows user to enter text in the component when component has the application s focus 1 ##% && I( 2 ## % 3 * " * 5 " 6"* 6 % * 7 % * * % * 9 % * (1 of 3) " &* &*##)B 1 " '* '*##) ##) B 16 " *## ) 17 1 ## 19, ,,5% 50* 22,,0##) 23 Create a new 2 ##)&H 25 &2 &2 &H &H0* 26,&## & ##)) 29 '2 ' * 30,'## ' ##)) '& Create a 5> )59 9'& '&0* 6,) ) ## % (2 of 3) Make this uneditable ## )) 3 2,5A5 5A50* 39, ## 0 Create a new 1 ##%" 2 A 2 A,0* 3 &, Create event handler ', 6, 7 ;## ## 9 ##" )" % 50 " A Create event handler class by 51 + implementing the 52 ##)" 53 " " ),6""0 interface 5 + Register event handler 55 -%%255 55* *## % Declare ) 56 method 2 7

8 57 ##6& 5 ) ) " %-,022& %2-% ),5&(J5 5&(J59 60 " %,00* Test if the source of the event is the first text field 61 Get text from text field 62 ##6' 63 ) ) " %-,022'0 0 Test if the source of the event! is " the 6 %2-% ),5'(J5 5'(J59 second text field 65 " %,00* (3 of 3) 66 Get text from text field 67 6 ) ) " %-,022@0 0 Test if the source of the event is the 69 %2-% ),5@(J5 5@(J59 9 third text field 70 " %,00* ##6 Get text from text field 73 ) ) " %-, Test if the source of the event is the 7 %2-% ),5 (J59 9 password field 75 -%, -%, %,000* ## Get password from password field 7 % %, 9% 9% 79 ;## ) 0 ;##" A 1 ;## 3 1 ##% && &H( 2 ##% 3 % * " ",-% %./ ,0* 10 ), 6E3:1:-60* 11 9&HH &HH ##) B 12 C, ## ) 13 ;## 1 ;## 5 Steps Required to Set Up Event Handling for a GUI Component Several coding steps are required for an application to respond to events Create a class for the event handler Implement an appropriate event-listener interface Register the event handler 6 Using a Nested Class to Implement an Event Handler Top-level classes Not declared within another class Nested classes Declared within another class Non- nested classes are called inner classes Frequently used for event handling 7 Software Engineering Observation 11.2 An inner class is allowed to directly access its top-level class s variables and methods, even if they are ".

9 Using a Nested Class to Implement an Event Handler 9 Registering the Event Handler for Each Text Field 50 Ks and s Registering an event handler Pressing enter within either of these fields causes an 6" Processed by objects that implement the interface Call method to register an object listens for events on the object Software Engineering Observation 11.3 The event listener for an event must implement the appropriate event-listener interface. Common Programming Error 11.2 Forgetting to register an event-handler object for a particular GUI component s event type causes events of that type to be ignored. Details of Class A s ) Method Common GUI Event Types and Listener Interfaces 5 Event source Event types Component from which event originates Can be determined using method %- Text from a can be acquired using % Text from a can be acquired using % All are subclasses of <6" Some declared in package " Those specific to Swing components declared in % " 9

10 11.6 Common GUI Event Types and Listener Interfaces Delegation event model Event source is the component with which user interacts Event object is created and contains information about the event that happened Event listener is notified when an event happens Fig Some event classes of package " How Event Handling Works 5 Remaining questions How did the event handler get registered? How does the GUI component know to call ) rather than some other eventhandling method? Fig Some common event-listener interfaces of package ". Registering Events Every has instance variable Object of type 6" Maintains references to all its registered listeners Fig Event registration for &. 10

11 Event-Handler Invocation Events are dispatched to only the event listeners that match the event type Events have a unique event ID specifying the event type K6"s are handled by s and s KL6"s are handled by Ls Button Component user clicks to trigger a specific action Can be command button, check box, toggle button or radio button Button types are subclasses of class Look-and-Feel Observation 11.7 Buttons typically use book-title capitalization Command button Generates an 6" when it is clicked Created with class Text on the face of the button is called button label Look-and-Feel Observation 11. Having more than one with the same label makes the s ambiguous to the user. Provide a unique label for each button. Fig Swing button hierarchy. 11

12 1 ##% && &F( 2 ## % 3 * " * 5 " 6"* 6 % * 7 % * % 3* 9 % 3 %3* 10 % * " *##! 15 " ) *## ## ## 1, ,,5%5 5%50* Create new 21,,0##) ## Create two 3 %3s 2, ## 25 Create new 26 3%&2 3%&2 3 %3,%,0 %,5%& %)500* %'2 3%'2 3 %3,%,0 %,5%' %)500* 0 Set rollover icon for 2 ) ) %& 9%&## % 29 ) ) "3,%'##" % 30,) ## ) Declare two instance variables ## A )" % 33 A 2 A,0* 3 ) ), 35, Create handler for buttons 36 ;## 37 3 ## )" % 39 " A ## " 2 " " ),6""0 6""0 Inner class implements 3 + % %, 9-% ), 5 5M(J5 5M(J59 9" %,000* 0 6 ;## ) 7 ;##" A A ;## Register event handlers Access outer class s instance using reference Get text of pressed 6 1 ##% && &?( 2 ##% 3 % * " ",-% %./ ,0*## 10 ), 6E3:1:-60* 11 -B,'DF 'DF9 9&&H &&H ##) B 12 C, ## ) 13 ;## ## 1 ;## 11. Ks can have a rollover icon Appears when mouse is positioned over a button Added to a with method "3 71 Look-and-Feel Observation 11.9 Because class supports displaying text and images on a button, all subclasses of also support displaying text and images

13 73 7 Look-and-Feel Observation Using rollover icons for s provides users with visual feedback indicating that when they click the mouse while the cursor is positioned over the button, an action will occur. Software Engineering Observation 11. When used in an inner class, keyword refers to the current inner-class object being manipulated. An inner-class method can use its outer-class object s by preceding with the outer-class name and a dot, as in Buttons That Maintain State State buttons Swing contains three types of state buttons %%, and and are subclasses of %% K Contains a check box label that appears to right of check box by default Generates an 36" when it is clicked K 36"s are handled by an 3 Passed to method - % Method - returns whether check box is selected () or not () ) 1 ##% && &D( 2 ## % 3 * * 5 " 3* 6 " 36"* 7 % * % * 9 % * " * *## %%) 1 " * *### ### 15 " *### ## 1, ,,55 550* (1 of 3) Declare two instance variables 21,,0,0##) 22 Set font of text field 23 ## ) 2 2 5< ) %59 9'H 'H0* 25, 5-)5 5-) &N &N00* 0 26,## ## ## 30,## ## 31, ## Create two es ##%) ##%) 3 A 2 A,0* 35 3, Create event handler 36 3, (2 of 3) 37 ;## Register event handler with 3 es 39 ##" )3" % 0 " A Inner class implements 2 " " 2 31* *## ##) 3 3 " " * *## ) 5 ##" ##" 6 " "- %,36""0 7 + ##" " 9 ) ) " %-, " 2 - % method is called when a is clicked 51 -,0O O ( ( 31* 52 Test whether is selected 7 13

14 53 ## " 5 ) ) " %-, " 3 2 Test source of the event 56 -,0O O 33( ( 31* 79 1 ##% && &G( 2 ##% 3 % * ##)) - method returns 59, whether is selected 60 5-)5 5-)59" 7" 3 9&N &N00* 0 61 ;##- % (3 of 3) ",-% %./ ,0* 62 ;##" A 10 ), 6E3:1:-60* 63 ;## 11 -B,'DF 'DF9 9&HH &HH ##) B 12 C, ## ) 13 ;## 1 ;## K Has two states selected and unselected Normally appear in a group in which only one radio button can be selected at once Group maintained by a object Declares method to add a to group Usually represents mutually exclusive options 1 Common Programming Error 11.3 Adding a object (or an object of any other class that does not derive from ) to a container results in a compilation error. 2 1 ##% && &I( 2 ## % % 3 * * 5 " 3* 6 " 36"* 7 % * % * 9 % * 10 % * (1 of 3) 13 + Declare four s 1 " * *## ) % 15 " *##)) and a to manage 16 " * *##)) them 17 " *##)) 1 " 3 *##)) 19 " *## 20 " *## ## 21 " *## 22 " 3 * *## 23 " *##% 2 25 ## 26, ,,5 5 50* 29,,0##) < ) %59 9'F 'F0* 32,## 33 3 ## 35 2, * 36 2, ) ) 0* 37 2, ) ) 0* 3 3 2,5#3 59 9) ) 0* 39, ## (2 of 3) 0, ## 1, ## Create the four s 2,3 ## 3 ## % 5 2,0*,0*## 6, ## % Create the 7, ## %, ## % 9,3 ## 50 Add each to the 51 ## )! )5 5-) &N &N0* )5 5-) &N &N0* )5 5-) &N &N0* )5 5-) &N &N0* 56, ## ) 57 1

15 5 ##%") 59 3, 60 A, , 62 A,0 63 3, 6 A, , 66 A,3 00* 0 67 ;## 6 69 ##" " 70 " A 3 3 Register an event handler with each " )* )*##) Event handler inner class 73 implements 3 7 A,) )2)*##)) 77 ;## A 7 79 ## " 0 " "- %,36"" ,)##)) 3 ;##- % ;##" A 5 ;## 5 (3 of 3) When radio button is selected, the text field s font will be set to the value passed to the constructor 1 ##% && 'H( 2 ##% 3 % * " ",-% %./ ,0* 10 ), 6E3:1:-60* 11 9&HH &HH ##) B 12 C, ## ) 13 ;## 1 ;## and Using an Anonymous Inner Class for Event Handling Combo box Also called a drop-down list Implemented by class Each item in the list has an index sets the maximum number of rows shown at once provides a scrollbar and up and down arrows to traverse list 7 Look-and-Feel Observation Set the maximum row count for a to a number of rows that prevents the list from expanding outside the bounds of the window in which it is used. This configuration will ensure that the list displays correctly when it is expanded by the user. Using an Anonymous Inner Class for Event Handling Anonymous inner class Special form of inner class Declared without a name Typically appears inside a method call Has limited access to local variables 9 1 ##% && '&( 2 ##>% % 3 * " 3* 5 " 36"* 6 % * 7 % * % * 9 % 3* 10 % 3 %3* " %*## ) 15 " " *## 16 Declare instance 17 " -%./2 variable 1 +5%& %)59 95%' %)59 95 "% %)59 95% %)5;* ;* 19 " 3./2+ 3./ %3,%,0 %,.H/009 / %3,%,0 %,.&/009 / %3,%,0 %,.'/009 / %3,%,0 %,.@/00;* /00;* ## 26, ,,5%5 5%50* 0* 29,,0##) 30 15

16 31 %2 ## ## 32 ## 33 Create and set maximum row count 3 % 3, 35 3, 3,0 0## Create anonymous inner class as ## " the event handler 3 " "- %,36"" Declare method 0 ## ## - % 1 ) )" %- %,02236" ,.. 3 % %-3,0/ Test state change of ; ;##- % 5 ; ;## 6 0*## 3 Method %-3 7 locates selected item, %## 9 2,.H/ /## ) 50, ## 51 ;## 52 ;## 91 1 ##% && ''( 2 ##% 3 % * ",-% %./ ,0* 10 ), 6E3:1:-60* 11 9&FH &FH ##) B 12 C, ## ) 13 ;## 1 ;## 92 Scrollbar to scroll through the items in the list scroll arrows scroll box 93 9 Software Engineering Observation 11.5 Software Engineering Observation 11.6 An anonymous inner class declared in a method can access the instance variables and methods of the top-level class object that declared it, as well as the method s ) local variables, but cannot access the method s non-) variables. Like any other class, when an anonymous inner class implements an interface, the class must implement every method in the interface List Displays a series of items from which the user may select one or more items Implemented by class Allows for single-selection lists or multiple-selection lists A -6" occurs when an item is selected Handled by a - and passed to method " % 95 1 ##% && '@( 2 ##-%) 3 * * 5 % * 6 % * 7 % - * % " -* 9 % " -6"* 10 % -* " * *## 15 " ) - -%1./ % % % <5 5<59 95M5 5M5;* ;* Declare instance variable 1 " )./2+./2+ L9 9 >69 9 M L:M9 9 M A:M L <A M6<;* ;* ## - % 2, ,,55 550* 27,,0##)

17 ## 1 30 C,F ## )" 31 Create 32 ## 33 -,- -316:-66310* 3 35 ## - %) Set selection mode of 36, -, , 39 -,0 -,0## Add to - and 0 + add to application 1 ## " 2 " "" %,-6""0 3 + %,0 %,, 5. %-3,0/0* / 6 ;##" % 7 ;## Get index of selected item ## - 9 ;## 50 ;## 97 1 ##% && 'N( 2 ##-%) 3 % * " ",-% %./ ,0*## 10 ), 6E3:1:-60* 11 9&FH &FH ##) B 12 C, ## ) 13 ;## 1 ;## Multiple-Selection Lists Multiple-selection list Enables users to select many items Single interval selection allows only a continuous range of items Multiple interval selection allows any set of elements to be selected 99 1 ##% && 'F(- 2 ##%) 3 * " * 5 " 6"* 6 % * 7 % * % * 9 % - * 10 % -* " * *## 15 " * *## 16 " * *## 17 " ) -%1./ % 5% % % <5 5<59 95M5 5M5;* ;* (1 of 3) 21 ##- 22 -, ,, * 25,,0##) ## ) 2 C,F ##)" 29 -, 30 - >36:316C:-6631 :-66310* 31, -,0## ## Use a multiple interval selection 32 list PPP5 5PPP5 ## - 3, 35 36,0,0## ## ## " 39 " " ),6"" ## " 2, %-C,0 3 ;## ) ;## 5 ## ## 6 (2 of 3) Use methods and %-C to copy values from one to the other 101 7,## 9 2,0*,0*## 50 C,F ##F Set cell width for presentation 51 <,&HH &HH ## ## 52 A%,&F &F ##% ##% 53 -, Set cell height for presentation :316C:-66310* 55, -,0## (3 of 3) 56 ;##- Set selection model to single 57 ;## - interval selection

18 1 ##% && '?(- 2 ##%- 3 % * " ",-% %./ ,0* 11 - ), 12 6E3:1:-60* &NH &NH ##) B 1 - C, ## ) 15 ;## 16 ;## Mouse Event Handling Mouse events Create a 6" object Handled by s and s 3 combines the two interfaces Interface < declares method <" to handle <6"s MouseListener and MouseMotionListener interface methods Methods of interface "6""0 Called when a mouse button is pressed while the mouse cursor is on a component. "6""0 "0 Called when a mouse button is pressed and released while the mouse cursor remains stationary on a component. This event is always preceded by a call to. ",6""0 Called when a mouse button is released after being pressed. This event is always preceded by a call to and one or more calls to %%. "6,6""0 Called when the mouse cursor enters the bounds of a component. MouseListener and MouseMotionListener interface methods "6,6""0 Called when the mouse cursor leaves the bounds of a component. Methods of interface " %%,6""0 Called when the mouse button is pressed while the mouse cursor is on a component and the mouse is moved while the mouse button remains pressed. This event is always preceded by a call to. All drag events are sent to the component on which the user began to drag the mouse. "",6""0 Called when the mouse is moved when the mouse cursor is on a component. All move events are sent to the component over which the mouse is currently positioned. Fig and interface methods. (Part 1 of 2.) Fig and interface methods. (Part 2 of 2.) Look-and-Feel Observation Method calls to %% and are sent to the for the on which a mouse drag operation started. Similarly, the mousereleased method call at the end of a drag operation is sent to the for the on which the drag operation started ##% && 'G( 2 ## %" 3 * * 5 " * 6 " * 7 " 6"* 6"* % * 9 % * 10 % * " *## " 15 " *## ") ## >3 1 ##%" 19, ,,5 %6"5 50* ,0*## 2 %, <A36 ## % 25, ## Create and add to 26 application 27 2,5 50* 0* 2, 9 ->A0* ## ## 29 (1 of ) Create to capture mouse events Set background to white 10 1

19 30 ## %) " 31 A 2 A,0* 32, 33, Create event handler for mouse events 3 ;## 35 Register event handler 36 " A ##" 0 ## " ) (2 of ) 1 " "6""0 6""0 2 + Declare method 3,-% ),5.J9J/59 9 " " %E,09" %M,000* 0 5 ;## 6 Implement mouse listener interfaces Find location of mouse click ## " 62 " "6,6""0 6,6"" Declare 6 method 6,-% ),5.J9J/ " %E,09" %M,000* 0 66 %, 6610* 67 ;##6 Set background of 6 (3 of ) 69 ## " 70 " "6,6""0 6,6"" Declare 6 method 72,5 5 50* 73 %, <A360* 7 ;##6 Set background of ## " " "6""0 6""0 9 + Declare method 50,-% ),5.J9J/5 / " %E,09" %M,000* 0 52 ;## 53 5 ## " ) %%% 55 " ",6""0 Declare ,-% ),5.J9J/59 method 9 5 " %E,09 9" %M,000* 0 59 ;## 76 ##" 77 ## " % 7 " " %%,6"" Declare %% method 0,-% ),5 %%.J9J/59 1 " %E,09" %M,000* 0 2 ;## %% 3 ## "" ( of ) 5 " "",6""0 ",6""0 6 + Declare " method 7,-% ),5".J9J/59 9 " %E,09" %M,000* 0 9 ;##" 90 ;## A 91 ;## ##% && 'I( 2 ##% 3 % * " ",-% %./ ,0* 10 ), 6E3:1:-60* 11 9&HH &HH ##) B 12 C, ## ) 13 ;## 1 ;## Adapter Classes 11 Adapter class Implements event listener interface Provides default implementation for all event-handling methods 19

20 Software Engineering Observation 11.7 When a class implements an interface, the class has an is a relationship with that interface. All direct and indirect subclasses of that class inherit this interface. Thus, an object of a class that extends an event-adapter class is an object of the corresponding event-listener type (e.g., an object of a subclass of is a ). 115 Extending K Adapter class for and interfaces Extending class allows you to override only the methods you wish to use Common Programming Error 11. If you extend an adapter class and misspell the name of the method you are overriding, your method simply becomes another method in the class. This is a logic error that is difficult to detect, since the program will call the empty version of the method inherited from the adapter class. Event-adapter class in " Implements interface L L < < Fig Event-adapter classes and the interfaces they implement in package ". 1 ##% 2 ## % %% 3 * * 5 " * 6 " 6"* * 7 % * % * " -% *##-%% 13 " *## ) 1 15 ## -% % 16, ,,5 50* ## " 26 " A ## " 29 " "6""0 6"" " %E,0*##%) 32 2" %M,0*##%) % ),5J,05 5J, " %,00* Get number of times mouse button 36 was clicked 37 ) ) ",00 0##% 3 725%5 5%5* Test for right mouse button 39 ) ) ",00 0## * Test for middle mouse button 1 ##) ##) 2 725)5 5)5* ,55 550* 21, 9 ->A0* 22, A,0## 23 ;## ## Register event handler 2, ## % 5 ;## 6 ;##" A 7 ;## 20

21 1 ##% 2 ##% 3 % * " ",-% %./ ,0* 10 ), 6E3:1:-60* 11 -B,NHH NHH9 9&FH &FH ##) B 12 C, ## ) 13 ;## 1 ;## Subclass for Drawing with the Mouse Overriding class Provides a dedicated drawing area 36" method Description,0,0 Returns when the user clicks the right mouse button on a mouse with two or three buttons. To simulate a right-mousebutton click on a one-button mouse, the user can hold down the Meta key on the keyboard and click the mouse button. Returns when the user clicks the middle mouse button on a mouse with three buttons. To simulate a middle-mousebutton click on a one- or two-button mouse, the user can press the Alt key on the keyboard and click the only- or left-mouse button, respectively. Fig " methods that help distinguish among left-, center- and right-mouse-button clicks Method Method Draws on a Swing component Overriding method allows you to create custom drawings Must call superclass method first when overridden Look-and-Feel Observation Most Swing GUI components can be transparent or opaque. If a Swing GUI component is opaque, its background will be cleared when its method is called. Only opaque components can display a customized background color. objects are opaque by default. 21

22 Error-Prevention Tip 11.1 In a subclass s method, the first statement should always be a call to the superclass s method to ensure that an object of the subclass displays correctly. Common Programming Error 11.5 If an overridden method does not call the superclass s version, the subclass component may not display properly. If an overridden method calls the superclass s version after other drawing is performed, the drawing will be erased. Defining the Custom Drawing Area Customized subclass of Provides custom drawing area Class is used to draw on Swing components Class represents an x-y coordinate ##% 2 ##>% 3 * * 5 " 6"* 6 " * 7 % * " 2 2H* *##) ## )&HHHH ) 1 "./2./2..&HHHH &HHHH/* /* 15 Create array of s 16 ##>3 %" 17, ## ) " 20, ,0## ## % Anonymous inner class for event handling 25 " " %%,6"" Override %% method 27 ) )Q % /2" /2" %,0*##) 30 77* 77*##) 31,0*## Get location of mouse cursor 32 ; ;##) ##) 33 ;## ## %% 3 ;## Repaint the 35 ## 36 ;## 37 3 ## " NR RN% ) 39 " ", % ,%## % 2 3 ## ) ) 2 2H*Q*770 *Q*770 5 % )",./ 9./ 9 9N9 9N0* 6 ;## ## 7 ;## Get the x and y-coordinates of the 131 Look-and-Feel Observation 11.1 Calling for a Swing GUI component indicates that the component should be refreshed on the screen as soon as possible. The background of the GUI component is cleared only if the component is opaque. method S can be passed a argument indicating whether the component is opaque ( ) or transparent ()) )

23 Look-and-Feel Observation Drawing on any GUI component is performed with coordinates that are measured from the upper-left corner (0, 0) of that GUI component, not the upper-left corner of the screen ##% 2 ##% 3 * % * 5 % * ",-% %./ ## ## 12 2,5 % 50* ,0*## 15, ## 16 Create instance of custom drawing 17 ## ->A) panel 1,,5 % >A0* ), 6E3:1:-60* 22 -B,NHH NHH9 9'HH 'HH ##) B 23 C, ## ) 2 ;## ## 25 ;## Key-Event Handling 136 KL interface For handling L6"s Declares methods, and 1 ##% 2 ## %" 3 * " L* 5 " L6"* 6 % * 7 % * * L ## ) 31 " "L6""0 L6"" &2-% ),5L(J5 5L(J59 9 Declare method 3 " %L," %L,000* ## ## 35 ## Get code of pressed key L 36 ;## L L L (1 of 3) " -%&2 -%&255 55* *##)) 12 " -%'2 -%'255 55* *##) Implement L 13 " -%@2 -%@255 55* *##) interface 1 " *## ##L 17 L,0 1 + Set background color 19,,5 %L6"50* ,&H &H9 9&F &F ## ## 22,5 50* ,) ) ## Register application as event 2, L ## handler for itself 25, ## 26 3 ## ) (2 of 3) 39 " ",L6""0 0 + Declare method 1 &2-% ),5L (J59 2 " %L," %L,00 ## 3 Get code of released key ;## 5 6 ## ) Declare method 7 " "L6""0 L6""0 + 9 &2-% ),5L(J5 5L(J59 9" %L,00* ;## 52 Get character typed 27 L, ## ) " 2 ;##L 29 23

24 53 ## ) 5 " " ##% 2 ##%L 3 % * '2-% ),5J " L,0O O55 55( ( * 0 Test if it was an action key 5 L 59 -% -%2" %L)," %),0 60 Determine any modifiers pressed ),5)(J5 5)(J59 9 (3 of 3) 5 L L " ",-% %./0 + 9 L 2 L,0* L 62 S,55 550O 0O55 55(0 (0##) 10 ), 6E3:1:-60* &HH &HH ##) B 6,-% ),5J 5JTJ JTJ JT C, 0* ## ## ) 65 &9'9@0##) ##) 13 ;## ## 66 1 ;## L 67 ;## L Layout Managers 12 L Layout managers Provided to arrange GUI components in a container Provide basic layout capabilities Implement the interface % 13 1 Look-and-Feel Observation Most Java programming environments provide GUI design tools that help a programmer graphically design a GUI; the design tools then write the Java code to create the GUI. Such tools often provide greater control over the size, position and alignment of GUI components than do the built-in layout managers. Look-and-Feel Observation It is possible to set a s layout to, which indicates that no layout manager should be used. In a without a layout manager, the programmer must position and size the components in the given container and take care that, on resize events, all components are repositioned as necessary. A component s resize events can be processed by a. 2

25 K Simplest layout manager Components are placed left to right in the order they are added Components can be left aligned, centered or right aligned Layout manager Description Default for %. Places components sequentially (left to right) in the order they were added. It is also possible to specify the order of the components by using the method, which takes a and an integer index position as arguments. Default for s (and other windows). Arranges the components into five areas: 1A, ->A, 6-, <6- and 616. Arranges the components into rows and columns. Fig Layout managers. 1 ##% 2 ## % % 3 * * 5 " * 6 " 6"* 7 % * % * " )* )*## %) 13 " * *## % 1 " %* %*## %% 15 " *##! 16 " *## 17 1 ##>3 % 19, ,,5 50* 22 Create 23 2,0*## 2 2%,0*##% 25, ##) 26 Set layout of application (1 of 3) ##) % 2 )2 5)5 5)5 ## ) 29,)## )) 30 ), Add ; 31 will handle placement 32,0,0## ##)" 35 " " ),6""0 (2 of 3) %, 60* 3 Set alignment to left 39 ## % 0, 1 ;## ) 2 ;## Adjust layout 3 ## 5 ## % ## 7,## ), Add ; 9 50,0,0## will handle placement ##" 53 " " ),6""0 Set alignment to center %, 6160* ## % 5, 59 ;## ) 60 ;## 61 ## ##% % 6 %2, 5%5 5%5 ## % Adjust layout 65,%## %) (3 of 3) 66 %, Add ; 67 6,0,0## will handle placement ##%" 71 " " ),6"" %, 3A0* 7 Set alignment to right 75 ## % 76, 77 ;## ) 7 ;## Adjust layout 79 ## 0 ;## ## 1 ;## 19 1 ##% && NH( 2 ##% 3 % * " ",-% %./0 + 9 ) 2,0* 10 ) ), 6E3:1:-60* 11 ) 9DF DF ##) B 12 ) C, ## ) 13 ;## 1 ;## ##

26 K Arranges components into five regions north, south, east, west and center Implements interface %' Provides horizontal gap spacing and vertical gap spacing Look-and-Feel Observation 11.1 Each container can have only one layout manager. Separate containers in the same application can use different layout managers. Look-and-Feel Observation If no region is specified when adding a to a, the layout manager assumes that the should be added to region 616. Common Programming Error 11.6 When more than one component is added to a region in a, only the last component added to that region will be displayed. There is no error that indicates this problem ##% && N&( 2 ## % 3 * " * 5 " 6"* 6 % * 7 % * "./*./*## ) 12 " ) -%./2+5A15 5A159 95A-5 5A A A 5A<5 <59 95A5 5A5;* ;* 1 " *##! 15 Declare instance 16 ##>3 " % variable 17, ,,5 50* ,F9 9F ##F% Set layout 22, ##) %/*##B) 2 25 ## %) 26 ) ) 2 2H*Q %* Register event handler 2./2./ 29./, 0* 30 ;##) Create

27 31 32,.H/9 /9 1A ## 33,.&/9 /9 ->A ## 3,.'/9 /9 6- ## /9 <6-0*## 36,.N/9 /9 616 ## 37 ;## Add buttons to application using 3 39 ## " layout manager constants 0 " " ),6""0 6"" ##" % 3 ) ) (0 (0 Make button invisible + 5 ) )" %-, C,) ) ## ## Make button visible 7 C, 0* ## ## 9 ;##) ##% && N'( 2 ##% 3 % * " ",-% %./ ,0* 10 ), 6E3:1:-60* 11 9'HH 'HH ##) B 12 C, ## ) 13 ;## ## 1 ;## horizontal gap vertical gap 15 51,%,0## 52 ;## ) Update layout 53 ;## K Divides container into a grid Every component has the same width and height 1 ##% && N@( 2 ## % 3 * * 5 " * 6 " 6"* 7 % * % * "./*./*## ) 13 " ) -%./ )5 5)59 95)"5 5)" ;* ;* Declare two 15 " %%2 %%2 * *##%% instance variables 16 " *##) 17 " % &*##)% 1 " % '*##% ##R % 21,0 Create ,,5 50* 2 % &2,'9 9@9 9F9 9F ##'@*% )F 25 % '2,@9 9' ##@ ##@'*% 26 2%,0*##% 27,% &## 2 2. %/*## ) Set layout ) ) 2 2H*Q %* /2./ 33./, ##% 3,./ *## 35 ;##) Add button to 36 ;## 37 3 ## "%%% 39 " " ),6""0 0 + Use second layout 1 ) )%%0 %%0 2,% '## Use first layout 3,% &## ) 5 6 %%2U%%*##%%" 7 ",0*## ##R ;## ) Update layout 9 ;##

28 1 ##% && NN( 2 ##% 3 % * ",-% %./0 + 9 % 2,0* 10 % ), 6E3:1:-60* 11 % 9'HH 'HH ##) B Using Panels to Manage More Complex Layouts Complex GUIs often require multiple panels to arrange their components properly % C, ## ) 13 ;## 1 ;## ## 1 ##% && NF( ##>% 3 * * 5 % * 6 % * 7 % * " *## 12 "./*./*## ) Declare a to hold buttons 13 1 ##R % 15, Create 17,,5 50* 1 2..F/* /*## 19 2,0*## 20,,&9 %0 21 Set layout 22 ## 23 ) ) 2 2H*Q %* / &00* 0 26,./## 27 ;##) ##) 2 Add button to panel 29, 9 ->A ## 30 ;## Add panel to application 31 ;## ##% && N?( 2 ##% 3 % * " ",-% %./ ,0* 10 ), 6E3:1:-60* 11 -B,NFH NFH9 9'HH 'HH ##) B 12 C, ## ) 13 ;## 1 ;## K Provides an area for manipulating multiple lines of text K container Subclass of Uses a layout manager 16 2

29 Look-and-Feel Observation To provide line-wrapping functionality for a, invoke method R < with a argument ##% && ND( 2 ##%) 3 " * " 6"* 5 % * 6 % * 7 % * * % * 9 % - * " &*## % 1 " '*## ##%% 15 " * *## %) 16 Declare instance variables ##R % 1, ,, AB,0*## 22 -%25 %T %T) ) T Create text area and add to box % T "T5 5* 25 Create a container 26 &2,9 9&H &H9 9&F &F ## & 27, -, &0## PPP5 5PPP5 ## 30,## 31, 32 33,0,0## ## ') & 36 " " ),6"" ', & %-,0 39 ;## ## ) 0 ;## 1 ## 2 3 '2,&H &H9 9&F &F ## ' 6,) ) ## % % 5, -, '0## 6 7,## ) ;## 9 ;## Add button to box Copy selected text from one text area to the other Create second text area and add it to box ##% && NG( 2 ##%) 3 % * " ",-% %./ ,0* 10 ), 6E3:1:-60* 11 -B,N'F N'F9 9'HH 'HH ##) B 12 C, ## ) 13 ;## ## 1 ;## Scrollbar Policies 17 K- has scrollbar policies Horizontal policies Always (A3V1:-:<M-) As needed (A3V1:-:-:1666) Never (A3V1:-:16C6) Vertical policies Always (C63:-:<M-) As needed (C63:-:-:1666) Never (C63:-:16C6) 29

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7 PROGRAMMING DESIGN USING JAVA (ITT 303) Graphical User Interface Unit 7 Learning Objectives At the end of this unit students should be able to: Build graphical user interfaces Create and manipulate buttons,

More information

BASICS OF GRAPHICAL APPS

BASICS OF GRAPHICAL APPS CSC 2014 Java Bootcamp Lecture 7 GUI Design BASICS OF GRAPHICAL APPS 2 Graphical Applications So far we ve focused on command-line applications, which interact with the user using simple text prompts In

More information

Sri Vidya College of Engineering & Technology

Sri Vidya College of Engineering & Technology UNIT-V TWO MARKS QUESTION & ANSWER 1. What is the difference between the Font and FontMetrics class? Font class is used to set or retrieve the screen fonts.the Font class maps the characters of the language

More information

All the Swing components start with J. The hierarchy diagram is shown below. JComponent is the base class.

All the Swing components start with J. The hierarchy diagram is shown below. JComponent is the base class. Q1. If you add a component to the CENTER of a border layout, which directions will the component stretch? A1. The component will stretch both horizontally and vertically. It will occupy the whole space

More information

Starting Out with Java: From Control Structures Through Objects Sixth Edition

Starting Out with Java: From Control Structures Through Objects Sixth Edition Starting Out with Java: From Control Structures Through Objects Sixth Edition Chapter 12 A First Look at GUI Applications Chapter Topics 12.1 Introduction 12.2 Creating Windows 12.3 Equipping GUI Classes

More information

CS111: PROGRAMMING LANGUAGE II

CS111: PROGRAMMING LANGUAGE II CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 10(b): Working with Controls Agenda 2 Case study: TextFields and Labels Combo Boxes buttons List manipulation Radio buttons and checkboxes

More information

Introduction to the JAVA UI classes Advanced HCI IAT351

Introduction to the JAVA UI classes Advanced HCI IAT351 Introduction to the JAVA UI classes Advanced HCI IAT351 Week 3 Lecture 1 17.09.2012 Lyn Bartram lyn@sfu.ca About JFC and Swing JFC Java TM Foundation Classes Encompass a group of features for constructing

More information

Graphical User Interface (GUI)

Graphical User Interface (GUI) Graphical User Interface (GUI) An example of Inheritance and Sub-Typing 1 Java GUI Portability Problem Java loves the idea that your code produces the same results on any machine The underlying hardware

More information

GUI Basics. Object Orientated Programming in Java. Benjamin Kenwright

GUI Basics. Object Orientated Programming in Java. Benjamin Kenwright GUI Basics Object Orientated Programming in Java Benjamin Kenwright Outline Essential Graphical User Interface (GUI) Concepts Libraries, Implementation, Mechanics,.. Abstract Windowing Toolkit (AWT) Java

More information

This page intentionally left blank

This page intentionally left blank This page intentionally left blank arting Out with Java: From Control Structures through Objects International Edition - PDF - PDF - PDF Cover Contents Preface Chapter 1 Introduction to Computers and Java

More information

Objective Questions. BCA Part III Paper XIX (Java Programming) page 1 of 5

Objective Questions. BCA Part III Paper XIX (Java Programming) page 1 of 5 Objective Questions BCA Part III page 1 of 5 1. Java is purely object oriented and provides - a. Abstraction, inheritance b. Encapsulation, polymorphism c. Abstraction, polymorphism d. All of the above

More information

Outline. Topic 9: Swing. GUIs Up to now: line-by-line programs: computer displays text user types text AWT. A. Basics

Outline. Topic 9: Swing. GUIs Up to now: line-by-line programs: computer displays text user types text AWT. A. Basics Topic 9: Swing Outline Swing = Java's GUI library Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 7: Expand moving shapes from Assignment 4 into game. "Programming

More information

Graphical Applications

Graphical Applications Graphical Applications The example programs we've explored thus far have been text-based They are called command-line applications, which interact with the user using simple text prompts Let's examine

More information

Recommended GUI Design Standards

Recommended GUI Design Standards Recommended GUI Design Standards Page 1 Layout and Organization of Your User Interface Organize the user interface so that the information follows either vertically or horizontally, with the most important

More information

Topic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more

Topic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 5: Will be an open-ended Swing project. "Programming Contest"

More information

Topic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun!

Topic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun! Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Why are we studying Swing? 1. Useful & fun! 2. Good application of OOP techniques

More information

12/22/11. Copyright by Pearson Education, Inc. All Rights Reserved.

12/22/11. Copyright by Pearson Education, Inc. All Rights Reserved. } Radio buttons (declared with class JRadioButton) are similar to checkboxes in that they have two states selected and not selected (also called deselected). } Radio buttons normally appear as a group

More information

Graphical User Interface (GUI)

Graphical User Interface (GUI) Graphical User Interface (GUI) An example of Inheritance and Sub-Typing 1 Java GUI Portability Problem Java loves the idea that your code produces the same results on any machine The underlying hardware

More information

GUI Event Handlers (Part I)

GUI Event Handlers (Part I) GUI Event Handlers (Part I) 188230 Advanced Computer Programming Asst. Prof. Dr. Kanda Runapongsa Saikaew (krunapon@kku.ac.th) Department of Computer Engineering Khon Kaen University 1 Agenda General event

More information

5. In JAVA, is exception handling implicit or explicit or both. Explain with the help of example java programs. [16]

5. In JAVA, is exception handling implicit or explicit or both. Explain with the help of example java programs. [16] Code No: R05220402 Set No. 1 1. (a) java is freeform language. Comment (b) Describe in detail the steps involved in implementing a stand-alone program. (c) What are command line arguments? How are they

More information

Widgets. Overview. Widget. Widgets Widget toolkits Lightweight vs. heavyweight widgets Swing Widget Demo

Widgets. Overview. Widget. Widgets Widget toolkits Lightweight vs. heavyweight widgets Swing Widget Demo Widgets Overview Widgets Widget toolkits Lightweight vs. heavyweight widgets Swing Widget Demo Widget Widget is a generic name for parts of an interface that have their own behavior: buttons, progress

More information

Solo 4.6 Release Notes

Solo 4.6 Release Notes June9, 2017 (Updated to include Solo 4.6.4 changes) Solo 4.6 Release Notes This release contains a number of new features, as well as enhancements to the user interface and overall performance. Together

More information

Event Dispatch. Interactor Tree Lightweight vs. Heavyweight Positional Dispatch Focus Dispatch. Event Architecture. A pipeline: Event Capture

Event Dispatch. Interactor Tree Lightweight vs. Heavyweight Positional Dispatch Focus Dispatch. Event Architecture. A pipeline: Event Capture Event Dispatch Interactor Tree Lightweight vs. Heavyweight Positional Dispatch Focus Dispatch 2.4 Event Dispatch 1 Event Architecture A pipeline: - Capture and Queue low-level hardware events - Dispatch

More information

Event Dispatch. Interactor Tree Lightweight vs. Heavyweight Positional Dispatch Focus Dispatch. 2.4 Event Dispatch 1

Event Dispatch. Interactor Tree Lightweight vs. Heavyweight Positional Dispatch Focus Dispatch. 2.4 Event Dispatch 1 Event Dispatch Interactor Tree Lightweight vs. Heavyweight Positional Dispatch Focus Dispatch 2.4 Event Dispatch 1 Event Architecture A pipeline: - Capture and Queue low-level hardware events - Dispatch

More information

Microsoft How to Series

Microsoft How to Series Microsoft How to Series Getting Started with EXCEL 2007 A B C D E F Tabs Introduction to the Excel 2007 Interface The Excel 2007 Interface is comprised of several elements, with four main parts: Office

More information

SIMPLE TEXT LAYOUT FOR COREL DRAW. When you start Corel Draw, you will see the following welcome screen.

SIMPLE TEXT LAYOUT FOR COREL DRAW. When you start Corel Draw, you will see the following welcome screen. SIMPLE TEXT LAYOUT FOR COREL DRAW When you start Corel Draw, you will see the following welcome screen. A. Start a new job by left clicking New Graphic. B. Place your mouse cursor over the page width box.

More information

Word Creating & Using Tables. IT Training & Development (818) Information Technology

Word Creating & Using Tables. IT Training & Development (818) Information Technology Information Technology Word 2007 User Guide Word 2007 Creating & Using Tables IT Training & Development (818) 677-1700 training@csun.edu www.csun.edu/it/training Table of Contents Introduction... 1 Anatomy

More information

CS11 Java. Fall Lecture 4

CS11 Java. Fall Lecture 4 CS11 Java Fall 2006-2007 Lecture 4 Today s Topics Interfaces The Swing API Event Handlers Inner Classes Arrays Java Interfaces Classes can only have one parent class No multiple inheritance in Java! By

More information

MyProgram m i ng Lab. get with the programming. Through the power of practice and immediate personalized

MyProgram m i ng Lab. get with the programming. Through the power of practice and immediate personalized get with the programming Through the power of practice and immediate personalized feedback, MyProgrammingLab improves your performance. MyProgram m i ng Lab Learn more at www.myprogramminglab.com Preface

More information

Figure 1 Forms category in the Insert panel. You set up a form by inserting it and configuring options through the Properties panel.

Figure 1 Forms category in the Insert panel. You set up a form by inserting it and configuring options through the Properties panel. Adobe Dreamweaver CS6 Project 3 guide How to create forms You can use forms to interact with or gather information from site visitors. With forms, visitors can provide feedback, sign a guest book, take

More information

Packages: Putting Classes Together

Packages: Putting Classes Together Packages: Putting Classes Together 1 Introduction 2 The main feature of OOP is its ability to support the reuse of code: Extending the classes (via inheritance) Extending interfaces The features in basic

More information

Widget. Widget is a generic name for parts of an interface that have their own behaviour. e.g., buttons, progress bars, sliders, drop-down

Widget. Widget is a generic name for parts of an interface that have their own behaviour. e.g., buttons, progress bars, sliders, drop-down Widgets Jeff Avery Widget Widget is a generic name for parts of an interface that have their own behaviour. e.g., buttons, progress bars, sliders, drop-down menus, spinners, file dialog boxes, etc are

More information

Introduction to Microsoft Excel 2010

Introduction to Microsoft Excel 2010 Introduction to Microsoft Excel 2010 This class is designed to cover the following basics: What you can do with Excel Excel Ribbon Moving and selecting cells Formatting cells Adding Worksheets, Rows and

More information

Labels and Envelopes in Word 2013

Labels and Envelopes in Word 2013 Labels and Envelopes in Word 2013 Labels... 2 Labels - A Blank Page... 2 Selecting the Label Type... 2 Creating the Label Document... 2 Labels - A Page of the Same... 3 Printing to a Specific Label on

More information

Think of layers as a stack of transparencies. Layers can be changed independently of other layers by clicking on its name in the layers palette.

Think of layers as a stack of transparencies. Layers can be changed independently of other layers by clicking on its name in the layers palette. Layer Techniques Think of layers as a stack of transparencies. Layers can be changed independently of other layers by clicking on its name in the layers palette. Reviewing the Layers Palette: A: Show/Hide

More information

Sample Chapters. To learn more about this book, visit the detail page at: go.microsoft.com/fwlink/?linkid=192147

Sample Chapters. To learn more about this book, visit the detail page at: go.microsoft.com/fwlink/?linkid=192147 Sample Chapters Copyright 2010 by Online Training Solutions, Inc. All rights reserved. To learn more about this book, visit the detail page at: go.microsoft.com/fwlink/?linkid=192147 Chapter at a Glance

More information

Control Flow: Overview CSE3461. An Example of Sequential Control. Control Flow: Revisited. Control Flow Paradigms: Reacting to the User

Control Flow: Overview CSE3461. An Example of Sequential Control. Control Flow: Revisited. Control Flow Paradigms: Reacting to the User CSE3461 Control Flow Paradigms: Reacting to the User Control Flow: Overview Definition of control flow: The sequence of execution of instructions in a program. Control flow is determined at run time by

More information

Working with Tables in Microsoft Word

Working with Tables in Microsoft Word Working with Tables in Microsoft Word Microsoft Word offers a number of ways to make a table. The best way depends on how you like to work, and on how simple or complex the table needs to be. 1. Click

More information

Center for Faculty Development and Support Making Documents Accessible

Center for Faculty Development and Support Making Documents Accessible Center for Faculty Development and Support Making Documents Accessible in Word 2007 Tutorial CONTENTS Create a New Document and Set Up a Document Map... 3 Apply Styles... 4 Modify Styles... 5 Use Table

More information

Windows and Events. created originally by Brian Bailey

Windows and Events. created originally by Brian Bailey Windows and Events created originally by Brian Bailey Announcements Review next time Midterm next Friday UI Architecture Applications UI Builders and Runtimes Frameworks Toolkits Windowing System Operating

More information

Frames, GUI and events. Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling

Frames, GUI and events. Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling Frames, GUI and events Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling Introduction to Swing The Java AWT (Abstract Window Toolkit)

More information

SILVACO. An Intuitive Front-End to Effective and Efficient Schematic Capture Design INSIDE. Introduction. Concepts of Scholar Schematic Capture

SILVACO. An Intuitive Front-End to Effective and Efficient Schematic Capture Design INSIDE. Introduction. Concepts of Scholar Schematic Capture TCAD Driven CAD A Journal for CAD/CAE Engineers Introduction In our previous publication ("Scholar: An Enhanced Multi-Platform Schematic Capture", Simulation Standard, Vol.10, Number 9, September 1999)

More information

WEEK NO. 12 MICROSOFT EXCEL 2007

WEEK NO. 12 MICROSOFT EXCEL 2007 WEEK NO. 12 MICROSOFT EXCEL 2007 LESSONS OVERVIEW: GOODBYE CALCULATORS, HELLO SPREADSHEET! 1. The Excel Environment 2. Starting A Workbook 3. Modifying Columns, Rows, & Cells 4. Working with Worksheets

More information

GUI Programming. Chapter. A Fresh Graduate s Guide to Software Development Tools and Technologies

GUI Programming. Chapter. A Fresh Graduate s Guide to Software Development Tools and Technologies A Fresh Graduate s Guide to Software Development Tools and Technologies Chapter 12 GUI Programming CHAPTER AUTHORS Ang Ming You Ching Sieh Yuan Francis Tam Pua Xuan Zhan Software Development Tools and

More information

Chapter 4: Single Table Form Lab

Chapter 4: Single Table Form Lab Chapter 4: Single Table Form Lab Learning Objectives This chapter provides practice with creating forms for individual tables in Access 2003. After this chapter, you should have acquired the knowledge

More information

Command-Line Applications. GUI Libraries GUI-related classes are defined primarily in the java.awt and the javax.swing packages.

Command-Line Applications. GUI Libraries GUI-related classes are defined primarily in the java.awt and the javax.swing packages. 1 CS257 Computer Science I Kevin Sahr, PhD Lecture 14: Graphical User Interfaces Command-Line Applications 2 The programs we've explored thus far have been text-based applications A Java application is

More information

Graphical User Interfaces (GUIs)

Graphical User Interfaces (GUIs) CMSC 132: Object-Oriented Programming II Graphical User Interfaces (GUIs) Department of Computer Science University of Maryland, College Park Model-View-Controller (MVC) Model for GUI programming (Xerox

More information

The figure below shows the Dreamweaver Interface.

The figure below shows the Dreamweaver Interface. Dreamweaver Interface Dreamweaver Interface In this section you will learn about the interface of Dreamweaver. You will also learn about the various panels and properties of Dreamweaver. The Macromedia

More information

Microsoft Excel Office 2016/2013/2010/2007 Tips and Tricks

Microsoft Excel Office 2016/2013/2010/2007 Tips and Tricks Microsoft Excel Office 2016/2013/2010/2007 Tips and Tricks In Office 2007, the OFFICE BUTTON is the symbol at the top left of the screen. 1 Enter Fractions That Will Display And Calculate Properly a. Type

More information

Getting Familiar with Microsoft Word 2010 for Windows

Getting Familiar with Microsoft Word 2010 for Windows Lesson 1: Getting Familiar with Microsoft Word 2010 for Windows Microsoft Word is a word processing software package. You can use it to type letters, reports, and other documents. This tutorial teaches

More information

OrgPublisher Advanced Box Layout Editor

OrgPublisher Advanced Box Layout Editor OrgPublisher Advanced Box Layout Editor OrgPublisher Table of Contents Table of Contents... 3 Using the... 3 Arranging Chart Box Sections... 3 Sizing the Chart Box Section... 4 Moving, Deleting, or Resizing

More information

Introduction to Microsoft Excel 2010

Introduction to Microsoft Excel 2010 Introduction to Microsoft Excel 2010 This class is designed to cover the following basics: What you can do with Excel Excel Ribbon Moving and selecting cells Formatting cells Adding Worksheets, Rows and

More information

SAS Visual Analytics 8.2: Working with Report Content

SAS Visual Analytics 8.2: Working with Report Content SAS Visual Analytics 8.2: Working with Report Content About Objects After selecting your data source and data items, add one or more objects to display the results. SAS Visual Analytics provides objects

More information

Tabs, Tables & Columns

Tabs, Tables & Columns Tabs, Tables & Columns What we will cover Creating tables Formatting tables Sorting information in tables Using columns Using tabs Tables You can insert a table several: Insert Table button This will open

More information

Starting Excel application

Starting Excel application MICROSOFT EXCEL 1 2 Microsoft Excel: is a special office program used to apply mathematical operations according to reading a cell automatically, just click on it. It is called electronic tables Starting

More information

CS11 Java. Fall Lecture 3

CS11 Java. Fall Lecture 3 CS11 Java Fall 2014-2015 Lecture 3 Today s Topics! Class inheritance! Abstract classes! Polymorphism! Introduction to Swing API and event-handling! Nested and inner classes Class Inheritance! A third of

More information

Event Dispatch. Dispatching events to windows and widgets.

Event Dispatch. Dispatching events to windows and widgets. Event Dispatch Dispatching events to windows and widgets. Review: Event Architecture 2 Event capture, processing and dispatch. Event Capture Hardware events (interrupts) Event Dispatch Software events

More information

GUI: Racket Graphical Interface Toolkit

GUI: Racket Graphical Interface Toolkit GUI: Racket Graphical Interface Toolkit Version 5.1.1 Matthew Flatt, Robert Bruce Findler, and John Clements April 30, 2011 (require racket/gui/base) The racket/gui/base library provides all of the class,

More information

Microsoft Office Word 2016 for Mac

Microsoft Office Word 2016 for Mac Microsoft Office Word 2016 for Mac Formatting Your Document University Information Technology Services Learning Technologies, Training & Audiovisual Outreach Copyright 2016 KSU Division of University Information

More information

WORD XP/2002 USER GUIDE. Task- Formatting a Document in Word 2002

WORD XP/2002 USER GUIDE. Task- Formatting a Document in Word 2002 University of Arizona Information Commons Training Page 1 of 21 WORD XP/2002 USER GUIDE Task- Formatting a Document in Word 2002 OBJECTIVES: At the end of this course students will have a basic understanding

More information

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Course Overview This course teaches programmers the skills necessary to create Java programming system applications and satisfies the

More information

Beyond 20/20. Browser - English. Version 7.0, SP3

Beyond 20/20. Browser - English. Version 7.0, SP3 Beyond 20/20 Browser - English Version 7.0, SP3 Notice of Copyright Beyond 20/20 Desktop Browser Version 7.0, SP3 Copyright 1992-2006 Beyond 20/20 Inc. All rights reserved. This document forms part of

More information

CounselLink Reporting. Designer

CounselLink Reporting. Designer CounselLink Reporting Designer Contents Overview... 1 Introduction to the Document Editor... 2 Create a new document:... 2 Document Templates... 3 Datasets... 3 Document Structure... 3 Layout Area... 4

More information

Bridgeware Systems War Board Documentation

Bridgeware Systems War Board Documentation Introduction Temps Plus War Board Help Bridgeware Systems War Board Documentation Version date 2/3/2006 WarBoard.chm Version 4 Please visit www.bridgeware.net/webhelp for ideas, examples, and further education

More information

Access: Printing Data with Reports

Access: Printing Data with Reports Access: Printing Data with Reports Reports are a means for displaying and summarizing data from tables or queries. While forms are primarily for on-screen viewing, reports are for presenting your data

More information

Word 3 Microsoft Word 2013

Word 3 Microsoft Word 2013 Word 3 Microsoft Word 2013 Mercer County Library System Brian M. Hughes, County Executive Action Technique 1. Insert a Text Box 1. Click the Insert tab on the Ribbon. 2. Then click on Text Box in the Text

More information

Excel 2013 Intermediate

Excel 2013 Intermediate Excel 2013 Intermediate Quick Access Toolbar... 1 Customizing Excel... 2 Keyboard Shortcuts... 2 Navigating the Spreadsheet... 2 Status Bar... 3 Worksheets... 3 Group Column/Row Adjusments... 4 Hiding

More information

Microsoft Excel 2010 Basic

Microsoft Excel 2010 Basic Microsoft Excel 2010 Basic Introduction to MS Excel 2010 Microsoft Excel 2010 is a spreadsheet software in the new Microsoft 2010 Office Suite. Excel allows you to store, manipulate and analyze data in

More information

Introduction to MS Word XP 2002: An Overview

Introduction to MS Word XP 2002: An Overview Introduction to MS Word XP 2002: An Overview Sources Used: http://www.fgcu.edu/support/office2000/word/files.html Florida Gulf Coast University Technology Skills Orientation Word 2000 Tutorial The Computer

More information

COGNOS (R) 8 COGNOS CONNECTION USER GUIDE USER GUIDE THE NEXT LEVEL OF PERFORMANCE TM. Cognos Connection User Guide

COGNOS (R) 8 COGNOS CONNECTION USER GUIDE USER GUIDE THE NEXT LEVEL OF PERFORMANCE TM. Cognos Connection User Guide COGNOS (R) 8 COGNOS CONNECTION USER GUIDE Cognos Connection User Guide USER GUIDE THE NEXT LEVEL OF PERFORMANCE TM Product Information This document applies to Cognos (R) 8 Version 8.1.2 MR2 and may also

More information

StarTeam Layout Designer Help

StarTeam Layout Designer Help StarTeam 16.3 Layout Designer Help Micro Focus The Lawn 22-30 Old Bath Road Newbury, Berkshire RG14 1QN UK http://www.microfocus.com Copyright Micro Focus 2018. All rights reserved. MICRO FOCUS, the Micro

More information

INTRODUCTION... 1 UNDERSTANDING CELLS... 2 CELL CONTENT... 4

INTRODUCTION... 1 UNDERSTANDING CELLS... 2 CELL CONTENT... 4 Introduction to Microsoft Excel 2016 INTRODUCTION... 1 The Excel 2016 Environment... 1 Worksheet Views... 2 UNDERSTANDING CELLS... 2 Select a Cell Range... 3 CELL CONTENT... 4 Enter and Edit Data... 4

More information

Status Bar: Right click on the Status Bar to add or remove features.

Status Bar: Right click on the Status Bar to add or remove features. Excel 2013 Quick Start Guide The Excel Window File Tab: Click to access actions like Print, Save As, etc. Also to set Excel options. Ribbon: Logically organizes actions onto Tabs, Groups, and Buttons to

More information

Introduction Accessing MICS Compiler Learning MICS Compiler CHAPTER 1: Searching for Data Surveys Indicators...

Introduction Accessing MICS Compiler Learning MICS Compiler CHAPTER 1: Searching for Data Surveys Indicators... Acknowledgement MICS Compiler is a web application that has been developed by UNICEF to provide access to Multiple Indicator Cluster Survey data. The system is built on DevInfo technology. 3 Contents Introduction...

More information

Microsoft Word 2003 for Windows, Part 2

Microsoft Word 2003 for Windows, Part 2 Microsoft Word 2003 for Windows, Part 2 In this workshop, the following Word 2003 features will be covered: Creating and using Tables Formatting text using Styles Using MailMerge Arranging text in Columns

More information

SETTING UP A. chapter

SETTING UP A. chapter 1-4283-1960-3_03_Rev2.qxd 5/18/07 8:24 PM Page 1 chapter 3 SETTING UP A DOCUMENT 1. Create a new document. 2. Create master pages. 3. Apply master pages to document pages. 4. Place text and thread text.

More information

Graphical User Interfaces. Comp 152

Graphical User Interfaces. Comp 152 Graphical User Interfaces Comp 152 Procedural programming Execute line of code at a time Allowing for selection and repetition Call one function and then another. Can trace program execution on paper from

More information

The Racket Graphical Interface Toolkit

The Racket Graphical Interface Toolkit The Racket Graphical Interface Toolkit Version 6.12.0.2 Matthew Flatt, Robert Bruce Findler, and John Clements January 23, 2018 (require racket/gui/base) package: gui-lib The racket/gui/base library provides

More information

SmartView. User Guide - Analysis. Version 2.0

SmartView. User Guide - Analysis. Version 2.0 SmartView User Guide - Analysis Version 2.0 Table of Contents Page i Table of Contents Table Of Contents I Introduction 1 Dashboard Layouts 2 Dashboard Mode 2 Story Mode 3 Dashboard Controls 4 Dashboards

More information

TABLE OF CONTENTS TABLE OF CONTENTS... 1 INTRODUCTION... 2 USING WORD S MENUS... 3 USING WORD S TOOLBARS... 5 TASK PANE... 9

TABLE OF CONTENTS TABLE OF CONTENTS... 1 INTRODUCTION... 2 USING WORD S MENUS... 3 USING WORD S TOOLBARS... 5 TASK PANE... 9 TABLE OF CONTENTS TABLE OF CONTENTS... 1 INTRODUCTION... 2 USING WORD S MENUS... 3 DEFINITIONS... 3 WHY WOULD YOU USE THIS?... 3 STEP BY STEP... 3 USING WORD S TOOLBARS... 5 DEFINITIONS... 5 WHY WOULD

More information

Excel Select a template category in the Office.com Templates section. 5. Click the Download button.

Excel Select a template category in the Office.com Templates section. 5. Click the Download button. Microsoft QUICK Excel 2010 Source Getting Started The Excel Window u v w z Creating a New Blank Workbook 2. Select New in the left pane. 3. Select the Blank workbook template in the Available Templates

More information

ABOUT THIS COURSE... 3 ABOUT THIS MANUAL... 4 LESSON 1: MANAGING LISTS... 5

ABOUT THIS COURSE... 3 ABOUT THIS MANUAL... 4 LESSON 1: MANAGING LISTS... 5 Table of Contents ABOUT THIS COURSE... 3 ABOUT THIS MANUAL... 4 LESSON 1: MANAGING LISTS... 5 TOPIC 1A: SORT A LIST... 6 Sort a list in A-Z or Z-A Order... 6 TOPIC 1B: RENUMBER A LIST... 7 Renumber a List

More information

PowerPoint Spring 2002

PowerPoint Spring 2002 PowerPoint 2000 Spring 2002 Table of Contents I. INTRODUCTION... 1 II. GETTING STARTED... 1 A. Opening PowerPoint... 1 B. The Mouse Pointer... 1 C. Working with Text... 2 1. Windows Control Buttons...

More information

BusinessObjects Frequently Asked Questions

BusinessObjects Frequently Asked Questions BusinessObjects Frequently Asked Questions Contents Is there a quick way of printing together several reports from the same document?... 2 Is there a way of controlling the text wrap of a cell?... 2 How

More information

Creating Professional Swing UIs Using the NetBeans GUI Builder

Creating Professional Swing UIs Using the NetBeans GUI Builder Creating Professional Swing UIs Using the NetBeans GUI Builder Tomas Pavek, Jan Stola, Scott Violet Sun Microsystems http://www.netbeans.org http://swinglabs.dev.java.net TS-4916 Copyright 2006, Sun Microsystems,

More information

Coach s Office Playbook Tutorial Playbook i

Coach s Office Playbook Tutorial  Playbook i Playbook i The Playbook... 1 Overview... 1 Open the Playbook... 1 The Playbook Window... 2 Name the Chapter... 2 Insert the First Page... 3 Page Templates... 3 Define the Template Boxes... 4 Text on the

More information

SmartArt Office 2007

SmartArt Office 2007 SmartArt Office 2007 This is not an official training handout of the, Davis School District SmartArt... 2 Inserting SmartArt... 2 Entering the Text... 2 Adding a Shape... 2 Deleting a Shape... 2 Adding

More information

NiceForm User Guide. English Edition. Rev Euro Plus d.o.o. & Niceware International LLC All rights reserved.

NiceForm User Guide. English Edition. Rev Euro Plus d.o.o. & Niceware International LLC All rights reserved. www.nicelabel.com, info@nicelabel.com English Edition Rev-0910 2009 Euro Plus d.o.o. & Niceware International LLC All rights reserved. www.nicelabel.com Head Office Euro Plus d.o.o. Ulica Lojzeta Hrovata

More information

Computer Nashua Public Library Introduction to Microsoft Word 2010

Computer Nashua Public Library Introduction to Microsoft Word 2010 Microsoft Word is a word processing program you can use to write letters, resumes, reports, and more. Anything you can create with a typewriter, you can create with Word. You can make your documents more

More information

Lehigh University Library & Technology Services

Lehigh University Library & Technology Services Lehigh University Library & Technology Services Start Word Open a file called day2 Microsoft WORD 2003 Day 2 Click the Open button on the Standard Toolbar Go to the A: drive and highlight day2 and click

More information

Corel Ventura 8 Introduction

Corel Ventura 8 Introduction Corel Ventura 8 Introduction Training Manual A! ANZAI 1998 Anzai! Inc. Corel Ventura 8 Introduction Table of Contents Section 1, Introduction...1 What Is Corel Ventura?...2 Course Objectives...3 How to

More information

Access Review. 4. Save the table by clicking the Save icon in the Quick Access Toolbar or by pulling

Access Review. 4. Save the table by clicking the Save icon in the Quick Access Toolbar or by pulling Access Review Relational Databases Different tables can have the same field in common. This feature is used to explicitly specify a relationship between two tables. Values appearing in field A in one table

More information

Full file at Excel Chapter 2 - Formulas, Functions, Formatting, and Web Queries

Full file at   Excel Chapter 2 - Formulas, Functions, Formatting, and Web Queries Excel Chapter 2 - Formulas, Functions, Formatting, and Web Queries MULTIPLE CHOICE 1. To start a new line in a cell, press after each line, except for the last line, which is completed by clicking the

More information

CS Exam 1 Review Suggestions

CS Exam 1 Review Suggestions CS 235 - Fall 2015 - Exam 1 Review Suggestions p. 1 last modified: 2015-09-30 CS 235 - Exam 1 Review Suggestions You are responsible for material covered in class sessions, lab exercises, and homeworks;

More information

5 Setting Preferences 15 Preferences 15 Configure Chart Colors 16

5 Setting Preferences 15 Preferences 15 Configure Chart Colors 16 CRITERION Vantage 3 Acquire Training Manual Contents 1 Introduction 3 Collecting Data 3 2 Starting the Program 3 Logging In and Logging Out 3 Logging In 3 Logging in as an Administrator 3 Logging in as

More information

Microsoft Excel Level 1

Microsoft Excel Level 1 Microsoft Excel 2010 Level 1 Copyright 2010 KSU Department of Information Technology Services This document may be downloaded, printed, or copied for educational use without further permission of the Information

More information

Tutorials. Lesson 3 Work with Text

Tutorials. Lesson 3 Work with Text In this lesson you will learn how to: Add a border and shadow to the title. Add a block of freeform text. Customize freeform text. Tutorials Display dates with symbols. Annotate a symbol using symbol text.

More information

Title bar: The top most bar in Word window that usually displays the document and software names.

Title bar: The top most bar in Word window that usually displays the document and software names. 1 MICROSOFT WORD Table of Contents LINC ONE Hiding Standard toolbar, Formatting toolbar, and Status bar: To hide the Standard toolbar, click View Toolbars on the Menu bar. Check off Standard. To hide the

More information

Chapter 7 Inserting Spreadsheets, Charts, and Other Objects

Chapter 7 Inserting Spreadsheets, Charts, and Other Objects Impress Guide Chapter 7 Inserting Spreadsheets, Charts, and Other Objects OpenOffice.org Copyright This document is Copyright 2007 by its contributors as listed in the section titled Authors. You can distribute

More information

Educational Fusion. Implementing a Production Quality User Interface With JFC

Educational Fusion. Implementing a Production Quality User Interface With JFC Educational Fusion Implementing a Production Quality User Interface With JFC Kevin Kennedy Prof. Seth Teller 6.199 May 1999 Abstract Educational Fusion is a online algorithmic teaching program implemented

More information