CS242 Advanced Programming Concepts in Java - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

CS242 Advanced Programming Concepts in Java

Description:

(http://java.sun.com/docs/books/tutorial/uiswing/index.html) return and discuss HW#1 ... consistent user experience across platforms (written in Java, peerless) ... – PowerPoint PPT presentation

Number of Views:29
Avg rating:3.0/5.0
Slides: 17
Provided by: janicets
Category:

less

Transcript and Presenter's Notes

Title: CS242 Advanced Programming Concepts in Java


1
CS242Advanced Programming Concepts in Java
  • 9/20/07
  • Intro to Swing

Prof. Searleman jets_at_clarkson.edu
2
Announcements
  • Career Fair!
  • Greg Lacey from IBM will talk on software
    development Thurs., 400, SC162
  • Also check out Johnson Johnson, PAR, GE, and
    many more
  • Demetrios Dimatos will talk to our class today
    about his experience as a Java developer at IBM
    Silicon Valley

a horrible death to die
3
Outline
  • Graphical User Interfaces (GUIs)
  • Java Foundation Classes (JFC) Swing
  • Read the SUN Tutorial
  • Constructing a GUI with JFC/Swing
  • (http//java.sun.com/docs/books/tutorial/uiswing/
    index.html)
  • return and discuss HW1
  • HW1 and HW2 can be resubmitted by next Tuesday
  • HW3 will be posted today due next Thursday

4
Common errors
  • missing source file comment
  • javadoc comments
  • not in correct location (so wont appear)
  • reveals implementation details
  • doesnt describe the object being modelled
  • use constants instead of hard-coding numbers
  • misuse of a class variable
  • public, private, package, protected misused
  • initializes to a meaningless number (e.g. 0, -1)
  • inadequate testing
  • source file not in afs

5
Whats the problem?
public class Die() Random rng public int
TopSide // other stuff
6
Whats the problem?
public class Die() private static Random
rng private int topSide public Die()
rng new Random() topSide
rng.nextInt(5) 1 // other stuff
7
Whats the problem?
public class Die() private static Random
rng private int topSide private final int
DefaultSIDES 6 public Die() rng
new Random() topSide rng.nextInt(DefaultS
IDES) 1 public int roll()
rng new Random() topSide
rng.nextInt(DefaultSIDES) 1 return
topSide
8
How to resubmit an assignment
  • Make a new subdirectory in your afs directory
    (e.g. hw1r)
  • upload your new source files and test runs
  • turn in BOTH the original printout with the grade
    sheet attached and the new printout

9
JFC
  • AWT (Abstract Window Toolkit)
  • java.awt. and java.awt.event.
  • Swing
  • javax.swing. and javax.swing.event.
  • Accessibility, 2D API, Drag Drop

10
Swing
  • consistent user experience across platforms
    (written in Java, peerless)
  • pluggable look feel (PLAF)
  • (Windows, Metal, Motif LFs builtin)
  • Model-View-Controller (MVC) Framework

11
Swing API
  • javax.swing
  • javax.swing.event
  • other Swing packages include
  • javax.accessibility, javax.swing.border
  • javax.swing.colorchooser,
  • javax.swing.filechooser, javax.swing.plaf
  • javax.swing.table, javax.swing.text
  • javax.swing.text.html, javax.swing.text.rtf
  • javax.swing.tree, javax.swing.undo

12
Lightweight Components
  • AWT heavyweight components
  • Frame --- peer with ? native window
  • Button --- peer with ? native button
  • Swing lightweight components
  • components are not dependent on native peers to
    render themselves use simplified graphics
    primitives to paint themselves on the screen

13
(No Transcript)
14
Model-View-Controller MVC Architecture
  • Model The core of the application. This
    maintains the state and data that the application
    represents. When significant changes occur in the
    model, it updates all of its views
  • Controller The user interface presented to the
    user to manipulate the application.
  • View The user interface which displays
    information about the model to the user. Any
    object that needs information about the model
    needs to be a registered view with the model.

15
(No Transcript)
16
Look Feel
Java LF (Metal)
GTK LF (Motif)
Mac OS LF
Windows LF
Write a Comment
User Comments (0)
About PowerShow.com