bruce just 4 fonts couldnt access gui of native os

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: a GUI that looks equally mediocre on all systems." Just 4 fonts Couldn't access GUI of native OS Didn't separate model and UI code cleanly JDK 1.1 (circa 1998) JDK 1.1 makes AWT more robust and extensible Delegation-based event model separates user interface from problem domain Avoids cascaded if statements testing for object type required by first AWT Designates "listeners" of events triggered by problem domain objects Other enhancements: button tool tips, cut/paste to the clipboard, popup menus, printing, etc. Adds supports for JavaBeans JDK 1.2 (Swing) JDK 1.2 adds Java Foundation Classes Swing is the GUI library for JDK 1.2 Much richer class library plus better integration with look and feel of GUI of OS Eckel: "The `revision 3' rule of software industry (a product isn't good until revision 3) seems to hold true with programming languages as well." But browsers have been slow to include JDK 1.2 AWT class hierarchy Checkbox, Choice, Label, List, Scrollbar,ScrollPane, TextArea, TextField Component and Container Component contributes several public methods to all its subclasses: public void setSize(int width, int height); //set size in pixels public void setBackground(Color c); //see class Color for colors public void setVisible(boolean b); //Display on screen (creates peer) Container is an abstract class: It cannot be instantiated; subclasses must implement some methods Container does implement some useful methods, including: public Component add(Component comp); //put a Component in a Container public setLayout(LayoutManager mgr); //lay out components in some pattern Window and Frame classes A Window is a top-level window with no borders and no menubar It can generate a WindowOpened or a WindowClosed event, to which a WindowListener or WindowAdapter can respond A Frame is a top-level window with a title and a border Because it has more features, it can generate more events: WindowOpened, WindowClosing, WindowClosed, WindowIconified, WindowDeiconified, WindowActivated, WindowDeactivated Respond to these events with a WindowListener Once a subclass of Container has been constructed, it can add (attach) any AWT component within it, such as a Button, Label, TextField, or another Frame or Panel A simple example //Demonstrates construction of a Container and a Button Superclass does...
View Full Document

This note was uploaded on 08/06/2008 for the course CSE 432 taught by Professor Blank during the Fall '08 term at Lehigh University .

Ask a homework question - tutors are online