Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Early GUIs with Java As presented in Java: Complete Course in Programming and Problem Solving by Lambert and Osborne.

Similar presentations


Presentation on theme: "1 Early GUIs with Java As presented in Java: Complete Course in Programming and Problem Solving by Lambert and Osborne."— Presentation transcript:

1 1 Early GUIs with Java As presented in Java: Complete Course in Programming and Problem Solving by Lambert and Osborne

2 2 Advantages of Early GUIs 4 Realistic GUIs are fun to create and generate student enthusiasm 4 Students are accustomed to using GUI- based programs 4 User interface design is an important part of program development

3 3 But... 4GUIs are too hard to create in Java 4The abstract windowing toolkit (AWT) is too complicated 4So doing GUIs would distract from core programming concepts

4 4 Abstraction to the Rescue 4We use Java’s power of abstraction to simplify GUI creation 4We call the result BreezyGUI

5 5 A Simple Program Using BreezyGUI The user enters the radius in the upper field and selects the Compute button. Code on next slide.

6 6 import java.awt.*; import BreezyGUI.*; public class CircleArea extends GBFrame{ Label radiusLabel = addLabel ("Radius",1,1,1,1); DoubleField radiusField = addDoubleField (0,1,2,1,1); Label areaLabel = addLabel ("Area",2,1,1,1); DoubleField areaField = addDoubleField (0,2,2,1,1); Button computeButton = addButton ("Compute",3,1,2,1); public void buttonClicked (Button buttonObj){ double radius, area; radius = radiusField.getNumber(); area = 3.14 * radius * radius; areaField.setNumber (area); areaField.setPrecision (2); } public static void main (String[] args){ Frame frm = new CircleArea(); frm.setSize (200, 150); frm.setVisible (true); } Lay out the GUI objects Handle the user events Open the window and start the program

7 7 Transition to Full AWT Is Easy Students are now familiar with 4structure of event driven programs 4behavior of basic window components 4designing GUI based applications In addition 4BreezyGUI is an extension of Java’s AWT 4and the book shows one how to make the transition

8 8 BreezyGUI Highlights Supports 4applications, applets, and dialogs 4common window components 4drop down menus 4mouse events And it’s actually easier to use than terminal I/O

9 9 BreezyGUI in Many Courses 4Has been used in CS0, CS1, CS2, and more advanced courses 4Useful in any course where direct use of AWT is not required

10 10 And Now for Some Examples taken from Java: Complete Course in Programming and Problem Solving

11 11 Compute Sales Commissions

12 12 Navigate and Maintain an Array of Student Objects

13 13 Drag Circles

14 14 Analyze a Text File

15 15 A Color Meter


Download ppt "1 Early GUIs with Java As presented in Java: Complete Course in Programming and Problem Solving by Lambert and Osborne."

Similar presentations


Ads by Google