Early GUIs with Java - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

Early GUIs with Java

Description:

The abstract windowing toolkit (AWT) is too complicated ... Abstraction to the Rescue. We use Java's power of abstraction to simplify GUI creation ... – PowerPoint PPT presentation

Number of Views:30
Avg rating:3.0/5.0
Slides: 16
Provided by: kenla6
Category:
Tags: abstraction | early | guis | java

less

Transcript and Presenter's Notes

Title: Early GUIs with Java


1
EarlyGUIs with Java
  • As presented in
  • Java Complete Course in
  • Programming and Problem Solving
  • by Lambert and Osborne

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

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

4
Abstraction to the Rescue
  • We use Javas power of abstraction to simplify
    GUI creation
  • We call the result BreezyGUI

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
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
Transition to Full AWT Is Easy
  • Students are now familiar with
  • structure of event driven programs
  • behavior of basic window components
  • designing GUI based applications
  • In addition
  • BreezyGUI is an extension of Javas AWT
  • and the book shows one how to make the transition

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

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

10
And Now for Some Examples
taken from Java Complete Course in Programming
and Problem Solving
11
Compute Sales Commissions
12
Navigate and Maintain an Array of Student Objects
13
Drag Circles
14
Analyze a Text File
15
A Color Meter
Write a Comment
User Comments (0)
About PowerShow.com