Lecture 22-GUI - 16Nov2010GUIS:GraphicalUserInterfaces

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

View Full Document Right Arrow Icon
1 16 Nov 2010 GUIS: Graphical User Interfaces Their mouse had a mean time between failure of … a week … it would jam up irreparably, or . .. jam up on the table-- . .. It had a flimsy cord whose wires would break. Steve Jobs: ". .. Xerox says it can't be built for < $400, I want a $10 mouse that will never fail and can be mass produced, because it's going to be the primary interface of the computer . .." ... Dean Hovey . .. came back, "I've got some good and some bad news. Good news: we've got a new project with Apple. Bad news: I told Steve we'd design a mouse for 10 bucks." ... year later . .. we … filed … and were granted a patent, on the electro- mechanical-optical mouse of today; . .. we ended up . .. [making] the mouse as invisible to people as it is today. R ead Chap. 17 of the text. ProgramLive CD: a better way to  learn about GUIs. See CD for examples of code.
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 JFrame’s content pane South East West Center North Container cp= getContentPane(); JButton jb=  new  JButton(“Click  here”); JLabel jl=  new  JLabel( “label 2”); cp.add(jb, BorderLayout.EAST); cp.add(jl, BorderLayout.WEST); pack(); setVisible( true ); Layout manager :  An instance controls the placement of  components. JFrame layout manager default : BorderLayout. BorderLayout  layout manager: Can place 5 components: JFrameDemo.java
Background image of page 2
Putting components in a JFrame import java.awt.*; import javax.swing.*; /** Demonstrate placement of components in a JFrame. Use BorderLayout. It places five components in the five possible areas: (1) a JButton in the east, (2) a JLabel in the west, (3) a JLabel in the south, (4) a JTextField in the north, and (5) a JTextArea in the center. */ public class ComponentExample extends JFrame { /** Constructor: a window with title t and 5 components */ public ComponentExample(String t) { super (t); Container cp= getContentPane(); cp.add( new JButton("click me"), BorderLayout.EAST); cp.add( new JTextField("type here", 22), BorderLayout.NORTH); cp.add( new JCheckBox("I got up today"), BorderLayout.SOUTH); cp.add( new JLabel("label 2"), BorderLayout.WEST);
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/27/2010 for the course CS 9339 at Cornell University (Engineering School).

Page1 / 11

Lecture 22-GUI - 16Nov2010GUIS:GraphicalUserInterfaces

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

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