Académique Documents
Professionnel Documents
Culture Documents
2/23/2012
2/23/2012
2/23/2012
2/23/2012
2/23/2012
2/23/2012
GUI builder: also called as Design Space or Design Area. The design area is where user will visually construct GUI. It is primary workspace within which GUI design takes place in the IDE. The GUI Builder enables user to lay out forms by placing components where they are required. Click on an object to select it in the Design Area. For a multiple selection, hold down the Ctrl key while clicking on objects. It has two views Source View and Design View. Design View is the default and Source view opens the code editor for user where addition or deletion for an application takes place.
2/23/2012
Palette: it contains all of the components needed to create GUI applications. A customizable list of available components containing groups for Swing, AWT (Abstract Window Toolkit), Borders, and Beans components. This window enables user to create, remove, and rearrange the categories displayed in the palette using the customizer. Frames: A frame is a window that typically had decorations such as a border, a title, and buttons for closing and iconifying itself. A GUI application typically uses at least one frame. Frames are used to display things like labels, text fields, buttons and other controls. Controls: Controls are component object such as text fields, labels, list boxes etc. that are drawn on frame to get data input or to display output.
2/23/2012 Created By: Priyanka Pareek 9
Inspector window: this window displays a tree hierarchy of all components contained in the currently opened form. Displayed items include visual components such buttons, labels menus and panels as well as non visual components such as timers and data sources. Properties window: This window displays the editable settings for the currently selected component. A display of the properties of the component currently selected in the GUI Builder, Inspector window, Projects window, or Files window. Code Editor window: it is the window where user write Java Code for an application. It serves as an editor for entering application code. A separate code window is created for each top level frame that user create in application.
2/23/2012
10
2/23/2012
11
2/23/2012
12
V. Basics of GUI
Introduction: GUI stands for Graphical User Interface. It refers to the windows, buttons, dialogs, menus and everything visual in modern application. It is not only GUI components. It also involves properties of its components, actions, events etc. Working of a GUI: when an action is performed, an event is generated. In Event-Driven Programming (EDP), that most GUI follow responds to an event. Working of Windows, Events and Messages:
Windows: Many types of windows are present like document window, dialog box etc. Some other types are command button, icons, text boxes option buttons and menu bars. Win. OS manages all of these many windows by assigning unique id no. (called Window handle). Computers monitors for signs of activity or in other words events. Events: An event refers to the occurrence of activity. Each time an event occurs, it causes a message to be sent to the operating system. Events can occur through user actions such as a mouse click or a key press, through programmatic control, Created By:as a result of another windows action. or even Priyanka Pareek 2/23/2012 13
1.
2.GUI in Java: In Java GUI features are supported by Java Foundation Classes (JFC), which encompasses a group of features for building GUI and adding rich graphics functionally and interactivity to Java applications.
Major feature of JFC is Swing API, which includes everything from buttons to split panes to tables and any other functionality to create a GUI application. GUI programs are build by using Swing APIs features. GUI programs that will be create in Java will contain three tiers of s/w:
Graphical Components that make up the GUI. Each graphical component has certain Properties. A property is a characteristic of an object as its size, color, title etc.
Event Listeners that get notified about the events and respond to them. Event Handler that do the work for the user in case the event occurs.
Created By: Priyanka Pareek 14
2/23/2012
JLabel
JList
JButton JCheckBox
JPanel
JComboBox JRadioButton
2/23/2012
17
Creation of an application
2/23/2012
20
2/23/2012
21
2/23/2012
22
Running of an application
2/23/2012
23
Friendly names: when naming a control, the first letter of the friendly name is generally is in uppercase, so it is easily differentiate between the friendly name and the controls abbreviations e.g. ReadOnlyCheckBox To name a control:
2/23/2012
In Inspector window double-click the window too be named. Type the new name
Created By: Priyanka Pareek
24
VIII.
To add functionality or behaviour to components, user must know about the events and listners. They 3 major players that add functionality to GUI are: The Events: an event is an object that gets generated when user does something such as mouse click, dragging, pressing a key etc. The Source of the Event: The component where event has occurred, is the source of the event. The Event Listener: An event listener is attached to a component and contains the method/functions that will be executed, in response to an event.
Listener Interface: An event listener stores all the methods, that it will implement in response to an events, inside the listener interface.
2/23/2012
26