home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-08-16 | 12.6 KB | 1,299 lines |
- <string>
- GraphicsApplet
- <string>
- Min-Kyu Lee
- <integer>
- 15
- <string>
- This example is from :
- <string>
-
- <string>
- HOOKED ON JAVA
- <string>
- Arthur van Hoff, Sami Shaio, Orca Starbuck.
- <string>
- Addison-Wesley Publishing Company.
- <string>
-
- <string>
- An applet that draws different shapes depending
- <string>
- on the configuration of the HTML tag. It
- <string>
- accepts the following attributes in addition
- <string>
- to the standard attributes:
- <string>
-
- <string>
- SHAPE - on of "Line", "Rectangle", "String" or "Image"
- <string>
- COLOR - which foreground color to use.
- <string>
- TEXT - If SHAPE is "String" this is the text to draw.
- <string>
- IMAGE - If SHAPE is "Image" this is the image to draw.
- <string>
-
- <string>
-
- <integer>
- 2
- <string>
- java.awt.*
- <string>
- java.applet.*
- <storable>
- <string>
- TGraph
- <integer>
- 6
- <storable>
- <string>
- TJavaClass
- <integer>
- 12
- <integer>
- 17
- <integer>
- 282
- <integer>
- 372
- <string>
- Applet
- <integer>
- 0
- <integer>
- 20
- <storable>
- <string>
- TJavaConstructor
- <string>
-
- <string>
-
- <integer>
- 0
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- destroy
- <string>
-
- <integer>
- 0
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- getAppletContext
- <string>
- AppletContext
- <integer>
- 0
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- getAppletInfo
- <string>
- String
- <integer>
- 0
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- getAudioClip
- <string>
- AudioClip
- <integer>
- 1
- <storable>
- <string>
- TJavaArgument
- <string>
- url
- <string>
- URL
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- getAudioClip
- <string>
- AudioClip
- <integer>
- 2
- <storable>
- <string>
- TJavaArgument
- <string>
- url
- <string>
- URL
- <storable>
- <string>
- TJavaArgument
- <string>
- name
- <string>
- String
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- getCodeBase
- <string>
- URL
- <integer>
- 0
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- getDocumentBase
- <string>
- URL
- <integer>
- 0
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- getImage
- <string>
- Image
- <integer>
- 2
- <storable>
- <string>
- TJavaArgument
- <string>
- url
- <string>
- URL
- <storable>
- <string>
- TJavaArgument
- <string>
- imageName
- <string>
- String
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- getParameter
- <string>
- String
- <integer>
- 1
- <storable>
- <string>
- TJavaArgument
- <string>
- name
- <string>
- String
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- getParameterInfo
- <string>
- String[][]
- <integer>
- 0
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- init
- <string>
-
- <integer>
- 0
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- isActive
- <string>
- boolean
- <integer>
- 0
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- play
- <string>
-
- <integer>
- 2
- <storable>
- <string>
- TJavaArgument
- <string>
- url
- <string>
- URL
- <storable>
- <string>
- TJavaArgument
- <string>
- name
- <string>
- String
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- resize
- <string>
-
- <integer>
- 1
- <storable>
- <string>
- TJavaArgument
- <string>
- dim
- <string>
- Dimension
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- resize
- <string>
-
- <integer>
- 2
- <storable>
- <string>
- TJavaArgument
- <string>
- width
- <string>
- int
- <storable>
- <string>
- TJavaArgument
- <string>
- height
- <string>
- int
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- setStub
- <string>
-
- <integer>
- 1
- <storable>
- <string>
- TJavaArgument
- <string>
- stub
- <string>
- AppletStub
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- TRUE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- showStatus
- <string>
-
- <integer>
- 1
- <storable>
- <string>
- TJavaArgument
- <string>
- message
- <string>
- String
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- start
- <string>
-
- <integer>
- 0
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaMethod
- <string>
- stop
- <string>
-
- <integer>
- 0
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 0
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <integer>
- 0
- <storable>
- <string>
- TJavaInterface
- <integer>
- 302
- <integer>
- 17
- <integer>
- 532
- <integer>
- 162
- <string>
- AppletContext
- <integer>
- 0
- <integer>
- 7
- <storable>
- <string>
- TJavaOperation
- <string>
- getApplet
- <string>
- Applet
- <integer>
- 1
- <storable>
- <string>
- TJavaArgument
- <string>
- name
- <string>
- String
- <storable>
- <string>
- TJavaOperation
- <string>
- getApplets
- <string>
- Enumeration
- <integer>
- 0
- <storable>
- <string>
- TJavaOperation
- <string>
- getAudioClip
- <string>
- AudioClip
- <integer>
- 1
- <storable>
- <string>
- TJavaArgument
- <string>
- url
- <string>
- URL
- <storable>
- <string>
- TJavaOperation
- <string>
- getImage
- <string>
- Image
- <integer>
- 1
- <storable>
- <string>
- TJavaArgument
- <string>
- url
- <string>
- URL
- <storable>
- <string>
- TJavaOperation
- <string>
- showDocument
- <string>
-
- <integer>
- 1
- <storable>
- <string>
- TJavaArgument
- <string>
- url
- <string>
- URL
- <storable>
- <string>
- TJavaOperation
- <string>
- showDocument
- <string>
-
- <integer>
- 2
- <storable>
- <string>
- TJavaArgument
- <string>
- url
- <string>
- URL
- <storable>
- <string>
- TJavaArgument
- <string>
- target
- <string>
- String
- <storable>
- <string>
- TJavaOperation
- <string>
- showStatus
- <string>
-
- <integer>
- 1
- <storable>
- <string>
- TJavaArgument
- <string>
- message
- <string>
- String
- <integer>
- 0
- <boolean>
- FALSE
- <storable>
- <string>
- TJavaInterface
- <integer>
- 547
- <integer>
- 17
- <integer>
- 752
- <integer>
- 147
- <string>
- AppletStub
- <integer>
- 0
- <integer>
- 6
- <storable>
- <string>
- TJavaOperation
- <string>
- appletResize
- <string>
-
- <integer>
- 2
- <storable>
- <string>
- TJavaArgument
- <string>
- width
- <string>
- int
- <storable>
- <string>
- TJavaArgument
- <string>
- height
- <string>
- int
- <storable>
- <string>
- TJavaOperation
- <string>
- getAppletContext
- <string>
- AppletContext
- <integer>
- 0
- <storable>
- <string>
- TJavaOperation
- <string>
- getCodeBase
- <string>
- URL
- <integer>
- 0
- <storable>
- <string>
- TJavaOperation
- <string>
- getDocumentBase
- <string>
- URL
- <integer>
- 0
- <storable>
- <string>
- TJavaOperation
- <string>
- getParameter
- <string>
- String
- <integer>
- 1
- <storable>
- <string>
- TJavaArgument
- <string>
- name
- <string>
- String
- <storable>
- <string>
- TJavaOperation
- <string>
- isActive
- <string>
- boolean
- <integer>
- 0
- <integer>
- 0
- <boolean>
- FALSE
- <storable>
- <string>
- TJavaInterface
- <integer>
- 642
- <integer>
- 157
- <integer>
- 752
- <integer>
- 237
- <string>
- AudioClip
- <integer>
- 0
- <integer>
- 3
- <storable>
- <string>
- TJavaOperation
- <string>
- loop
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaOperation
- <string>
- play
- <string>
-
- <integer>
- 0
- <storable>
- <string>
- TJavaOperation
- <string>
- stop
- <string>
-
- <integer>
- 0
- <integer>
- 0
- <boolean>
- FALSE
- <storable>
- <string>
- TJavaClass
- <integer>
- 307
- <integer>
- 192
- <integer>
- 632
- <integer>
- 372
- <string>
- GraphicsApplet
- <integer>
- 5
- <storable>
- <string>
- TJavaAttribute
- <string>
- appFont
- <string>
- Font
- <string>
-
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <storable>
- <string>
- TJavaAttribute
- <string>
- appColor
- <string>
- Color
- <string>
-
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <storable>
- <string>
- TJavaAttribute
- <string>
- appShape
- <string>
- String
- <string>
-
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <storable>
- <string>
- TJavaAttribute
- <string>
- appText
- <string>
- String
- <string>
-
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <storable>
- <string>
- TJavaAttribute
- <string>
- image
- <string>
- Image
- <string>
-
- <integer>
- 0
- <boolean>
- FALSE
- <boolean>
- FALSE
- <integer>
- 4
- <storable>
- <string>
- TJavaMethod
- <string>
- init
- <string>
-
- <integer>
- 0
- <integer>
- 3
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 20
- <string>
- appFont = new Font("Helvetica", Font.BOLD,
- <string>
- 14);
- <string>
- String arg = getParameter("COLOR");
- <string>
- if (arg != null) {
- <string>
- appColor = colorFromString(arg,
- <string>
- Color.red);
- <string>
- }
- <string>
- appShape = getParameter("SHAPE");
- <string>
- if (appShape == null) {
- <string>
- appShape = "Line";
- <string>
- }
- <string>
- appText = getParameter("TEXT");
- <string>
- if (appText == null) {
- <string>
- appText = "Graphics";
- <string>
- }
- <string>
- arg = getParameter("IMAGE");
- <string>
- if (arg != null) {
- <string>
- image = getImage(getDocumentBase(),
- <string>
- arg);
- <string>
- }
- <storable>
- <string>
- TJavaMethod
- <string>
- colorFromString
- <string>
- Color
- <integer>
- 2
- <storable>
- <string>
- TJavaArgument
- <string>
- s
- <string>
- String
- <storable>
- <string>
- TJavaArgument
- <string>
- defaultColor
- <string>
- Color
- <integer>
- 3
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 7
- <string>
- Integer i;
- <string>
- try {
- <string>
- i = Integer.valueOf(s, 16);
- <string>
- return new Color(i.intValue());
- <string>
- } catch (NumberFormatException e) {
- <string>
- return defaultColor;
- <string>
- }
- <storable>
- <string>
- TJavaMethod
- <string>
- drawCenteredString
- <string>
-
- <integer>
- 3
- <storable>
- <string>
- TJavaArgument
- <string>
- s
- <string>
- String
- <storable>
- <string>
- TJavaArgument
- <string>
- g
- <string>
- Graphics
- <storable>
- <string>
- TJavaArgument
- <string>
- r
- <string>
- Dimension
- <integer>
- 3
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 4
- <string>
- FontMetrics fm = g.getFontMetrics(appFont);
- <string>
- g.drawString(s,
- <string>
- (r.width - fm.stringWidth(s)) / 2,
- <string>
- (r.height - fm.getHeight()) / 2);
- <storable>
- <string>
- TJavaMethod
- <string>
- paint
- <string>
-
- <integer>
- 1
- <storable>
- <string>
- TJavaArgument
- <string>
- g
- <string>
- Graphics
- <integer>
- 3
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <boolean>
- FALSE
- <string>
-
- <integer>
- 17
- <string>
- Dimension r = size();
- <string>
- g.setColor(appColor);
- <string>
- if (appShape.equalsIgnoreCase("line")) {
- <string>
- g.drawLine(0, 0, r.width, r.height);
- <string>
- } else if
- <string>
- (appShape.equalsIgnoreCase("rectangle")) {
- <string>
- g.drawRect(0, 0, r.width - 1, r.height
- <string>
- - 1);
- <string>
- } else if (appShape.equalsIgnoreCase("image"))
- <string>
- {
- <string>
- g.drawImage(image, 0, 0, r.width,
- <string>
- r.height, this);
- <string>
- } else if
- <string>
- (appShape.equalsIgnoreCase("string")) {
- <string>
- g.setFont(appFont);
- <string>
- drawCenteredString(appText, g, r);
- <string>
- }
- <integer>
- 1
- <boolean>
- FALSE
- <boolean>
- TRUE
- <integer>
- 0
- <storable>
- <string>
- TInheritance
- <integer>
- 137
- <integer>
- 412
- <integer>
- 157
- <integer>
- 432
- <integer>
- 3
- <storable>
- <string>
- TSuperClassing
- <integer>
- 0
- <integer>
- 0
- <integer>
- 4
- <integer>
- 202
- <integer>
- 372
- <integer>
- 202
- <integer>
- 372
- <integer>
- 202
- <integer>
- 372
- <integer>
- 202
- <integer>
- 372
- <storable>
- <string>
- TSuperClassing
- <integer>
- 0
- <integer>
- 5
- <integer>
- 2
- <integer>
- 147
- <integer>
- 372
- <integer>
- 147
- <integer>
- 412
- <storable>
- <string>
- TSubClassing
- <integer>
- 5
- <integer>
- 4
- <integer>
- 3
- <integer>
- 157
- <integer>
- 432
- <integer>
- 467
- <integer>
- 432
- <integer>
- 467
- <integer>
- 372
-