Lecture Topic:
import java.awt.*; import java.io.*; class MenuBarFrame extends Frame { MenuBar menuBar; String str; private int JavaIdentifiersMayBeOfUnlimitedLengthTheycanhavenoSpacesNoOperatorsTheyCANHave1234567890NumbersOrDigitsButTheyMustStartWithLetters = 0; private String science_items [] = { "Image Processing","-", "Audio Processing", "surface", "benchmark", "-", "Toy Calculator" }; .... process_menuitem.java
import java.awt.*; import java.net.*; class process_menuitem { static Grating g = (Grating) Geometry.grating; static Camera c = (Camera) Geometry.camera; // left af out here so the gc doesn't eat it! static AudioFrame af; static public void objects(MenuBarFrame f, Object arg) { // System.out.println("Process_menuitem called with "+arg); if (arg.equals("Audio Processing")) af = new AudioFrame(); if (arg.equals("htmlGenerator")) { HtmlGenerator hg = new HtmlGenerator("The HTML Generator"); hg.main(null); } if (arg.equals("benchmark")) { AppletFrame w = new AppletFrame("BenchmarkApplet"); String title ="BenchmarkApplet"; ----------->B1 String args[] ={""}; w.startApplet("BenchmarkApplet",title,args); }
... ... public boolean keyDown(Event evt, int key) { int number_of_shapes; Shape s; int d = Geometry.step_size.getValue(); // mm increment on motion point np = new point(0,0); point ns = new point(1,1); System.out.println("ASCII value: " + key); System.out.println("Character: " + (char) key); switch (key) { case 'd': print_dl(); break; case 'a': Geometry.print_angles(); break; case 'p': Geometry.print(); break; case '6': np.x +=d; Xform.rmove(np); break; case '2': np.y -=d; Xform.rmove(np); break; case '3': np.x +=d; np.y -=d; Xform.rmove(np); break;--------> B2
If B1 = B2
It would be wonderful, if we can write code, for trapping events only once, and use it in both menu action event and key board action events.
( Z1 Z2 ) = ( a + bi ) ( c + Di )
= ac - bD + i(aD + bc)
1. Class InetAddress
Last Update:
04/09/97
Copyright © 1997- Douglas Lyon
Lyon@cse.bridgeport.edu