1 // 2 // Description: 3 // SWFTextField Class 4 // 5 // Authors: 6 // Jonathan Shore <jshore@e-shuppan.com> 7 // Based on php wrapper developed by <dave@opaque.net> 8 // 9 // Copyright: 10 // Copyright 2001 E-Publishing Group Inc. Permission is granted to use or 11 // modify this code provided that the original copyright notice is included. 12 // 13 // This software is distributed with no warranty of liability, merchantability, 14 // or fitness for a specific purpose. 15 // 16 17 18 // 19 // SWFText Class 20 // text field 21 // 22 // Notes 23 // - 24 // 25 public class SWFTextField extends SWFObject implements SWFTextFieldI { 26 SWFTextField()27 public SWFTextField () 28 throws SWFException 29 { 30 setHandle (nNew()); 31 } 32 finalize()33 protected void finalize() 34 throws Throwable 35 { 36 nDestroy (handle); 37 super.finalize(); 38 } 39 40 41 42 // methods 43 setBounds(float width, float height)44 public void setBounds (float width, float height) 45 { nSetBounds (handle, width, height); } setFlags(long flags)46 public void setFlags (long flags) 47 { nSetFlags (handle, flags); } setHeight( float height )48 public void setHeight( float height ) 49 { nSetHeight( handle, height ); } setAlignment(int alignment)50 public void setAlignment (int alignment) 51 { nSetAlignment (handle, alignment); } align(int alignment)52 public void align (int alignment) 53 { nSetAlignment (handle, alignment); } 54 setFont(SWFFontI font)55 public void setFont (SWFFontI font) 56 throws SWFException 57 { 58 font.eval(); 59 nSetFont (handle, font.getHandle()); 60 preserve (font); 61 } 62 setColor(int r, int g, int b, int alpha)63 public void setColor (int r, int g, int b, int alpha) 64 { nSetColor (handle, r,g,b, alpha); } setColor(SWFColor color)65 public void setColor (SWFColor color) 66 { nSetColor (handle, color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()); } 67 addString(String text)68 public void addString (String text) 69 { nAddString (handle, text); } setVariableName(String name)70 public void setVariableName (String name) 71 { nSetVariableName (handle, name); } 72 setLeftMargin(float margin)73 public void setLeftMargin (float margin) 74 { nSetLeftMargin (handle, margin); } setRightMargin(float margin)75 public void setRightMargin (float margin) 76 { nSetRightMargin (handle, margin); } setIndentation(float indent)77 public void setIndentation (float indent) 78 { nSetIndentation (handle, indent); } setLineSpacing(float spacing)79 public void setLineSpacing (float spacing) 80 { nSetLineSpacing (handle, spacing); } setLength(int len)81 public void setLength (int len) 82 { nSetLength (handle, len); } 83 84 85 // native methods 86 nNew()87 protected native int nNew (); nDestroy(int handle)88 protected native void nDestroy (int handle); 89 nSetFont(int handle, int Hfont)90 protected native void nSetFont (int handle, int Hfont); nSetColor(int handle, int r, int g, int b, int alpha)91 protected native void nSetColor (int handle, int r, int g, int b, int alpha); 92 nSetHeight( int handle, float height )93 protected native void nSetHeight( int handle, float height ); nAddString(int handle, String text)94 protected native void nAddString (int handle, String text); 95 nSetBounds(int handle, float width, float height)96 protected native void nSetBounds (int handle, float width, float height); nSetFlags(int handle, long flags)97 protected native void nSetFlags (int handle, long flags); nSetAlignment(int handle, int alignment)98 protected native void nSetAlignment (int handle, int alignment); 99 nSetVariableName(int handle, String name)100 protected native void nSetVariableName (int handle, String name); 101 nSetLeftMargin(int handle, float margin)102 protected native void nSetLeftMargin (int handle, float margin); nSetRightMargin(int handle, float margin)103 protected native void nSetRightMargin (int handle, float margin); nSetIndentation(int handle, float indent)104 protected native void nSetIndentation (int handle, float indent); nSetLineSpacing(int handle, float spacing)105 protected native void nSetLineSpacing (int handle, float spacing); nSetLength(int handle, int len)106 protected native void nSetLength (int handle, int len); 107 108 }; 109 110 111 112 113