Presentation is loading. Please wait.

Presentation is loading. Please wait.

May 6, 1998CS102-02Lecture 6-2 Cross-Platform Programming CS 102-02 Lecture 6-2 Making everyone happy.

Similar presentations


Presentation on theme: "May 6, 1998CS102-02Lecture 6-2 Cross-Platform Programming CS 102-02 Lecture 6-2 Making everyone happy."— Presentation transcript:

1 May 6, 1998CS102-02Lecture 6-2 Cross-Platform Programming CS 102-02 Lecture 6-2 Making everyone happy

2 May 6, 1998CS102-02Lecture 6-2 Agenda Two kinds of inheritance Interfaces in Java The End of OO

3 May 6, 1998CS102-02Lecture 6-2 Web vs. Java Design Web designers are used to testing their sites and pages on –Multiple platforms –Screen resolutions –Color ranges –Browsers Can't just create Web sites on and for their own high-powered, million-color development machines

4 May 6, 1998CS102-02Lecture 6-2 Graphics across Platforms Different computers almost agree on text, but strongly disagree on graphics –Screen resolutions –Colors: 8-bit grey, 16-bit and 24-bit –Fonts: Not everybody has Times New Roman Narrow –User interface: Keyboards, mouse button count and accessibility

5 May 6, 1998CS102-02Lecture 6-2 Cross-Platform Fonts Different platforms have different fonts –Different names for similar fonts Java has a set of logical fonts –Monospaced, Dialog, Serif and Sans Serif –Font attributes (size, style,...)

6 May 6, 1998CS102-02Lecture 6-2 The Abstract Windowing Toolkit Abstract away the details of building graphical user interfaces (GUIs)

7 May 6, 1998CS102-02Lecture 6-2 The AWT Hierarchy

8 May 6, 1998CS102-02Lecture 6-2 The Need for Abstraction

9 May 6, 1998CS102-02Lecture 6-2 Arranging Things Java uses layout managers to control how components appear on-screen –Achieve different effects by using different layout managers –Going without Grid layout Flow layout

10 May 6, 1998CS102-02Lecture 6-2 Laying It All Out

11 May 6, 1998CS102-02Lecture 6-2 Picking a Layout Manager I Need to display a component in as much space as it can get. –Consider using BorderLayoutBorderLayout put the space-hungry component in the center –GridBagLayoutGridBagLayout Set the constraints for the component so that fill=GridBagConstraints.BOTH From The Java Tutorial

12 May 6, 1998CS102-02Lecture 6-2 Picking a Layout Manager II Need to display a few components in a compact row at their natural size. –Use a Panel to hold the components –Use Panel's default FlowLayout managerFlowLayout Need to display a few same-sized components in rows and/or columns. –GridLayout fits the billGridLayout From The Java Tutorial

13 May 6, 1998CS102-02Lecture 6-2 The AWT Works for You Abstraction is all well and good, but Java programs still need to run on actual machines Just one API for buttons (provided by the Button class) –Looks different on a Macintosh than on a PC running Windows 95. Peer classes link the AWT components you see to the underlying platform

14 May 6, 1998CS102-02Lecture 6-2 Behind the Scenes

15 May 6, 1998CS102-02Lecture 6-2 Swingin' with Java Swing components are lightweight Use a different architecture than AWT

16 May 6, 1998CS102-02Lecture 6-2 Swing Look-and-Feel Metal (Java) Early Mac MotifWindows Organic (Santa Fe) Organic (Vancouver)

17 May 6, 1998CS102-02Lecture 6-2 Beans JavaBeans is a portable, platform- independent software component model written in Java Enables developers to write reusable components once and run them anywhere

18 May 6, 1998CS102-02Lecture 6-2 Going Cross-Platform with Java Graphics –GUI components –Fonts –Swing Sharing software –Beans


Download ppt "May 6, 1998CS102-02Lecture 6-2 Cross-Platform Programming CS 102-02 Lecture 6-2 Making everyone happy."

Similar presentations


Ads by Google