21-07apr10GUIlistening - 1 1 Listening to events on GUIs...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: 1 1 Listening to events on GUIs Sec. 17.4 contains this material. Corresponding lectures on ProgramLive CD is a better way to learn the material. Top fnalists From a real-liFe Dilbert quotes contest As of tomorrow, employees will be able to access the building only using individual security cards. Pictures will be taken next Wednesday and employ- ees will receive their cards in two weeks." (Fred Dales, Microsoft) I need an exact list of specic unknown problems we might encounter. (Lykes Lines Shipping) Email is not to be used to pass on information or data. It should be used only for company business. (Accounting manager, Electric Boat Company) This project is so important, we can't let things that are more important interfere with it. (Advertising/Marketing manager, United Parcel Service) Doing it right is no excuse for not meeting the schedule. (Plant manager, Delco Corporation) 2 Layout manager: An instance controls the placement of components JFrame layout manager default : BorderLayout. BorderLayout layout manager: Can place 5 components: South East West Center North Container cp= getContentPane(); JButton jb= new JButton(Click here); JButton jl= new JLabel( label 2); cp.add(jb, BorderLayout.EAST); cp.add(jl, BorderLayout.WEST); pack(); setVisible( true ); Place this in a constructor of a subclass of JFrame 3 Layout manager: An instance controls the placement of components JPanel layout manager default : FlowLayout. Box layout manager default: BoxLayout. Container cp= getContentPane(); JPanel p= new JPanel(); JButton b= new JButton("Click here"); JLabel jl= new JLabel("label 2"); p.add(b); p.add(jl); cp.add(p, BorderLayout.CENTER); pack(); setVisible(true); Place this in a constructor of a subclass of JFrame Components are placed in a row in the order in which they were added. With FlowLayout, if the window is too narrow, components flow into the next row(s). With BoxLayout, they dont....
View Full Document

This note was uploaded on 03/03/2012 for the course CS 100J taught by Professor Davidgries during the Spring '07 term at Cornell University (Engineering School).

Page1 / 2

21-07apr10GUIlistening - 1 1 Listening to events on GUIs...

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

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