gui - part 1 - COP 3330: Object-Oriented Programming Summer...

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

View Full Document Right Arrow Icon
COP 3330: GUI Components Part 1 Page 1 Mark Llewellyn © COP 3330: Object-Oriented Programming Summer 2007 GUI Components: Part 1 School Electrical Engineering and Computer Science University of Central Florida Instructor : Mark Llewellyn markl@cs.ucf.edu HEC 236, 823-2790 http://www.cs.ucf.edu/courses/cop3330/sum2007
Background image of page 1

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

View Full DocumentRight Arrow Icon
COP 3330: GUI Components Part 1 Page 2 Mark Llewellyn © GUI and Event-Driven Programming • Most users of software will prefer a graphical user-interface ( GUI ) -based program over a console-based program any day of the week. • A GUI gives an application a distinctive “look” and “feel”. • Providing different applications with consistent, intuitive user interface components allows users to be somewhat familiar with an application, so that they can learn it more quickly and use it more productively. • Studies have found that users find GUIs easier to manipulate and more forgiving when misused. • The GUI ease of functionality comes at a programming price – GUI-based programs are more complex in their structure than console-based programs.
Background image of page 2
COP 3330: GUI Components Part 1 Page 3 Mark Llewellyn © The Trade-off Between Ease of Use and Software Complexity Low High Complexity Total Software Complexity Difficulty of Use
Background image of page 3

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

View Full DocumentRight Arrow Icon
COP 3330: GUI Components Part 1 Page 4 Mark Llewellyn © Popularity of GUIs • Despite the complexity of GUI programming, its dominance in real-world software development makes it imperative that GUI programming be considered. • Do not confuse GUI-based programming with applets. Although some of the features of the first few GUIs that we look at will be similar to those you used in your first applet program, notice that we are developing application programs here not applets. – The execution of a GUI-based application also begins in its method main(). However, method main() is normally responsible only for creating an instance of the GUI. – After creating the GUI, the flow of control will shift from the main() method to an event-dispatching loop that will repeatedly check for user interactions with the GUI.
Background image of page 4
COP 3330: GUI Components Part 1 Page 5 Mark Llewellyn © Components of the GUI GUI’s are built from GUI components. These are sometimes called controls or widgets (short for windows gadgets ) in languages other than Java. A GUI component is an object with which the user interacts via the mouse, keyboard, or some other input device (voice recognition, light pen, etc.). Many applications that you use on a daily basis use windows or dialog boxes (also called dialogs) to interact with the user. •J a v a s JOptionPane class (package javax.swing ) provides prepackaged dialog boxes for both input and output. – These dialogs are displayed by invoking static JOptionPane methods. The simple example on the next page illustrates this concept.
Background image of page 5

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

View Full DocumentRight Arrow Icon
COP 3330: GUI Components Part 1 Page 6 Mark Llewellyn © // A simple integer addition program that uses JOptionPane for input and output.
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 65

gui - part 1 - COP 3330: Object-Oriented Programming Summer...

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

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