java abridged documentation table of contentsacase/classes/spring14/ua101-002/notes/exam... ·...
TRANSCRIPT
Java Abridged Documentation
Table of ContentsJava Abridged Documentation1Appendix A System (javalangSystem) Library 1Appendix B Math (javalangMath) Library2Appendix C Array (javautilArrays) Library 4Appendix D Primitive Wrappers8
D11 Integer Class Methods8D12 Double Class Methods 10
Appendix E String Class Methods10Appendix F Random Class Methods 13Appendix G InputOutput Classes 14
G11 Scanner Class 14G12 PrintWriter Class 16G13 File Class17
Appendix H Java SWINGAWT Graphics Classes 19H11 Layout Managers19
H111 BorderLayout Class 19H112 GridLayout Class20H113 FlowLayout Class21
H12 Event Listeners21H121 ActionListener Interface 21H122 MouseListener Interface22H123 MouseMotionListener Interface 22
H13 Color Class 22H14 ImageIcon Class 23H15 Component Class 24H16 Container Class 30
Appendix I Proccessing Graphics Framework 32I11 PApplet Class (abridged) 32
Appendix J ArrayList (javautilArrayList) Library37Appendix K URL Class 38
Appendix A System (javalangSystem) Library
Field Summarystatic PrintStream err The standard error output stream
static InputStream in The standard input stream
static PrintStream out The standard output stream
Method Summarystatic void arraycopy(Object src int srcPos Object dest int destPos int length)
Copies an array from the specified source array beginning at the specified position to the specified position of the destination array
static String clearProperty(String key) Removes the system property indicated by the specified key
1
static Console console() Returns the unique Console object associated with the current Java virtual machine if any
static long currentTimeMillis() Returns the current time in milliseconds
static void exit(int status) Terminates the currently running Java Virtual Machine
static void gc() Runs the garbage collector
static Properties
getProperties() Determines the current system properties
static String getProperty(String key) Gets the system property indicated by the specified key
static String getProperty(String key String def) Gets the system property indicated by the specified key
static SecurityManager
getSecurityManager() Gets the system security interface
static void load(String filename) Loads a code file with the specified filename from the local file system as a dynamic library
static void loadLibrary(String libname) Loads the system library specified by the libname argument
static void setErr(PrintStream err) Reassigns the standard error output stream
static void setIn(InputStream in) Reassigns the standard input stream
static void setOut(PrintStream out) Reassigns the standard output stream
static void setProperties(Properties props) Sets the system properties to the Properties argument
static String setProperty(String key String value) Sets the system property indicated by the specified key
static void setSecurityManager(SecurityManager s) Sets the System security
Appendix B Math (javalangMath) Library
Field Summarystatic double
E The double value that is closer than any other to e the base of the natural logarithms
static double
PI The double value that is closer than any other to pi the ratio of the circumference of a circle to its diameter
Method Summarystatic double abs(double a)
Returns the absolute value of a double value
static float abs(float a) Returns the absolute value of a float value
static int abs(int a) Returns the absolute value of an int value
static long abs(long a) Returns the absolute value of a long value
2
static double acos(double a) Returns the arc cosine of a value the returned angle is in the range 00 through pi
static double asin(double a) Returns the arc sine of a value the returned angle is in the range -pi2 through pi2
static double atan(double a) Returns the arc tangent of a value the returned angle is in the range -pi2 through pi2
static double atan2(double y double x) Returns the angle theta from the conversion of rectangular coordinates (x y) to polar coordinates (r theta)
static double cbrt(double a) Returns the cube root of a double value
static double ceil(double a) Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer
static double cos(double a) Returns the trigonometric cosine of an angle
static double cosh(double x) Returns the hyperbolic cosine of a double value
static double exp(double a) Returns Eulers number e raised to the power of a double value
static double expm1(double x)
Returns ex -1
static double floor(double a) Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer
static int getExponent(double d) Returns the unbiased exponent used in the representation of a double
static int getExponent(float f) Returns the unbiased exponent used in the representation of a float
static double hypot(double x double y)
Returns sqrt(x2 +y2) without intermediate overflow or underflow
static double log(double a) Returns the natural logarithm (base e) of a double value
static double log10(double a) Returns the base 10 logarithm of a double value
static double log1p(double x) Returns the natural logarithm of the sum of the argument and 1
static double max(double a double b) Returns the greater of two double values
static float max(float a float b) Returns the greater of two float values
static int max(int a int b) Returns the greater of two int values
static long max(long a long b) Returns the greater of two long values
static double min(double a double b) Returns the smaller of two double values
static float min(float a float b) Returns the smaller of two float values
static int min(int a int b) Returns the smaller of two int values
3
static long min(long a long b) Returns the smaller of two long values
static double nextAfter(double start double direction) Returns the floating-point number adjacent to the first argument in the direction of the second argument
static float nextAfter(float start double direction) Returns the floating-point number adjacent to the first argument in the direction of the second argument
static double nextUp(double d) Returns the floating-point value adjacent to d in the direction of positive infinity
static float nextUp(float f) Returns the floating-point value adjacent to f in the direction of positive infinity
static double pow(double a double b) Returns the value of the first argument raised to the power of the second argument
static double random() Returns a double value with a positive sign greater than or equal to 00 and less than 10
static double rint(double a) Returns the double value that is closest in value to the argument and is equal to a mathematical integer
static long round(double a) Returns the closest long to the argument
static int round(float a) Returns the closest int to the argument
static double scalb(double d int scaleFactor) Return d times 2scaleFactor rounded as if performed by a single correctly rounded floating-point multiply to a member of the double value set
static float scalb(float f int scaleFactor) Return f times 2scaleFactor rounded as if performed by a single correctly rounded floating-point multiply to a member of the float value set
static double sin(double a) Returns the trigonometric sine of an angle
static double sinh(double x) Returns the hyperbolic sine of a double value
static double sqrt(double a) Returns the correctly rounded positive square root of a double value
static double tan(double a) Returns the trigonometric tangent of an angle
static double tanh(double x) Returns the hyperbolic tangent of a double value
static double toDegrees(double angrad) Converts an angle measured in radians to an approximately equivalent angle measured in degrees
static double toRadians(double angdeg) Converts an angle measured in degrees to an approximately equivalent angle measured in radians
Appendix C Array (javautilArrays) Library
Method Summarystatic
ltTgt ListltTgtasList(T a) Returns a fixed-size list backed by the specified array
static int binarySearch(byte[] a byte key) Searches the specified array of bytes for the specified value using the binary search algorithm
static int binarySearch(byte[] a int fromIndex int toIndex byte key) Searches a range of the specified array of bytes for the specified value using the binary search algorithm
static int binarySearch(char[] a char key)
4
Searches the specified array of chars for the specified value using the binary search algorithm
static int binarySearch(char[] a int fromIndex int toIndex char key) Searches a range of the specified array of chars for the specified value using the binary search algorithm
static int binarySearch(double[] a double key) Searches the specified array of doubles for the specified value using the binary search algorithm
static int binarySearch(double[] a int fromIndex int toIndex double key) Searches a range of the specified array of doubles for the specified value using the binary search algorithm
static int binarySearch(float[] a float key) Searches the specified array of floats for the specified value using the binary search algorithm
static int binarySearch(float[] a int fromIndex int toIndex float key) Searches a range of the specified array of floats for the specified value using the binary search algorithm
static int binarySearch(int[] a int key) Searches the specified array of ints for the specified value using the binary search algorithm
static int binarySearch(int[] a int fromIndex int toIndex int key) Searches a range of the specified array of ints for the specified value using the binary search algorithm
static int binarySearch(long[] a int fromIndex int toIndex long key) Searches a range of the specified array of longs for the specified value using the binary search algorithm
static int binarySearch(long[] a long key) Searches the specified array of longs for the specified value using the binary search algorithm
static int binarySearch(Object[] a int fromIndex int toIndex Object key) Searches a range of the specified array for the specified object using the binary search algorithm
static int binarySearch(Object[] a Object key) Searches the specified array for the specified object using the binary search algorithm
staticltTgt int
binarySearch(T[] a int fromIndex int toIndex T key Comparatorlt super Tgt c) Searches a range of the specified array for the specified object using the binary search algorithm
staticltTgt int
binarySearch(T[] a T key Comparatorlt super Tgt c) Searches the specified array for the specified object using the binary search algorithm
static boolean[]
copyOf(boolean[] original int newLength) Copies the specified array truncating or padding with false (if necessary) so the copy has the specified length
static byte[]
copyOf(byte[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static char[]
copyOf(char[] original int newLength) Copies the specified array truncating or padding with null characters (if necessary) so the copy has the specified length
static double[]
copyOf(double[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static float[]
copyOf(float[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static int[]
copyOf(int[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static long[]
copyOf(long[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
staticltTgt T[]
copyOf(T[] original int newLength) Copies the specified array truncating or padding with nulls (if necessary) so the copy has the specified length
static copyOf(U[] original int newLength Classlt extends T[]gt newType)
5
ltTUgt T[] Copies the specified array truncating or padding with nulls (if necessary) so the copy has the specified length
static boolean[]
copyOfRange(boolean[] original int from int to) Copies the specified range of the specified array into a new array
static byte[]
copyOfRange(byte[] original int from int to) Copies the specified range of the specified array into a new array
static char[]
copyOfRange(char[] original int from int to) Copies the specified range of the specified array into a new array
static double[]
copyOfRange(double[] original int from int to) Copies the specified range of the specified array into a new array
static float[]
copyOfRange(float[] original int from int to) Copies the specified range of the specified array into a new array
static int[]
copyOfRange(int[] original int from int to) Copies the specified range of the specified array into a new array
static long[]
copyOfRange(long[] original int from int to) Copies the specified range of the specified array into a new array
staticltTgt T[]
copyOfRange(T[] original int from int to) Copies the specified range of the specified array into a new array
staticltTUgt T[]
copyOfRange(U[] original int from int to Classlt extends T[]gt newType) Copies the specified range of the specified array into a new array
static boolean
deepEquals(Object[] a1 Object[] a2) Returns true if the two specified arrays are deeply equal to one another
static String
deepToString(Object[] a) Returns a string representation of the deep contents of the specified array
static boolean
equals(boolean[] a boolean[] a2) Returns true if the two specified arrays of booleans are equal to one another
static boolean
equals(byte[] a byte[] a2) Returns true if the two specified arrays of bytes are equal to one another
static boolean
equals(char[] a char[] a2) Returns true if the two specified arrays of chars are equal to one another
static boolean
equals(double[] a double[] a2) Returns true if the two specified arrays of doubles are equal to one another
static boolean
equals(float[] a float[] a2) Returns true if the two specified arrays of floats are equal to one another
static boolean
equals(int[] a int[] a2) Returns true if the two specified arrays of ints are equal to one another
static boolean
equals(long[] a long[] a2) Returns true if the two specified arrays of longs are equal to one another
static boolean
equals(Object[] a Object[] a2) Returns true if the two specified arrays of Objects are equal to one another
static void fill(boolean[] a boolean val) Assigns the specified boolean value to each element of the specified array of booleans
static void fill(boolean[] a int fromIndex int toIndex boolean val) Assigns the specified boolean value to each element of the specified range of the specified array of booleans
static void fill(byte[] a byte val) Assigns the specified byte value to each element of the specified array of bytes
static void fill(byte[] a int fromIndex int toIndex byte val) Assigns the specified byte value to each element of the specified range of the specified array of bytes
static void fill(char[] a char val) Assigns the specified char value to each element of the specified array of chars
static void fill(char[] a int fromIndex int toIndex char val) Assigns the specified char value to each element of the specified range of the specified array of chars
6
static void fill(double[] a double val) Assigns the specified double value to each element of the specified array of doubles
static void fill(double[] a int fromIndex int toIndex double val) Assigns the specified double value to each element of the specified range of the specified array of doubles
static void fill(float[] a float val) Assigns the specified float value to each element of the specified array of floats
static void fill(float[] a int fromIndex int toIndex float val) Assigns the specified float value to each element of the specified range of the specified array of floats
static void fill(int[] a int val) Assigns the specified int value to each element of the specified array of ints
static void fill(int[] a int fromIndex int toIndex int val) Assigns the specified int value to each element of the specified range of the specified array of ints
static void fill(long[] a int fromIndex int toIndex long val) Assigns the specified long value to each element of the specified range of the specified array of longs
static void fill(long[] a long val) Assigns the specified long value to each element of the specified array of longs
static void fill(Object[] a int fromIndex int toIndex Object val) Assigns the specified Object reference to each element of the specified range of the specified array of Objects
static void fill(Object[] a Object val) Assigns the specified Object reference to each element of the specified array of Objects
static void sort(byte[] a) Sorts the specified array of bytes into ascending numerical order
static void sort(byte[] a int fromIndex int toIndex) Sorts the specified range of the specified array of bytes into ascending numerical order
static void sort(char[] a) Sorts the specified array of chars into ascending numerical order
static void sort(char[] a int fromIndex int toIndex) Sorts the specified range of the specified array of chars into ascending numerical order
static void sort(double[] a) Sorts the specified array of doubles into ascending numerical order
static void sort(double[] a int fromIndex int toIndex) Sorts the specified range of the specified array of doubles into ascending numerical order
static void sort(float[] a) Sorts the specified array of floats into ascending numerical order
static void sort(float[] a int fromIndex int toIndex) Sorts the specified range of the specified array of floats into ascending numerical order
static void sort(int[] a) Sorts the specified array of ints into ascending numerical order
static void sort(int[] a int fromIndex int toIndex) Sorts the specified range of the specified array of ints into ascending numerical order
static void sort(long[] a) Sorts the specified array of longs into ascending numerical order
static void sort(long[] a int fromIndex int toIndex) Sorts the specified range of the specified array of longs into ascending numerical order
static void sort(Object[] a) Sorts the specified array of objects into ascending order according to the natural ordering of its elements
static void sort(Object[] a int fromIndex int toIndex) Sorts the specified range of the specified array of objects into ascending order according to the natural ordering of its elements
static sort(T[] a Comparatorlt super Tgt c)
7
ltTgt void Sorts the specified array of objects according to the order induced by the specified comparator
staticltTgt void
sort(T[] a int fromIndex int toIndex Comparatorlt super Tgt c) Sorts the specified range of the specified array of objects according to the order induced by the specified comparator
static String
toString(boolean[] a) Returns a string representation of the contents of the specified array
static String
toString(byte[] a) Returns a string representation of the contents of the specified array
static String
toString(char[] a) Returns a string representation of the contents of the specified array
static String
toString(double[] a) Returns a string representation of the contents of the specified array
static String
toString(float[] a) Returns a string representation of the contents of the specified array
static String
toString(int[] a) Returns a string representation of the contents of the specified array
static String
toString(long[] a) Returns a string representation of the contents of the specified array
static String
toString(Object[] a) Returns a string representation of the contents of the specified array
Appendix D Primitive Wrappers
D11 Integer Class Methods
Method Summarystatic int bitCount(int i)
Returns the number of one-bits in the twos complement binary representation of the specified int value
byte byteValue() Returns the value of this Integer as a byte
int compareTo(Integer anotherInteger) Compares two Integer objects numerically
static Integer
decode(String nm) Decodes a String into an Integer
double doubleValue() Returns the value of this Integer as a double
boolean equals(Object obj) Compares this object to the specified object
float floatValue() Returns the value of this Integer as a float
static Integer
getInteger(String nm) Determines the integer value of the system property with the specified name
static Integer
getInteger(String nm int val) Determines the integer value of the system property with the specified name
static Integer
getInteger(String nm Integer val) Returns the integer value of the system property with the specified name
static int highestOneBit(int i) Returns an int value with at most a single one-bit in the position of the highest-order (leftmost) one-bit in the specified int value
int intValue()
8
Returns the value of this Integer as an int
long longValue() Returns the value of this Integer as a long
static int lowestOneBit(int i) Returns an int value with at most a single one-bit in the position of the lowest-order (rightmost) one-bit in the specified int value
static int numberOfLeadingZeros(int i) Returns the number of zero bits preceding the highest-order (leftmost) one-bit in the twos complement binary representation of the specified int value
static int numberOfTrailingZeros(int i) Returns the number of zero bits following the lowest-order (rightmost) one-bit in the twos complement binary representation of the specified int value
static int parseInt(String s) Parses the string argument as a signed decimal integer
static int parseInt(String s int radix) Parses the string argument as a signed integer in the radix specified by the second argument
static int reverse(int i) Returns the value obtained by reversing the order of the bits in the twos complement binary representation of the specified int value
static int reverseBytes(int i) Returns the value obtained by reversing the order of the bytes in the twos complement representation of the specified int value
static int rotateLeft(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue left by the specified number of bits
static int rotateRight(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue right by the specified number of bits
static String toBinaryString(int i) Returns a string representation of the integer argument as an unsigned integer in base 2
static String toHexString(int i) Returns a string representation of the integer argument as an unsigned integer in base 16
static String toOctalString(int i) Returns a string representation of the integer argument as an unsigned integer in base 8
String toString() Returns a String object representing this Integers value
static String toString(int i) Returns a String object representing the specified integer
static String toString(int i int radix) Returns a string representation of the first argument in the radix specified by the second argument
static Integer
valueOf(int i) Returns a Integer instance representing the specified int value
static Integer
valueOf(String s) Returns an Integer object holding the value of the specified String
static Integer
valueOf(String s int radix) Returns an Integer object holding the value extracted from the specified String when parsed with the radix given by the second argument
D12 Double Class Methods
Method Summary byte byteValue()
9
Returns the value of this Double as a byte (by casting to a byte)
static int compare(double d1 double d2) Compares the two specified double values
int compareTo(Double anotherDouble) Compares two Double objects numerically
double doubleValue() Returns the double value of this Double object
boolean equals(Object obj) Compares this object against the specified object
float floatValue() Returns the float value of this Double object
int intValue() Returns the value of this Double as an int (by casting to type int)
boolean isInfinite() Returns true if this Double value is infinitely large in magnitude false otherwise
static boolean isInfinite(double v) Returns true if the specified number is infinitely large in magnitude false otherwise
boolean isNaN() Returns true if this Double value is a Not-a-Number (NaN) false otherwise
static boolean isNaN(double v) Returns true if the specified number is a Not-a-Number (NaN) value false otherwise
static double longBitsToDouble(long bits) Returns the double value corresponding to a given bit representation
long longValue() Returns the value of this Double as a long (by casting to type long)
static double parseDouble(String s) Returns a new double initialized to the value represented by the specified String as performed by thevalueOf method of class Double
static String toHexString(double d) Returns a hexadecimal string representation of the double argument
String toString() Returns a string representation of this Double object
static String toString(double d) Returns a string representation of the double argument
static Double valueOf(double d) Returns a Double instance representing the specified double value
static Double valueOf(String s) Returns a Double object holding the double value represented by the argument string s
Appendix E String Class Methods
Method Summary char charAt(int index)
Returns the char value at the specified index
int codePointAt(int index) Returns the character (Unicode code point) at the specified index
int codePointBefore(int index) Returns the character (Unicode code point) before the specified index
int codePointCount(int beginIndex int endIndex) Returns the number of Unicode code points in the specified text range of this String
10
int compareTo(String anotherString) Compares two strings lexicographically
int compareToIgnoreCase(String str) Compares two strings lexicographically ignoring case differences
String concat(String str) Concatenates the specified string to the end of this string
boolean contains(CharSequence s) Returns true if and only if this string contains the specified sequence of char values
boolean contentEquals(CharSequence cs) Compares this string to the specified CharSequence
boolean contentEquals(StringBuffer sb) Compares this string to the specified StringBuffer
static String
copyValueOf(char[] data) Returns a String that represents the character sequence in the array specified
static String
copyValueOf(char[] data int offset int count) Returns a String that represents the character sequence in the array specified
boolean endsWith(String suffix) Tests if this string ends with the specified suffix
boolean equals(Object anObject) Compares this string to the specified object
boolean equalsIgnoreCase(String anotherString) Compares this String to another String ignoring case considerations
static String
format(String format Object args) Returns a formatted string using the specified format string and arguments
byte[] getBytes() Encodes this String into a sequence of bytes using the platforms default charset storing the result into a new byte array
byte[] getBytes(Charset charset) Encodes this String into a sequence of bytes using the given charset storing the result into a new byte array
byte[] getBytes(String charsetName) Encodes this String into a sequence of bytes using the named charset storing the result into a new byte array
void getChars(int srcBegin int srcEnd char[] dst int dstBegin) Copies characters from this string into the destination character array
int indexOf(int ch) Returns the index within this string of the first occurrence of the specified character
int indexOf(int ch int fromIndex) Returns the index within this string of the first occurrence of the specified character starting the search at the specified index
int indexOf(String str) Returns the index within this string of the first occurrence of the specified substring
int indexOf(String str int fromIndex) Returns the index within this string of the first occurrence of the specified substring starting at the specified index
boolean isEmpty() Returns true if and only if length() is 0
int lastIndexOf(int ch) Returns the index within this string of the last occurrence of the specified character
int lastIndexOf(int ch int fromIndex) Returns the index within this string of the last occurrence of the specified character searching backward starting at the specified index
int lastIndexOf(String str)
11
Returns the index within this string of the rightmost occurrence of the specified substring
int lastIndexOf(String str int fromIndex) Returns the index within this string of the last occurrence of the specified substring searching backward starting at the specified index
int length() Returns the length of this string
boolean matches(String regex) Tells whether or not this string matches the given regular expression
int offsetByCodePoints(int index int codePointOffset) Returns the index within this String that is offset from the given index by codePointOffset code points
boolean regionMatches(boolean ignoreCase int toffset String other int ooffset int len) Tests if two string regions are equal
boolean regionMatches(int toffset String other int ooffset int len) Tests if two string regions are equal
String replace(char oldChar char newChar) Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar
String replace(CharSequence target CharSequence replacement) Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence
String replaceAll(String regex String replacement) Replaces each substring of this string that matches the given regular expression with the given replacement
String replaceFirst(String regex String replacement) Replaces the first substring of this string that matches the given regular expression with the given replacement
String[] split(String regex) Splits this string around matches of the given regular expression
String[] split(String regex int limit) Splits this string around matches of the given regular expression
boolean startsWith(String prefix) Tests if this string starts with the specified prefix
boolean startsWith(String prefix int toffset) Tests if the substring of this string beginning at the specified index starts with the specified prefix
CharSequence
subSequence(int beginIndex int endIndex) Returns a new character sequence that is a subsequence of this sequence
String substring(int beginIndex) Returns a new string that is a substring of this string
String substring(int beginIndex int endIndex) Returns a new string that is a substring of this string
char[] toCharArray() Converts this string to a new character array
String toLowerCase() Converts all of the characters in this String to lower case using the rules of the default locale
String toString() This object (which is already a string) is itself returned
String toUpperCase() Converts all of the characters in this String to upper case using the rules of the default locale
String trim() Returns a copy of the string with leading and trailing whitespace omitted
static String
valueOf(boolean b) Returns the string representation of the boolean argument
static valueOf(char c)
12
String Returns the string representation of the char argument
static String
valueOf(char[] data) Returns the string representation of the char array argument
static String
valueOf(char[] data int offset int count) Returns the string representation of a specific subarray of the char array argument
static String
valueOf(double d) Returns the string representation of the double argument
static String
valueOf(float f) Returns the string representation of the float argument
static String
valueOf(int i) Returns the string representation of the int argument
static String
valueOf(long l) Returns the string representation of the long argument
static String
valueOf(Object obj) Returns the string representation of the Object argument
Appendix F Random Class Methods
Method Summaryprotected int
next(int bits) Generates the next pseudorandom number
boolean nextBoolean() Returns the next pseudorandom uniformly distributed boolean value from this random number generators sequence
void nextBytes(byte[] bytes) Generates random bytes and places them into a user-supplied byte array
double nextDouble() Returns the next pseudorandom uniformly distributed double value between 00 and 10 from this random number generators sequence
float nextFloat() Returns the next pseudorandom uniformly distributed float value between 00 and 10 from this random number generators sequence
double nextGaussian() Returns the next pseudorandom Gaussian (normally) distributed double value with mean 00 and standard deviation 10 from this random number generators sequence
int nextInt() Returns the next pseudorandom uniformly distributed int value from this random number generators sequence
int nextInt(int n) Returns a pseudorandom uniformly distributed int value between 0 (inclusive) and the specified value (exclusive) drawn from this random number generators sequence
long nextLong() Returns the next pseudorandom uniformly distributed long value from this random number generators sequence
void setSeed(long seed) Sets the seed of this random number generator using a single long seed
Appendix G InputOutput Classes
G11 Scanner Class
Constructor Summary
13
Scanner(File source) Constructs a new Scanner that produces values scanned from the specified file
Scanner(InputStream source) Constructs a new Scanner that produces values scanned from the specified input stream
Scanner(InputStream source String charsetName) Constructs a new Scanner that produces values scanned from the specified input stream
Method Summary void close()
Closes this scanner
Pattern delimiter() Returns the Pattern this Scanner is currently using to match delimiters
String findInLine(Pattern pattern) Attempts to find the next occurrence of the specified pattern ignoring delimiters
String findInLine(String pattern) Attempts to find the next occurrence of a pattern constructed from the specified string ignoring delimiters
boolean hasNext() Returns true if this scanner has another token in its input
boolean hasNext(Pattern pattern) Returns true if the next complete token matches the specified pattern
boolean hasNext(String pattern) Returns true if the next token matches the pattern constructed from the specified string
boolean hasNextBoolean() Returns true if the next token in this scanners input can be interpreted as a boolean value using a case insensitive pattern created from the string true|false
boolean hasNextByte() Returns true if the next token in this scanners input can be interpreted as a byte value in the default radix using the nextByte() method
boolean hasNextByte(int radix) Returns true if the next token in this scanners input can be interpreted as a byte value in the specified radix using the nextByte() method
boolean hasNextDouble() Returns true if the next token in this scanners input can be interpreted as a double value using thenextDouble() method
boolean hasNextFloat() Returns true if the next token in this scanners input can be interpreted as a float value using thenextFloat() method
boolean hasNextInt() Returns true if the next token in this scanners input can be interpreted as an int value in the default radix using the nextInt() method
boolean hasNextInt(int radix) Returns true if the next token in this scanners input can be interpreted as an int value in the specified radix using the nextInt() method
boolean hasNextLine() Returns true if there is another line in the input of this scanner
boolean hasNextLong() Returns true if the next token in this scanners input can be interpreted as a long value in the default radix using the nextLong() method
boolean hasNextLong(int radix) Returns true if the next token in this scanners input can be interpreted as a long value in the specified radix using the nextLong() method
14
IOException ioException() Returns the IOException last thrown by this Scanners underlying Readable
MatchResult match() Returns the match result of the last scanning operation performed by this scanner
String next() Finds and returns the next complete token from this scanner
String next(Pattern pattern) Returns the next token if it matches the specified pattern
String next(String pattern) Returns the next token if it matches the pattern constructed from the specified string
boolean nextBoolean() Scans the next token of the input into a boolean value and returns that value
byte nextByte() Scans the next token of the input as a byte
byte nextByte(int radix) Scans the next token of the input as a byte
double nextDouble() Scans the next token of the input as a double
float nextFloat() Scans the next token of the input as a float
int nextInt() Scans the next token of the input as an int
int nextInt(int radix) Scans the next token of the input as an int
String nextLine() Advances this scanner past the current line and returns the input that was skipped
long nextLong() Scans the next token of the input as a long
long nextLong(int radix) Scans the next token of the input as a long
int radix() Returns this scanners default radix
void remove() The remove operation is not supported by this implementation of Iterator
Scanner reset() Resets this scanner
Scanner skip(Pattern pattern) Skips input that matches the specified pattern ignoring delimiters
Scanner skip(String pattern) Skips input that matches a pattern constructed from the specified string
String toString() Returns the string representation of this Scanner
Scanner useDelimiter(Pattern pattern) Sets this scanners delimiting pattern to the specified pattern
Scanner useDelimiter(String pattern) Sets this scanners delimiting pattern to a pattern constructed from the specified String
Scanner useRadix(int radix) Sets this scanners default radix to the specified radix
15
G12 PrintWriter Class
Constructor SummaryPrintWriter(File file) Creates a new PrintWriter without automatic line flushing with the specified file
Method SummaryPrintWriter append(char c)
Appends the specified character to this writer
PrintWriter append(CharSequence csq) Appends the specified character sequence to this writer
PrintWriter append(CharSequence csq int start int end) Appends a subsequence of the specified character sequence to this writer
boolean checkError() Flushes the stream if its not closed and checks its error state
protected void
clearError() Clears the error state of this stream
void close() Closes the stream and releases any system resources associated with it
void flush() Flushes the stream
PrintWriter format(String format Object args) Writes a formatted string to this writer using the specified format string and arguments
void print(boolean b) Prints a boolean value
void print(char c) Prints a character
void print(char[] s) Prints an array of characters
void print(double d) Prints a double-precision floating-point number
void print(float f) Prints a floating-point number
void print(int i) Prints an integer
void print(long l) Prints a long integer
void print(Object obj) Prints an object
void print(String s) Prints a string
PrintWriter printf(String format Object args) A convenience method to write a formatted string to this writer using the specified format string and arguments
void println() Terminates the current line by writing the line separator string
void println(boolean x) Prints a boolean value and then terminates the line
void println(char x) Prints a character and then terminates the line
16
void println(char[] x) Prints an array of characters and then terminates the line
void println(double x) Prints a double-precision floating-point number and then terminates the line
void println(float x) Prints a floating-point number and then terminates the line
void println(int x) Prints an integer and then terminates the line
void println(long x) Prints a long integer and then terminates the line
void println(Object x) Prints an Object and then terminates the line
void println(String x) Prints a String and then terminates the line
protected void
setError() Indicates that an error has occurred
void write(char[] buf) Writes an array of characters
void write(char[] buf int off int len) Writes A Portion of an array of characters
void write(int c) Writes a single character
void write(String s) Writes a string
void write(String s int off int len) Writes a portion of a string
G13 File Class
Constructor SummaryFile(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname
File(URI uri) Creates a new File instance by converting the given file URI into an abstract pathname
Method Summaryboolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname
boolean canRead() Tests whether the application can read the file denoted by this abstract pathname
boolean canWrite() Tests whether the application can modify the file denoted by this abstract pathname
boolean createNewFile() Atomically creates a new empty file named by this abstract pathname if and only if a file with this name does not yet exist
static File
createTempFile(String prefix String suffix) Creates an empty file in the default temporary-file directory using the given prefix and suffix to generate its name
static File
createTempFile(String prefix String suffix File directory) Creates a new empty file in the specified directory using the given prefix and suffix strings to generate its name
boolean delete()
17
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
static Console console() Returns the unique Console object associated with the current Java virtual machine if any
static long currentTimeMillis() Returns the current time in milliseconds
static void exit(int status) Terminates the currently running Java Virtual Machine
static void gc() Runs the garbage collector
static Properties
getProperties() Determines the current system properties
static String getProperty(String key) Gets the system property indicated by the specified key
static String getProperty(String key String def) Gets the system property indicated by the specified key
static SecurityManager
getSecurityManager() Gets the system security interface
static void load(String filename) Loads a code file with the specified filename from the local file system as a dynamic library
static void loadLibrary(String libname) Loads the system library specified by the libname argument
static void setErr(PrintStream err) Reassigns the standard error output stream
static void setIn(InputStream in) Reassigns the standard input stream
static void setOut(PrintStream out) Reassigns the standard output stream
static void setProperties(Properties props) Sets the system properties to the Properties argument
static String setProperty(String key String value) Sets the system property indicated by the specified key
static void setSecurityManager(SecurityManager s) Sets the System security
Appendix B Math (javalangMath) Library
Field Summarystatic double
E The double value that is closer than any other to e the base of the natural logarithms
static double
PI The double value that is closer than any other to pi the ratio of the circumference of a circle to its diameter
Method Summarystatic double abs(double a)
Returns the absolute value of a double value
static float abs(float a) Returns the absolute value of a float value
static int abs(int a) Returns the absolute value of an int value
static long abs(long a) Returns the absolute value of a long value
2
static double acos(double a) Returns the arc cosine of a value the returned angle is in the range 00 through pi
static double asin(double a) Returns the arc sine of a value the returned angle is in the range -pi2 through pi2
static double atan(double a) Returns the arc tangent of a value the returned angle is in the range -pi2 through pi2
static double atan2(double y double x) Returns the angle theta from the conversion of rectangular coordinates (x y) to polar coordinates (r theta)
static double cbrt(double a) Returns the cube root of a double value
static double ceil(double a) Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer
static double cos(double a) Returns the trigonometric cosine of an angle
static double cosh(double x) Returns the hyperbolic cosine of a double value
static double exp(double a) Returns Eulers number e raised to the power of a double value
static double expm1(double x)
Returns ex -1
static double floor(double a) Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer
static int getExponent(double d) Returns the unbiased exponent used in the representation of a double
static int getExponent(float f) Returns the unbiased exponent used in the representation of a float
static double hypot(double x double y)
Returns sqrt(x2 +y2) without intermediate overflow or underflow
static double log(double a) Returns the natural logarithm (base e) of a double value
static double log10(double a) Returns the base 10 logarithm of a double value
static double log1p(double x) Returns the natural logarithm of the sum of the argument and 1
static double max(double a double b) Returns the greater of two double values
static float max(float a float b) Returns the greater of two float values
static int max(int a int b) Returns the greater of two int values
static long max(long a long b) Returns the greater of two long values
static double min(double a double b) Returns the smaller of two double values
static float min(float a float b) Returns the smaller of two float values
static int min(int a int b) Returns the smaller of two int values
3
static long min(long a long b) Returns the smaller of two long values
static double nextAfter(double start double direction) Returns the floating-point number adjacent to the first argument in the direction of the second argument
static float nextAfter(float start double direction) Returns the floating-point number adjacent to the first argument in the direction of the second argument
static double nextUp(double d) Returns the floating-point value adjacent to d in the direction of positive infinity
static float nextUp(float f) Returns the floating-point value adjacent to f in the direction of positive infinity
static double pow(double a double b) Returns the value of the first argument raised to the power of the second argument
static double random() Returns a double value with a positive sign greater than or equal to 00 and less than 10
static double rint(double a) Returns the double value that is closest in value to the argument and is equal to a mathematical integer
static long round(double a) Returns the closest long to the argument
static int round(float a) Returns the closest int to the argument
static double scalb(double d int scaleFactor) Return d times 2scaleFactor rounded as if performed by a single correctly rounded floating-point multiply to a member of the double value set
static float scalb(float f int scaleFactor) Return f times 2scaleFactor rounded as if performed by a single correctly rounded floating-point multiply to a member of the float value set
static double sin(double a) Returns the trigonometric sine of an angle
static double sinh(double x) Returns the hyperbolic sine of a double value
static double sqrt(double a) Returns the correctly rounded positive square root of a double value
static double tan(double a) Returns the trigonometric tangent of an angle
static double tanh(double x) Returns the hyperbolic tangent of a double value
static double toDegrees(double angrad) Converts an angle measured in radians to an approximately equivalent angle measured in degrees
static double toRadians(double angdeg) Converts an angle measured in degrees to an approximately equivalent angle measured in radians
Appendix C Array (javautilArrays) Library
Method Summarystatic
ltTgt ListltTgtasList(T a) Returns a fixed-size list backed by the specified array
static int binarySearch(byte[] a byte key) Searches the specified array of bytes for the specified value using the binary search algorithm
static int binarySearch(byte[] a int fromIndex int toIndex byte key) Searches a range of the specified array of bytes for the specified value using the binary search algorithm
static int binarySearch(char[] a char key)
4
Searches the specified array of chars for the specified value using the binary search algorithm
static int binarySearch(char[] a int fromIndex int toIndex char key) Searches a range of the specified array of chars for the specified value using the binary search algorithm
static int binarySearch(double[] a double key) Searches the specified array of doubles for the specified value using the binary search algorithm
static int binarySearch(double[] a int fromIndex int toIndex double key) Searches a range of the specified array of doubles for the specified value using the binary search algorithm
static int binarySearch(float[] a float key) Searches the specified array of floats for the specified value using the binary search algorithm
static int binarySearch(float[] a int fromIndex int toIndex float key) Searches a range of the specified array of floats for the specified value using the binary search algorithm
static int binarySearch(int[] a int key) Searches the specified array of ints for the specified value using the binary search algorithm
static int binarySearch(int[] a int fromIndex int toIndex int key) Searches a range of the specified array of ints for the specified value using the binary search algorithm
static int binarySearch(long[] a int fromIndex int toIndex long key) Searches a range of the specified array of longs for the specified value using the binary search algorithm
static int binarySearch(long[] a long key) Searches the specified array of longs for the specified value using the binary search algorithm
static int binarySearch(Object[] a int fromIndex int toIndex Object key) Searches a range of the specified array for the specified object using the binary search algorithm
static int binarySearch(Object[] a Object key) Searches the specified array for the specified object using the binary search algorithm
staticltTgt int
binarySearch(T[] a int fromIndex int toIndex T key Comparatorlt super Tgt c) Searches a range of the specified array for the specified object using the binary search algorithm
staticltTgt int
binarySearch(T[] a T key Comparatorlt super Tgt c) Searches the specified array for the specified object using the binary search algorithm
static boolean[]
copyOf(boolean[] original int newLength) Copies the specified array truncating or padding with false (if necessary) so the copy has the specified length
static byte[]
copyOf(byte[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static char[]
copyOf(char[] original int newLength) Copies the specified array truncating or padding with null characters (if necessary) so the copy has the specified length
static double[]
copyOf(double[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static float[]
copyOf(float[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static int[]
copyOf(int[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static long[]
copyOf(long[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
staticltTgt T[]
copyOf(T[] original int newLength) Copies the specified array truncating or padding with nulls (if necessary) so the copy has the specified length
static copyOf(U[] original int newLength Classlt extends T[]gt newType)
5
ltTUgt T[] Copies the specified array truncating or padding with nulls (if necessary) so the copy has the specified length
static boolean[]
copyOfRange(boolean[] original int from int to) Copies the specified range of the specified array into a new array
static byte[]
copyOfRange(byte[] original int from int to) Copies the specified range of the specified array into a new array
static char[]
copyOfRange(char[] original int from int to) Copies the specified range of the specified array into a new array
static double[]
copyOfRange(double[] original int from int to) Copies the specified range of the specified array into a new array
static float[]
copyOfRange(float[] original int from int to) Copies the specified range of the specified array into a new array
static int[]
copyOfRange(int[] original int from int to) Copies the specified range of the specified array into a new array
static long[]
copyOfRange(long[] original int from int to) Copies the specified range of the specified array into a new array
staticltTgt T[]
copyOfRange(T[] original int from int to) Copies the specified range of the specified array into a new array
staticltTUgt T[]
copyOfRange(U[] original int from int to Classlt extends T[]gt newType) Copies the specified range of the specified array into a new array
static boolean
deepEquals(Object[] a1 Object[] a2) Returns true if the two specified arrays are deeply equal to one another
static String
deepToString(Object[] a) Returns a string representation of the deep contents of the specified array
static boolean
equals(boolean[] a boolean[] a2) Returns true if the two specified arrays of booleans are equal to one another
static boolean
equals(byte[] a byte[] a2) Returns true if the two specified arrays of bytes are equal to one another
static boolean
equals(char[] a char[] a2) Returns true if the two specified arrays of chars are equal to one another
static boolean
equals(double[] a double[] a2) Returns true if the two specified arrays of doubles are equal to one another
static boolean
equals(float[] a float[] a2) Returns true if the two specified arrays of floats are equal to one another
static boolean
equals(int[] a int[] a2) Returns true if the two specified arrays of ints are equal to one another
static boolean
equals(long[] a long[] a2) Returns true if the two specified arrays of longs are equal to one another
static boolean
equals(Object[] a Object[] a2) Returns true if the two specified arrays of Objects are equal to one another
static void fill(boolean[] a boolean val) Assigns the specified boolean value to each element of the specified array of booleans
static void fill(boolean[] a int fromIndex int toIndex boolean val) Assigns the specified boolean value to each element of the specified range of the specified array of booleans
static void fill(byte[] a byte val) Assigns the specified byte value to each element of the specified array of bytes
static void fill(byte[] a int fromIndex int toIndex byte val) Assigns the specified byte value to each element of the specified range of the specified array of bytes
static void fill(char[] a char val) Assigns the specified char value to each element of the specified array of chars
static void fill(char[] a int fromIndex int toIndex char val) Assigns the specified char value to each element of the specified range of the specified array of chars
6
static void fill(double[] a double val) Assigns the specified double value to each element of the specified array of doubles
static void fill(double[] a int fromIndex int toIndex double val) Assigns the specified double value to each element of the specified range of the specified array of doubles
static void fill(float[] a float val) Assigns the specified float value to each element of the specified array of floats
static void fill(float[] a int fromIndex int toIndex float val) Assigns the specified float value to each element of the specified range of the specified array of floats
static void fill(int[] a int val) Assigns the specified int value to each element of the specified array of ints
static void fill(int[] a int fromIndex int toIndex int val) Assigns the specified int value to each element of the specified range of the specified array of ints
static void fill(long[] a int fromIndex int toIndex long val) Assigns the specified long value to each element of the specified range of the specified array of longs
static void fill(long[] a long val) Assigns the specified long value to each element of the specified array of longs
static void fill(Object[] a int fromIndex int toIndex Object val) Assigns the specified Object reference to each element of the specified range of the specified array of Objects
static void fill(Object[] a Object val) Assigns the specified Object reference to each element of the specified array of Objects
static void sort(byte[] a) Sorts the specified array of bytes into ascending numerical order
static void sort(byte[] a int fromIndex int toIndex) Sorts the specified range of the specified array of bytes into ascending numerical order
static void sort(char[] a) Sorts the specified array of chars into ascending numerical order
static void sort(char[] a int fromIndex int toIndex) Sorts the specified range of the specified array of chars into ascending numerical order
static void sort(double[] a) Sorts the specified array of doubles into ascending numerical order
static void sort(double[] a int fromIndex int toIndex) Sorts the specified range of the specified array of doubles into ascending numerical order
static void sort(float[] a) Sorts the specified array of floats into ascending numerical order
static void sort(float[] a int fromIndex int toIndex) Sorts the specified range of the specified array of floats into ascending numerical order
static void sort(int[] a) Sorts the specified array of ints into ascending numerical order
static void sort(int[] a int fromIndex int toIndex) Sorts the specified range of the specified array of ints into ascending numerical order
static void sort(long[] a) Sorts the specified array of longs into ascending numerical order
static void sort(long[] a int fromIndex int toIndex) Sorts the specified range of the specified array of longs into ascending numerical order
static void sort(Object[] a) Sorts the specified array of objects into ascending order according to the natural ordering of its elements
static void sort(Object[] a int fromIndex int toIndex) Sorts the specified range of the specified array of objects into ascending order according to the natural ordering of its elements
static sort(T[] a Comparatorlt super Tgt c)
7
ltTgt void Sorts the specified array of objects according to the order induced by the specified comparator
staticltTgt void
sort(T[] a int fromIndex int toIndex Comparatorlt super Tgt c) Sorts the specified range of the specified array of objects according to the order induced by the specified comparator
static String
toString(boolean[] a) Returns a string representation of the contents of the specified array
static String
toString(byte[] a) Returns a string representation of the contents of the specified array
static String
toString(char[] a) Returns a string representation of the contents of the specified array
static String
toString(double[] a) Returns a string representation of the contents of the specified array
static String
toString(float[] a) Returns a string representation of the contents of the specified array
static String
toString(int[] a) Returns a string representation of the contents of the specified array
static String
toString(long[] a) Returns a string representation of the contents of the specified array
static String
toString(Object[] a) Returns a string representation of the contents of the specified array
Appendix D Primitive Wrappers
D11 Integer Class Methods
Method Summarystatic int bitCount(int i)
Returns the number of one-bits in the twos complement binary representation of the specified int value
byte byteValue() Returns the value of this Integer as a byte
int compareTo(Integer anotherInteger) Compares two Integer objects numerically
static Integer
decode(String nm) Decodes a String into an Integer
double doubleValue() Returns the value of this Integer as a double
boolean equals(Object obj) Compares this object to the specified object
float floatValue() Returns the value of this Integer as a float
static Integer
getInteger(String nm) Determines the integer value of the system property with the specified name
static Integer
getInteger(String nm int val) Determines the integer value of the system property with the specified name
static Integer
getInteger(String nm Integer val) Returns the integer value of the system property with the specified name
static int highestOneBit(int i) Returns an int value with at most a single one-bit in the position of the highest-order (leftmost) one-bit in the specified int value
int intValue()
8
Returns the value of this Integer as an int
long longValue() Returns the value of this Integer as a long
static int lowestOneBit(int i) Returns an int value with at most a single one-bit in the position of the lowest-order (rightmost) one-bit in the specified int value
static int numberOfLeadingZeros(int i) Returns the number of zero bits preceding the highest-order (leftmost) one-bit in the twos complement binary representation of the specified int value
static int numberOfTrailingZeros(int i) Returns the number of zero bits following the lowest-order (rightmost) one-bit in the twos complement binary representation of the specified int value
static int parseInt(String s) Parses the string argument as a signed decimal integer
static int parseInt(String s int radix) Parses the string argument as a signed integer in the radix specified by the second argument
static int reverse(int i) Returns the value obtained by reversing the order of the bits in the twos complement binary representation of the specified int value
static int reverseBytes(int i) Returns the value obtained by reversing the order of the bytes in the twos complement representation of the specified int value
static int rotateLeft(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue left by the specified number of bits
static int rotateRight(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue right by the specified number of bits
static String toBinaryString(int i) Returns a string representation of the integer argument as an unsigned integer in base 2
static String toHexString(int i) Returns a string representation of the integer argument as an unsigned integer in base 16
static String toOctalString(int i) Returns a string representation of the integer argument as an unsigned integer in base 8
String toString() Returns a String object representing this Integers value
static String toString(int i) Returns a String object representing the specified integer
static String toString(int i int radix) Returns a string representation of the first argument in the radix specified by the second argument
static Integer
valueOf(int i) Returns a Integer instance representing the specified int value
static Integer
valueOf(String s) Returns an Integer object holding the value of the specified String
static Integer
valueOf(String s int radix) Returns an Integer object holding the value extracted from the specified String when parsed with the radix given by the second argument
D12 Double Class Methods
Method Summary byte byteValue()
9
Returns the value of this Double as a byte (by casting to a byte)
static int compare(double d1 double d2) Compares the two specified double values
int compareTo(Double anotherDouble) Compares two Double objects numerically
double doubleValue() Returns the double value of this Double object
boolean equals(Object obj) Compares this object against the specified object
float floatValue() Returns the float value of this Double object
int intValue() Returns the value of this Double as an int (by casting to type int)
boolean isInfinite() Returns true if this Double value is infinitely large in magnitude false otherwise
static boolean isInfinite(double v) Returns true if the specified number is infinitely large in magnitude false otherwise
boolean isNaN() Returns true if this Double value is a Not-a-Number (NaN) false otherwise
static boolean isNaN(double v) Returns true if the specified number is a Not-a-Number (NaN) value false otherwise
static double longBitsToDouble(long bits) Returns the double value corresponding to a given bit representation
long longValue() Returns the value of this Double as a long (by casting to type long)
static double parseDouble(String s) Returns a new double initialized to the value represented by the specified String as performed by thevalueOf method of class Double
static String toHexString(double d) Returns a hexadecimal string representation of the double argument
String toString() Returns a string representation of this Double object
static String toString(double d) Returns a string representation of the double argument
static Double valueOf(double d) Returns a Double instance representing the specified double value
static Double valueOf(String s) Returns a Double object holding the double value represented by the argument string s
Appendix E String Class Methods
Method Summary char charAt(int index)
Returns the char value at the specified index
int codePointAt(int index) Returns the character (Unicode code point) at the specified index
int codePointBefore(int index) Returns the character (Unicode code point) before the specified index
int codePointCount(int beginIndex int endIndex) Returns the number of Unicode code points in the specified text range of this String
10
int compareTo(String anotherString) Compares two strings lexicographically
int compareToIgnoreCase(String str) Compares two strings lexicographically ignoring case differences
String concat(String str) Concatenates the specified string to the end of this string
boolean contains(CharSequence s) Returns true if and only if this string contains the specified sequence of char values
boolean contentEquals(CharSequence cs) Compares this string to the specified CharSequence
boolean contentEquals(StringBuffer sb) Compares this string to the specified StringBuffer
static String
copyValueOf(char[] data) Returns a String that represents the character sequence in the array specified
static String
copyValueOf(char[] data int offset int count) Returns a String that represents the character sequence in the array specified
boolean endsWith(String suffix) Tests if this string ends with the specified suffix
boolean equals(Object anObject) Compares this string to the specified object
boolean equalsIgnoreCase(String anotherString) Compares this String to another String ignoring case considerations
static String
format(String format Object args) Returns a formatted string using the specified format string and arguments
byte[] getBytes() Encodes this String into a sequence of bytes using the platforms default charset storing the result into a new byte array
byte[] getBytes(Charset charset) Encodes this String into a sequence of bytes using the given charset storing the result into a new byte array
byte[] getBytes(String charsetName) Encodes this String into a sequence of bytes using the named charset storing the result into a new byte array
void getChars(int srcBegin int srcEnd char[] dst int dstBegin) Copies characters from this string into the destination character array
int indexOf(int ch) Returns the index within this string of the first occurrence of the specified character
int indexOf(int ch int fromIndex) Returns the index within this string of the first occurrence of the specified character starting the search at the specified index
int indexOf(String str) Returns the index within this string of the first occurrence of the specified substring
int indexOf(String str int fromIndex) Returns the index within this string of the first occurrence of the specified substring starting at the specified index
boolean isEmpty() Returns true if and only if length() is 0
int lastIndexOf(int ch) Returns the index within this string of the last occurrence of the specified character
int lastIndexOf(int ch int fromIndex) Returns the index within this string of the last occurrence of the specified character searching backward starting at the specified index
int lastIndexOf(String str)
11
Returns the index within this string of the rightmost occurrence of the specified substring
int lastIndexOf(String str int fromIndex) Returns the index within this string of the last occurrence of the specified substring searching backward starting at the specified index
int length() Returns the length of this string
boolean matches(String regex) Tells whether or not this string matches the given regular expression
int offsetByCodePoints(int index int codePointOffset) Returns the index within this String that is offset from the given index by codePointOffset code points
boolean regionMatches(boolean ignoreCase int toffset String other int ooffset int len) Tests if two string regions are equal
boolean regionMatches(int toffset String other int ooffset int len) Tests if two string regions are equal
String replace(char oldChar char newChar) Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar
String replace(CharSequence target CharSequence replacement) Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence
String replaceAll(String regex String replacement) Replaces each substring of this string that matches the given regular expression with the given replacement
String replaceFirst(String regex String replacement) Replaces the first substring of this string that matches the given regular expression with the given replacement
String[] split(String regex) Splits this string around matches of the given regular expression
String[] split(String regex int limit) Splits this string around matches of the given regular expression
boolean startsWith(String prefix) Tests if this string starts with the specified prefix
boolean startsWith(String prefix int toffset) Tests if the substring of this string beginning at the specified index starts with the specified prefix
CharSequence
subSequence(int beginIndex int endIndex) Returns a new character sequence that is a subsequence of this sequence
String substring(int beginIndex) Returns a new string that is a substring of this string
String substring(int beginIndex int endIndex) Returns a new string that is a substring of this string
char[] toCharArray() Converts this string to a new character array
String toLowerCase() Converts all of the characters in this String to lower case using the rules of the default locale
String toString() This object (which is already a string) is itself returned
String toUpperCase() Converts all of the characters in this String to upper case using the rules of the default locale
String trim() Returns a copy of the string with leading and trailing whitespace omitted
static String
valueOf(boolean b) Returns the string representation of the boolean argument
static valueOf(char c)
12
String Returns the string representation of the char argument
static String
valueOf(char[] data) Returns the string representation of the char array argument
static String
valueOf(char[] data int offset int count) Returns the string representation of a specific subarray of the char array argument
static String
valueOf(double d) Returns the string representation of the double argument
static String
valueOf(float f) Returns the string representation of the float argument
static String
valueOf(int i) Returns the string representation of the int argument
static String
valueOf(long l) Returns the string representation of the long argument
static String
valueOf(Object obj) Returns the string representation of the Object argument
Appendix F Random Class Methods
Method Summaryprotected int
next(int bits) Generates the next pseudorandom number
boolean nextBoolean() Returns the next pseudorandom uniformly distributed boolean value from this random number generators sequence
void nextBytes(byte[] bytes) Generates random bytes and places them into a user-supplied byte array
double nextDouble() Returns the next pseudorandom uniformly distributed double value between 00 and 10 from this random number generators sequence
float nextFloat() Returns the next pseudorandom uniformly distributed float value between 00 and 10 from this random number generators sequence
double nextGaussian() Returns the next pseudorandom Gaussian (normally) distributed double value with mean 00 and standard deviation 10 from this random number generators sequence
int nextInt() Returns the next pseudorandom uniformly distributed int value from this random number generators sequence
int nextInt(int n) Returns a pseudorandom uniformly distributed int value between 0 (inclusive) and the specified value (exclusive) drawn from this random number generators sequence
long nextLong() Returns the next pseudorandom uniformly distributed long value from this random number generators sequence
void setSeed(long seed) Sets the seed of this random number generator using a single long seed
Appendix G InputOutput Classes
G11 Scanner Class
Constructor Summary
13
Scanner(File source) Constructs a new Scanner that produces values scanned from the specified file
Scanner(InputStream source) Constructs a new Scanner that produces values scanned from the specified input stream
Scanner(InputStream source String charsetName) Constructs a new Scanner that produces values scanned from the specified input stream
Method Summary void close()
Closes this scanner
Pattern delimiter() Returns the Pattern this Scanner is currently using to match delimiters
String findInLine(Pattern pattern) Attempts to find the next occurrence of the specified pattern ignoring delimiters
String findInLine(String pattern) Attempts to find the next occurrence of a pattern constructed from the specified string ignoring delimiters
boolean hasNext() Returns true if this scanner has another token in its input
boolean hasNext(Pattern pattern) Returns true if the next complete token matches the specified pattern
boolean hasNext(String pattern) Returns true if the next token matches the pattern constructed from the specified string
boolean hasNextBoolean() Returns true if the next token in this scanners input can be interpreted as a boolean value using a case insensitive pattern created from the string true|false
boolean hasNextByte() Returns true if the next token in this scanners input can be interpreted as a byte value in the default radix using the nextByte() method
boolean hasNextByte(int radix) Returns true if the next token in this scanners input can be interpreted as a byte value in the specified radix using the nextByte() method
boolean hasNextDouble() Returns true if the next token in this scanners input can be interpreted as a double value using thenextDouble() method
boolean hasNextFloat() Returns true if the next token in this scanners input can be interpreted as a float value using thenextFloat() method
boolean hasNextInt() Returns true if the next token in this scanners input can be interpreted as an int value in the default radix using the nextInt() method
boolean hasNextInt(int radix) Returns true if the next token in this scanners input can be interpreted as an int value in the specified radix using the nextInt() method
boolean hasNextLine() Returns true if there is another line in the input of this scanner
boolean hasNextLong() Returns true if the next token in this scanners input can be interpreted as a long value in the default radix using the nextLong() method
boolean hasNextLong(int radix) Returns true if the next token in this scanners input can be interpreted as a long value in the specified radix using the nextLong() method
14
IOException ioException() Returns the IOException last thrown by this Scanners underlying Readable
MatchResult match() Returns the match result of the last scanning operation performed by this scanner
String next() Finds and returns the next complete token from this scanner
String next(Pattern pattern) Returns the next token if it matches the specified pattern
String next(String pattern) Returns the next token if it matches the pattern constructed from the specified string
boolean nextBoolean() Scans the next token of the input into a boolean value and returns that value
byte nextByte() Scans the next token of the input as a byte
byte nextByte(int radix) Scans the next token of the input as a byte
double nextDouble() Scans the next token of the input as a double
float nextFloat() Scans the next token of the input as a float
int nextInt() Scans the next token of the input as an int
int nextInt(int radix) Scans the next token of the input as an int
String nextLine() Advances this scanner past the current line and returns the input that was skipped
long nextLong() Scans the next token of the input as a long
long nextLong(int radix) Scans the next token of the input as a long
int radix() Returns this scanners default radix
void remove() The remove operation is not supported by this implementation of Iterator
Scanner reset() Resets this scanner
Scanner skip(Pattern pattern) Skips input that matches the specified pattern ignoring delimiters
Scanner skip(String pattern) Skips input that matches a pattern constructed from the specified string
String toString() Returns the string representation of this Scanner
Scanner useDelimiter(Pattern pattern) Sets this scanners delimiting pattern to the specified pattern
Scanner useDelimiter(String pattern) Sets this scanners delimiting pattern to a pattern constructed from the specified String
Scanner useRadix(int radix) Sets this scanners default radix to the specified radix
15
G12 PrintWriter Class
Constructor SummaryPrintWriter(File file) Creates a new PrintWriter without automatic line flushing with the specified file
Method SummaryPrintWriter append(char c)
Appends the specified character to this writer
PrintWriter append(CharSequence csq) Appends the specified character sequence to this writer
PrintWriter append(CharSequence csq int start int end) Appends a subsequence of the specified character sequence to this writer
boolean checkError() Flushes the stream if its not closed and checks its error state
protected void
clearError() Clears the error state of this stream
void close() Closes the stream and releases any system resources associated with it
void flush() Flushes the stream
PrintWriter format(String format Object args) Writes a formatted string to this writer using the specified format string and arguments
void print(boolean b) Prints a boolean value
void print(char c) Prints a character
void print(char[] s) Prints an array of characters
void print(double d) Prints a double-precision floating-point number
void print(float f) Prints a floating-point number
void print(int i) Prints an integer
void print(long l) Prints a long integer
void print(Object obj) Prints an object
void print(String s) Prints a string
PrintWriter printf(String format Object args) A convenience method to write a formatted string to this writer using the specified format string and arguments
void println() Terminates the current line by writing the line separator string
void println(boolean x) Prints a boolean value and then terminates the line
void println(char x) Prints a character and then terminates the line
16
void println(char[] x) Prints an array of characters and then terminates the line
void println(double x) Prints a double-precision floating-point number and then terminates the line
void println(float x) Prints a floating-point number and then terminates the line
void println(int x) Prints an integer and then terminates the line
void println(long x) Prints a long integer and then terminates the line
void println(Object x) Prints an Object and then terminates the line
void println(String x) Prints a String and then terminates the line
protected void
setError() Indicates that an error has occurred
void write(char[] buf) Writes an array of characters
void write(char[] buf int off int len) Writes A Portion of an array of characters
void write(int c) Writes a single character
void write(String s) Writes a string
void write(String s int off int len) Writes a portion of a string
G13 File Class
Constructor SummaryFile(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname
File(URI uri) Creates a new File instance by converting the given file URI into an abstract pathname
Method Summaryboolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname
boolean canRead() Tests whether the application can read the file denoted by this abstract pathname
boolean canWrite() Tests whether the application can modify the file denoted by this abstract pathname
boolean createNewFile() Atomically creates a new empty file named by this abstract pathname if and only if a file with this name does not yet exist
static File
createTempFile(String prefix String suffix) Creates an empty file in the default temporary-file directory using the given prefix and suffix to generate its name
static File
createTempFile(String prefix String suffix File directory) Creates a new empty file in the specified directory using the given prefix and suffix strings to generate its name
boolean delete()
17
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
static double acos(double a) Returns the arc cosine of a value the returned angle is in the range 00 through pi
static double asin(double a) Returns the arc sine of a value the returned angle is in the range -pi2 through pi2
static double atan(double a) Returns the arc tangent of a value the returned angle is in the range -pi2 through pi2
static double atan2(double y double x) Returns the angle theta from the conversion of rectangular coordinates (x y) to polar coordinates (r theta)
static double cbrt(double a) Returns the cube root of a double value
static double ceil(double a) Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer
static double cos(double a) Returns the trigonometric cosine of an angle
static double cosh(double x) Returns the hyperbolic cosine of a double value
static double exp(double a) Returns Eulers number e raised to the power of a double value
static double expm1(double x)
Returns ex -1
static double floor(double a) Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer
static int getExponent(double d) Returns the unbiased exponent used in the representation of a double
static int getExponent(float f) Returns the unbiased exponent used in the representation of a float
static double hypot(double x double y)
Returns sqrt(x2 +y2) without intermediate overflow or underflow
static double log(double a) Returns the natural logarithm (base e) of a double value
static double log10(double a) Returns the base 10 logarithm of a double value
static double log1p(double x) Returns the natural logarithm of the sum of the argument and 1
static double max(double a double b) Returns the greater of two double values
static float max(float a float b) Returns the greater of two float values
static int max(int a int b) Returns the greater of two int values
static long max(long a long b) Returns the greater of two long values
static double min(double a double b) Returns the smaller of two double values
static float min(float a float b) Returns the smaller of two float values
static int min(int a int b) Returns the smaller of two int values
3
static long min(long a long b) Returns the smaller of two long values
static double nextAfter(double start double direction) Returns the floating-point number adjacent to the first argument in the direction of the second argument
static float nextAfter(float start double direction) Returns the floating-point number adjacent to the first argument in the direction of the second argument
static double nextUp(double d) Returns the floating-point value adjacent to d in the direction of positive infinity
static float nextUp(float f) Returns the floating-point value adjacent to f in the direction of positive infinity
static double pow(double a double b) Returns the value of the first argument raised to the power of the second argument
static double random() Returns a double value with a positive sign greater than or equal to 00 and less than 10
static double rint(double a) Returns the double value that is closest in value to the argument and is equal to a mathematical integer
static long round(double a) Returns the closest long to the argument
static int round(float a) Returns the closest int to the argument
static double scalb(double d int scaleFactor) Return d times 2scaleFactor rounded as if performed by a single correctly rounded floating-point multiply to a member of the double value set
static float scalb(float f int scaleFactor) Return f times 2scaleFactor rounded as if performed by a single correctly rounded floating-point multiply to a member of the float value set
static double sin(double a) Returns the trigonometric sine of an angle
static double sinh(double x) Returns the hyperbolic sine of a double value
static double sqrt(double a) Returns the correctly rounded positive square root of a double value
static double tan(double a) Returns the trigonometric tangent of an angle
static double tanh(double x) Returns the hyperbolic tangent of a double value
static double toDegrees(double angrad) Converts an angle measured in radians to an approximately equivalent angle measured in degrees
static double toRadians(double angdeg) Converts an angle measured in degrees to an approximately equivalent angle measured in radians
Appendix C Array (javautilArrays) Library
Method Summarystatic
ltTgt ListltTgtasList(T a) Returns a fixed-size list backed by the specified array
static int binarySearch(byte[] a byte key) Searches the specified array of bytes for the specified value using the binary search algorithm
static int binarySearch(byte[] a int fromIndex int toIndex byte key) Searches a range of the specified array of bytes for the specified value using the binary search algorithm
static int binarySearch(char[] a char key)
4
Searches the specified array of chars for the specified value using the binary search algorithm
static int binarySearch(char[] a int fromIndex int toIndex char key) Searches a range of the specified array of chars for the specified value using the binary search algorithm
static int binarySearch(double[] a double key) Searches the specified array of doubles for the specified value using the binary search algorithm
static int binarySearch(double[] a int fromIndex int toIndex double key) Searches a range of the specified array of doubles for the specified value using the binary search algorithm
static int binarySearch(float[] a float key) Searches the specified array of floats for the specified value using the binary search algorithm
static int binarySearch(float[] a int fromIndex int toIndex float key) Searches a range of the specified array of floats for the specified value using the binary search algorithm
static int binarySearch(int[] a int key) Searches the specified array of ints for the specified value using the binary search algorithm
static int binarySearch(int[] a int fromIndex int toIndex int key) Searches a range of the specified array of ints for the specified value using the binary search algorithm
static int binarySearch(long[] a int fromIndex int toIndex long key) Searches a range of the specified array of longs for the specified value using the binary search algorithm
static int binarySearch(long[] a long key) Searches the specified array of longs for the specified value using the binary search algorithm
static int binarySearch(Object[] a int fromIndex int toIndex Object key) Searches a range of the specified array for the specified object using the binary search algorithm
static int binarySearch(Object[] a Object key) Searches the specified array for the specified object using the binary search algorithm
staticltTgt int
binarySearch(T[] a int fromIndex int toIndex T key Comparatorlt super Tgt c) Searches a range of the specified array for the specified object using the binary search algorithm
staticltTgt int
binarySearch(T[] a T key Comparatorlt super Tgt c) Searches the specified array for the specified object using the binary search algorithm
static boolean[]
copyOf(boolean[] original int newLength) Copies the specified array truncating or padding with false (if necessary) so the copy has the specified length
static byte[]
copyOf(byte[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static char[]
copyOf(char[] original int newLength) Copies the specified array truncating or padding with null characters (if necessary) so the copy has the specified length
static double[]
copyOf(double[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static float[]
copyOf(float[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static int[]
copyOf(int[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static long[]
copyOf(long[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
staticltTgt T[]
copyOf(T[] original int newLength) Copies the specified array truncating or padding with nulls (if necessary) so the copy has the specified length
static copyOf(U[] original int newLength Classlt extends T[]gt newType)
5
ltTUgt T[] Copies the specified array truncating or padding with nulls (if necessary) so the copy has the specified length
static boolean[]
copyOfRange(boolean[] original int from int to) Copies the specified range of the specified array into a new array
static byte[]
copyOfRange(byte[] original int from int to) Copies the specified range of the specified array into a new array
static char[]
copyOfRange(char[] original int from int to) Copies the specified range of the specified array into a new array
static double[]
copyOfRange(double[] original int from int to) Copies the specified range of the specified array into a new array
static float[]
copyOfRange(float[] original int from int to) Copies the specified range of the specified array into a new array
static int[]
copyOfRange(int[] original int from int to) Copies the specified range of the specified array into a new array
static long[]
copyOfRange(long[] original int from int to) Copies the specified range of the specified array into a new array
staticltTgt T[]
copyOfRange(T[] original int from int to) Copies the specified range of the specified array into a new array
staticltTUgt T[]
copyOfRange(U[] original int from int to Classlt extends T[]gt newType) Copies the specified range of the specified array into a new array
static boolean
deepEquals(Object[] a1 Object[] a2) Returns true if the two specified arrays are deeply equal to one another
static String
deepToString(Object[] a) Returns a string representation of the deep contents of the specified array
static boolean
equals(boolean[] a boolean[] a2) Returns true if the two specified arrays of booleans are equal to one another
static boolean
equals(byte[] a byte[] a2) Returns true if the two specified arrays of bytes are equal to one another
static boolean
equals(char[] a char[] a2) Returns true if the two specified arrays of chars are equal to one another
static boolean
equals(double[] a double[] a2) Returns true if the two specified arrays of doubles are equal to one another
static boolean
equals(float[] a float[] a2) Returns true if the two specified arrays of floats are equal to one another
static boolean
equals(int[] a int[] a2) Returns true if the two specified arrays of ints are equal to one another
static boolean
equals(long[] a long[] a2) Returns true if the two specified arrays of longs are equal to one another
static boolean
equals(Object[] a Object[] a2) Returns true if the two specified arrays of Objects are equal to one another
static void fill(boolean[] a boolean val) Assigns the specified boolean value to each element of the specified array of booleans
static void fill(boolean[] a int fromIndex int toIndex boolean val) Assigns the specified boolean value to each element of the specified range of the specified array of booleans
static void fill(byte[] a byte val) Assigns the specified byte value to each element of the specified array of bytes
static void fill(byte[] a int fromIndex int toIndex byte val) Assigns the specified byte value to each element of the specified range of the specified array of bytes
static void fill(char[] a char val) Assigns the specified char value to each element of the specified array of chars
static void fill(char[] a int fromIndex int toIndex char val) Assigns the specified char value to each element of the specified range of the specified array of chars
6
static void fill(double[] a double val) Assigns the specified double value to each element of the specified array of doubles
static void fill(double[] a int fromIndex int toIndex double val) Assigns the specified double value to each element of the specified range of the specified array of doubles
static void fill(float[] a float val) Assigns the specified float value to each element of the specified array of floats
static void fill(float[] a int fromIndex int toIndex float val) Assigns the specified float value to each element of the specified range of the specified array of floats
static void fill(int[] a int val) Assigns the specified int value to each element of the specified array of ints
static void fill(int[] a int fromIndex int toIndex int val) Assigns the specified int value to each element of the specified range of the specified array of ints
static void fill(long[] a int fromIndex int toIndex long val) Assigns the specified long value to each element of the specified range of the specified array of longs
static void fill(long[] a long val) Assigns the specified long value to each element of the specified array of longs
static void fill(Object[] a int fromIndex int toIndex Object val) Assigns the specified Object reference to each element of the specified range of the specified array of Objects
static void fill(Object[] a Object val) Assigns the specified Object reference to each element of the specified array of Objects
static void sort(byte[] a) Sorts the specified array of bytes into ascending numerical order
static void sort(byte[] a int fromIndex int toIndex) Sorts the specified range of the specified array of bytes into ascending numerical order
static void sort(char[] a) Sorts the specified array of chars into ascending numerical order
static void sort(char[] a int fromIndex int toIndex) Sorts the specified range of the specified array of chars into ascending numerical order
static void sort(double[] a) Sorts the specified array of doubles into ascending numerical order
static void sort(double[] a int fromIndex int toIndex) Sorts the specified range of the specified array of doubles into ascending numerical order
static void sort(float[] a) Sorts the specified array of floats into ascending numerical order
static void sort(float[] a int fromIndex int toIndex) Sorts the specified range of the specified array of floats into ascending numerical order
static void sort(int[] a) Sorts the specified array of ints into ascending numerical order
static void sort(int[] a int fromIndex int toIndex) Sorts the specified range of the specified array of ints into ascending numerical order
static void sort(long[] a) Sorts the specified array of longs into ascending numerical order
static void sort(long[] a int fromIndex int toIndex) Sorts the specified range of the specified array of longs into ascending numerical order
static void sort(Object[] a) Sorts the specified array of objects into ascending order according to the natural ordering of its elements
static void sort(Object[] a int fromIndex int toIndex) Sorts the specified range of the specified array of objects into ascending order according to the natural ordering of its elements
static sort(T[] a Comparatorlt super Tgt c)
7
ltTgt void Sorts the specified array of objects according to the order induced by the specified comparator
staticltTgt void
sort(T[] a int fromIndex int toIndex Comparatorlt super Tgt c) Sorts the specified range of the specified array of objects according to the order induced by the specified comparator
static String
toString(boolean[] a) Returns a string representation of the contents of the specified array
static String
toString(byte[] a) Returns a string representation of the contents of the specified array
static String
toString(char[] a) Returns a string representation of the contents of the specified array
static String
toString(double[] a) Returns a string representation of the contents of the specified array
static String
toString(float[] a) Returns a string representation of the contents of the specified array
static String
toString(int[] a) Returns a string representation of the contents of the specified array
static String
toString(long[] a) Returns a string representation of the contents of the specified array
static String
toString(Object[] a) Returns a string representation of the contents of the specified array
Appendix D Primitive Wrappers
D11 Integer Class Methods
Method Summarystatic int bitCount(int i)
Returns the number of one-bits in the twos complement binary representation of the specified int value
byte byteValue() Returns the value of this Integer as a byte
int compareTo(Integer anotherInteger) Compares two Integer objects numerically
static Integer
decode(String nm) Decodes a String into an Integer
double doubleValue() Returns the value of this Integer as a double
boolean equals(Object obj) Compares this object to the specified object
float floatValue() Returns the value of this Integer as a float
static Integer
getInteger(String nm) Determines the integer value of the system property with the specified name
static Integer
getInteger(String nm int val) Determines the integer value of the system property with the specified name
static Integer
getInteger(String nm Integer val) Returns the integer value of the system property with the specified name
static int highestOneBit(int i) Returns an int value with at most a single one-bit in the position of the highest-order (leftmost) one-bit in the specified int value
int intValue()
8
Returns the value of this Integer as an int
long longValue() Returns the value of this Integer as a long
static int lowestOneBit(int i) Returns an int value with at most a single one-bit in the position of the lowest-order (rightmost) one-bit in the specified int value
static int numberOfLeadingZeros(int i) Returns the number of zero bits preceding the highest-order (leftmost) one-bit in the twos complement binary representation of the specified int value
static int numberOfTrailingZeros(int i) Returns the number of zero bits following the lowest-order (rightmost) one-bit in the twos complement binary representation of the specified int value
static int parseInt(String s) Parses the string argument as a signed decimal integer
static int parseInt(String s int radix) Parses the string argument as a signed integer in the radix specified by the second argument
static int reverse(int i) Returns the value obtained by reversing the order of the bits in the twos complement binary representation of the specified int value
static int reverseBytes(int i) Returns the value obtained by reversing the order of the bytes in the twos complement representation of the specified int value
static int rotateLeft(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue left by the specified number of bits
static int rotateRight(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue right by the specified number of bits
static String toBinaryString(int i) Returns a string representation of the integer argument as an unsigned integer in base 2
static String toHexString(int i) Returns a string representation of the integer argument as an unsigned integer in base 16
static String toOctalString(int i) Returns a string representation of the integer argument as an unsigned integer in base 8
String toString() Returns a String object representing this Integers value
static String toString(int i) Returns a String object representing the specified integer
static String toString(int i int radix) Returns a string representation of the first argument in the radix specified by the second argument
static Integer
valueOf(int i) Returns a Integer instance representing the specified int value
static Integer
valueOf(String s) Returns an Integer object holding the value of the specified String
static Integer
valueOf(String s int radix) Returns an Integer object holding the value extracted from the specified String when parsed with the radix given by the second argument
D12 Double Class Methods
Method Summary byte byteValue()
9
Returns the value of this Double as a byte (by casting to a byte)
static int compare(double d1 double d2) Compares the two specified double values
int compareTo(Double anotherDouble) Compares two Double objects numerically
double doubleValue() Returns the double value of this Double object
boolean equals(Object obj) Compares this object against the specified object
float floatValue() Returns the float value of this Double object
int intValue() Returns the value of this Double as an int (by casting to type int)
boolean isInfinite() Returns true if this Double value is infinitely large in magnitude false otherwise
static boolean isInfinite(double v) Returns true if the specified number is infinitely large in magnitude false otherwise
boolean isNaN() Returns true if this Double value is a Not-a-Number (NaN) false otherwise
static boolean isNaN(double v) Returns true if the specified number is a Not-a-Number (NaN) value false otherwise
static double longBitsToDouble(long bits) Returns the double value corresponding to a given bit representation
long longValue() Returns the value of this Double as a long (by casting to type long)
static double parseDouble(String s) Returns a new double initialized to the value represented by the specified String as performed by thevalueOf method of class Double
static String toHexString(double d) Returns a hexadecimal string representation of the double argument
String toString() Returns a string representation of this Double object
static String toString(double d) Returns a string representation of the double argument
static Double valueOf(double d) Returns a Double instance representing the specified double value
static Double valueOf(String s) Returns a Double object holding the double value represented by the argument string s
Appendix E String Class Methods
Method Summary char charAt(int index)
Returns the char value at the specified index
int codePointAt(int index) Returns the character (Unicode code point) at the specified index
int codePointBefore(int index) Returns the character (Unicode code point) before the specified index
int codePointCount(int beginIndex int endIndex) Returns the number of Unicode code points in the specified text range of this String
10
int compareTo(String anotherString) Compares two strings lexicographically
int compareToIgnoreCase(String str) Compares two strings lexicographically ignoring case differences
String concat(String str) Concatenates the specified string to the end of this string
boolean contains(CharSequence s) Returns true if and only if this string contains the specified sequence of char values
boolean contentEquals(CharSequence cs) Compares this string to the specified CharSequence
boolean contentEquals(StringBuffer sb) Compares this string to the specified StringBuffer
static String
copyValueOf(char[] data) Returns a String that represents the character sequence in the array specified
static String
copyValueOf(char[] data int offset int count) Returns a String that represents the character sequence in the array specified
boolean endsWith(String suffix) Tests if this string ends with the specified suffix
boolean equals(Object anObject) Compares this string to the specified object
boolean equalsIgnoreCase(String anotherString) Compares this String to another String ignoring case considerations
static String
format(String format Object args) Returns a formatted string using the specified format string and arguments
byte[] getBytes() Encodes this String into a sequence of bytes using the platforms default charset storing the result into a new byte array
byte[] getBytes(Charset charset) Encodes this String into a sequence of bytes using the given charset storing the result into a new byte array
byte[] getBytes(String charsetName) Encodes this String into a sequence of bytes using the named charset storing the result into a new byte array
void getChars(int srcBegin int srcEnd char[] dst int dstBegin) Copies characters from this string into the destination character array
int indexOf(int ch) Returns the index within this string of the first occurrence of the specified character
int indexOf(int ch int fromIndex) Returns the index within this string of the first occurrence of the specified character starting the search at the specified index
int indexOf(String str) Returns the index within this string of the first occurrence of the specified substring
int indexOf(String str int fromIndex) Returns the index within this string of the first occurrence of the specified substring starting at the specified index
boolean isEmpty() Returns true if and only if length() is 0
int lastIndexOf(int ch) Returns the index within this string of the last occurrence of the specified character
int lastIndexOf(int ch int fromIndex) Returns the index within this string of the last occurrence of the specified character searching backward starting at the specified index
int lastIndexOf(String str)
11
Returns the index within this string of the rightmost occurrence of the specified substring
int lastIndexOf(String str int fromIndex) Returns the index within this string of the last occurrence of the specified substring searching backward starting at the specified index
int length() Returns the length of this string
boolean matches(String regex) Tells whether or not this string matches the given regular expression
int offsetByCodePoints(int index int codePointOffset) Returns the index within this String that is offset from the given index by codePointOffset code points
boolean regionMatches(boolean ignoreCase int toffset String other int ooffset int len) Tests if two string regions are equal
boolean regionMatches(int toffset String other int ooffset int len) Tests if two string regions are equal
String replace(char oldChar char newChar) Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar
String replace(CharSequence target CharSequence replacement) Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence
String replaceAll(String regex String replacement) Replaces each substring of this string that matches the given regular expression with the given replacement
String replaceFirst(String regex String replacement) Replaces the first substring of this string that matches the given regular expression with the given replacement
String[] split(String regex) Splits this string around matches of the given regular expression
String[] split(String regex int limit) Splits this string around matches of the given regular expression
boolean startsWith(String prefix) Tests if this string starts with the specified prefix
boolean startsWith(String prefix int toffset) Tests if the substring of this string beginning at the specified index starts with the specified prefix
CharSequence
subSequence(int beginIndex int endIndex) Returns a new character sequence that is a subsequence of this sequence
String substring(int beginIndex) Returns a new string that is a substring of this string
String substring(int beginIndex int endIndex) Returns a new string that is a substring of this string
char[] toCharArray() Converts this string to a new character array
String toLowerCase() Converts all of the characters in this String to lower case using the rules of the default locale
String toString() This object (which is already a string) is itself returned
String toUpperCase() Converts all of the characters in this String to upper case using the rules of the default locale
String trim() Returns a copy of the string with leading and trailing whitespace omitted
static String
valueOf(boolean b) Returns the string representation of the boolean argument
static valueOf(char c)
12
String Returns the string representation of the char argument
static String
valueOf(char[] data) Returns the string representation of the char array argument
static String
valueOf(char[] data int offset int count) Returns the string representation of a specific subarray of the char array argument
static String
valueOf(double d) Returns the string representation of the double argument
static String
valueOf(float f) Returns the string representation of the float argument
static String
valueOf(int i) Returns the string representation of the int argument
static String
valueOf(long l) Returns the string representation of the long argument
static String
valueOf(Object obj) Returns the string representation of the Object argument
Appendix F Random Class Methods
Method Summaryprotected int
next(int bits) Generates the next pseudorandom number
boolean nextBoolean() Returns the next pseudorandom uniformly distributed boolean value from this random number generators sequence
void nextBytes(byte[] bytes) Generates random bytes and places them into a user-supplied byte array
double nextDouble() Returns the next pseudorandom uniformly distributed double value between 00 and 10 from this random number generators sequence
float nextFloat() Returns the next pseudorandom uniformly distributed float value between 00 and 10 from this random number generators sequence
double nextGaussian() Returns the next pseudorandom Gaussian (normally) distributed double value with mean 00 and standard deviation 10 from this random number generators sequence
int nextInt() Returns the next pseudorandom uniformly distributed int value from this random number generators sequence
int nextInt(int n) Returns a pseudorandom uniformly distributed int value between 0 (inclusive) and the specified value (exclusive) drawn from this random number generators sequence
long nextLong() Returns the next pseudorandom uniformly distributed long value from this random number generators sequence
void setSeed(long seed) Sets the seed of this random number generator using a single long seed
Appendix G InputOutput Classes
G11 Scanner Class
Constructor Summary
13
Scanner(File source) Constructs a new Scanner that produces values scanned from the specified file
Scanner(InputStream source) Constructs a new Scanner that produces values scanned from the specified input stream
Scanner(InputStream source String charsetName) Constructs a new Scanner that produces values scanned from the specified input stream
Method Summary void close()
Closes this scanner
Pattern delimiter() Returns the Pattern this Scanner is currently using to match delimiters
String findInLine(Pattern pattern) Attempts to find the next occurrence of the specified pattern ignoring delimiters
String findInLine(String pattern) Attempts to find the next occurrence of a pattern constructed from the specified string ignoring delimiters
boolean hasNext() Returns true if this scanner has another token in its input
boolean hasNext(Pattern pattern) Returns true if the next complete token matches the specified pattern
boolean hasNext(String pattern) Returns true if the next token matches the pattern constructed from the specified string
boolean hasNextBoolean() Returns true if the next token in this scanners input can be interpreted as a boolean value using a case insensitive pattern created from the string true|false
boolean hasNextByte() Returns true if the next token in this scanners input can be interpreted as a byte value in the default radix using the nextByte() method
boolean hasNextByte(int radix) Returns true if the next token in this scanners input can be interpreted as a byte value in the specified radix using the nextByte() method
boolean hasNextDouble() Returns true if the next token in this scanners input can be interpreted as a double value using thenextDouble() method
boolean hasNextFloat() Returns true if the next token in this scanners input can be interpreted as a float value using thenextFloat() method
boolean hasNextInt() Returns true if the next token in this scanners input can be interpreted as an int value in the default radix using the nextInt() method
boolean hasNextInt(int radix) Returns true if the next token in this scanners input can be interpreted as an int value in the specified radix using the nextInt() method
boolean hasNextLine() Returns true if there is another line in the input of this scanner
boolean hasNextLong() Returns true if the next token in this scanners input can be interpreted as a long value in the default radix using the nextLong() method
boolean hasNextLong(int radix) Returns true if the next token in this scanners input can be interpreted as a long value in the specified radix using the nextLong() method
14
IOException ioException() Returns the IOException last thrown by this Scanners underlying Readable
MatchResult match() Returns the match result of the last scanning operation performed by this scanner
String next() Finds and returns the next complete token from this scanner
String next(Pattern pattern) Returns the next token if it matches the specified pattern
String next(String pattern) Returns the next token if it matches the pattern constructed from the specified string
boolean nextBoolean() Scans the next token of the input into a boolean value and returns that value
byte nextByte() Scans the next token of the input as a byte
byte nextByte(int radix) Scans the next token of the input as a byte
double nextDouble() Scans the next token of the input as a double
float nextFloat() Scans the next token of the input as a float
int nextInt() Scans the next token of the input as an int
int nextInt(int radix) Scans the next token of the input as an int
String nextLine() Advances this scanner past the current line and returns the input that was skipped
long nextLong() Scans the next token of the input as a long
long nextLong(int radix) Scans the next token of the input as a long
int radix() Returns this scanners default radix
void remove() The remove operation is not supported by this implementation of Iterator
Scanner reset() Resets this scanner
Scanner skip(Pattern pattern) Skips input that matches the specified pattern ignoring delimiters
Scanner skip(String pattern) Skips input that matches a pattern constructed from the specified string
String toString() Returns the string representation of this Scanner
Scanner useDelimiter(Pattern pattern) Sets this scanners delimiting pattern to the specified pattern
Scanner useDelimiter(String pattern) Sets this scanners delimiting pattern to a pattern constructed from the specified String
Scanner useRadix(int radix) Sets this scanners default radix to the specified radix
15
G12 PrintWriter Class
Constructor SummaryPrintWriter(File file) Creates a new PrintWriter without automatic line flushing with the specified file
Method SummaryPrintWriter append(char c)
Appends the specified character to this writer
PrintWriter append(CharSequence csq) Appends the specified character sequence to this writer
PrintWriter append(CharSequence csq int start int end) Appends a subsequence of the specified character sequence to this writer
boolean checkError() Flushes the stream if its not closed and checks its error state
protected void
clearError() Clears the error state of this stream
void close() Closes the stream and releases any system resources associated with it
void flush() Flushes the stream
PrintWriter format(String format Object args) Writes a formatted string to this writer using the specified format string and arguments
void print(boolean b) Prints a boolean value
void print(char c) Prints a character
void print(char[] s) Prints an array of characters
void print(double d) Prints a double-precision floating-point number
void print(float f) Prints a floating-point number
void print(int i) Prints an integer
void print(long l) Prints a long integer
void print(Object obj) Prints an object
void print(String s) Prints a string
PrintWriter printf(String format Object args) A convenience method to write a formatted string to this writer using the specified format string and arguments
void println() Terminates the current line by writing the line separator string
void println(boolean x) Prints a boolean value and then terminates the line
void println(char x) Prints a character and then terminates the line
16
void println(char[] x) Prints an array of characters and then terminates the line
void println(double x) Prints a double-precision floating-point number and then terminates the line
void println(float x) Prints a floating-point number and then terminates the line
void println(int x) Prints an integer and then terminates the line
void println(long x) Prints a long integer and then terminates the line
void println(Object x) Prints an Object and then terminates the line
void println(String x) Prints a String and then terminates the line
protected void
setError() Indicates that an error has occurred
void write(char[] buf) Writes an array of characters
void write(char[] buf int off int len) Writes A Portion of an array of characters
void write(int c) Writes a single character
void write(String s) Writes a string
void write(String s int off int len) Writes a portion of a string
G13 File Class
Constructor SummaryFile(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname
File(URI uri) Creates a new File instance by converting the given file URI into an abstract pathname
Method Summaryboolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname
boolean canRead() Tests whether the application can read the file denoted by this abstract pathname
boolean canWrite() Tests whether the application can modify the file denoted by this abstract pathname
boolean createNewFile() Atomically creates a new empty file named by this abstract pathname if and only if a file with this name does not yet exist
static File
createTempFile(String prefix String suffix) Creates an empty file in the default temporary-file directory using the given prefix and suffix to generate its name
static File
createTempFile(String prefix String suffix File directory) Creates a new empty file in the specified directory using the given prefix and suffix strings to generate its name
boolean delete()
17
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
static long min(long a long b) Returns the smaller of two long values
static double nextAfter(double start double direction) Returns the floating-point number adjacent to the first argument in the direction of the second argument
static float nextAfter(float start double direction) Returns the floating-point number adjacent to the first argument in the direction of the second argument
static double nextUp(double d) Returns the floating-point value adjacent to d in the direction of positive infinity
static float nextUp(float f) Returns the floating-point value adjacent to f in the direction of positive infinity
static double pow(double a double b) Returns the value of the first argument raised to the power of the second argument
static double random() Returns a double value with a positive sign greater than or equal to 00 and less than 10
static double rint(double a) Returns the double value that is closest in value to the argument and is equal to a mathematical integer
static long round(double a) Returns the closest long to the argument
static int round(float a) Returns the closest int to the argument
static double scalb(double d int scaleFactor) Return d times 2scaleFactor rounded as if performed by a single correctly rounded floating-point multiply to a member of the double value set
static float scalb(float f int scaleFactor) Return f times 2scaleFactor rounded as if performed by a single correctly rounded floating-point multiply to a member of the float value set
static double sin(double a) Returns the trigonometric sine of an angle
static double sinh(double x) Returns the hyperbolic sine of a double value
static double sqrt(double a) Returns the correctly rounded positive square root of a double value
static double tan(double a) Returns the trigonometric tangent of an angle
static double tanh(double x) Returns the hyperbolic tangent of a double value
static double toDegrees(double angrad) Converts an angle measured in radians to an approximately equivalent angle measured in degrees
static double toRadians(double angdeg) Converts an angle measured in degrees to an approximately equivalent angle measured in radians
Appendix C Array (javautilArrays) Library
Method Summarystatic
ltTgt ListltTgtasList(T a) Returns a fixed-size list backed by the specified array
static int binarySearch(byte[] a byte key) Searches the specified array of bytes for the specified value using the binary search algorithm
static int binarySearch(byte[] a int fromIndex int toIndex byte key) Searches a range of the specified array of bytes for the specified value using the binary search algorithm
static int binarySearch(char[] a char key)
4
Searches the specified array of chars for the specified value using the binary search algorithm
static int binarySearch(char[] a int fromIndex int toIndex char key) Searches a range of the specified array of chars for the specified value using the binary search algorithm
static int binarySearch(double[] a double key) Searches the specified array of doubles for the specified value using the binary search algorithm
static int binarySearch(double[] a int fromIndex int toIndex double key) Searches a range of the specified array of doubles for the specified value using the binary search algorithm
static int binarySearch(float[] a float key) Searches the specified array of floats for the specified value using the binary search algorithm
static int binarySearch(float[] a int fromIndex int toIndex float key) Searches a range of the specified array of floats for the specified value using the binary search algorithm
static int binarySearch(int[] a int key) Searches the specified array of ints for the specified value using the binary search algorithm
static int binarySearch(int[] a int fromIndex int toIndex int key) Searches a range of the specified array of ints for the specified value using the binary search algorithm
static int binarySearch(long[] a int fromIndex int toIndex long key) Searches a range of the specified array of longs for the specified value using the binary search algorithm
static int binarySearch(long[] a long key) Searches the specified array of longs for the specified value using the binary search algorithm
static int binarySearch(Object[] a int fromIndex int toIndex Object key) Searches a range of the specified array for the specified object using the binary search algorithm
static int binarySearch(Object[] a Object key) Searches the specified array for the specified object using the binary search algorithm
staticltTgt int
binarySearch(T[] a int fromIndex int toIndex T key Comparatorlt super Tgt c) Searches a range of the specified array for the specified object using the binary search algorithm
staticltTgt int
binarySearch(T[] a T key Comparatorlt super Tgt c) Searches the specified array for the specified object using the binary search algorithm
static boolean[]
copyOf(boolean[] original int newLength) Copies the specified array truncating or padding with false (if necessary) so the copy has the specified length
static byte[]
copyOf(byte[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static char[]
copyOf(char[] original int newLength) Copies the specified array truncating or padding with null characters (if necessary) so the copy has the specified length
static double[]
copyOf(double[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static float[]
copyOf(float[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static int[]
copyOf(int[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static long[]
copyOf(long[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
staticltTgt T[]
copyOf(T[] original int newLength) Copies the specified array truncating or padding with nulls (if necessary) so the copy has the specified length
static copyOf(U[] original int newLength Classlt extends T[]gt newType)
5
ltTUgt T[] Copies the specified array truncating or padding with nulls (if necessary) so the copy has the specified length
static boolean[]
copyOfRange(boolean[] original int from int to) Copies the specified range of the specified array into a new array
static byte[]
copyOfRange(byte[] original int from int to) Copies the specified range of the specified array into a new array
static char[]
copyOfRange(char[] original int from int to) Copies the specified range of the specified array into a new array
static double[]
copyOfRange(double[] original int from int to) Copies the specified range of the specified array into a new array
static float[]
copyOfRange(float[] original int from int to) Copies the specified range of the specified array into a new array
static int[]
copyOfRange(int[] original int from int to) Copies the specified range of the specified array into a new array
static long[]
copyOfRange(long[] original int from int to) Copies the specified range of the specified array into a new array
staticltTgt T[]
copyOfRange(T[] original int from int to) Copies the specified range of the specified array into a new array
staticltTUgt T[]
copyOfRange(U[] original int from int to Classlt extends T[]gt newType) Copies the specified range of the specified array into a new array
static boolean
deepEquals(Object[] a1 Object[] a2) Returns true if the two specified arrays are deeply equal to one another
static String
deepToString(Object[] a) Returns a string representation of the deep contents of the specified array
static boolean
equals(boolean[] a boolean[] a2) Returns true if the two specified arrays of booleans are equal to one another
static boolean
equals(byte[] a byte[] a2) Returns true if the two specified arrays of bytes are equal to one another
static boolean
equals(char[] a char[] a2) Returns true if the two specified arrays of chars are equal to one another
static boolean
equals(double[] a double[] a2) Returns true if the two specified arrays of doubles are equal to one another
static boolean
equals(float[] a float[] a2) Returns true if the two specified arrays of floats are equal to one another
static boolean
equals(int[] a int[] a2) Returns true if the two specified arrays of ints are equal to one another
static boolean
equals(long[] a long[] a2) Returns true if the two specified arrays of longs are equal to one another
static boolean
equals(Object[] a Object[] a2) Returns true if the two specified arrays of Objects are equal to one another
static void fill(boolean[] a boolean val) Assigns the specified boolean value to each element of the specified array of booleans
static void fill(boolean[] a int fromIndex int toIndex boolean val) Assigns the specified boolean value to each element of the specified range of the specified array of booleans
static void fill(byte[] a byte val) Assigns the specified byte value to each element of the specified array of bytes
static void fill(byte[] a int fromIndex int toIndex byte val) Assigns the specified byte value to each element of the specified range of the specified array of bytes
static void fill(char[] a char val) Assigns the specified char value to each element of the specified array of chars
static void fill(char[] a int fromIndex int toIndex char val) Assigns the specified char value to each element of the specified range of the specified array of chars
6
static void fill(double[] a double val) Assigns the specified double value to each element of the specified array of doubles
static void fill(double[] a int fromIndex int toIndex double val) Assigns the specified double value to each element of the specified range of the specified array of doubles
static void fill(float[] a float val) Assigns the specified float value to each element of the specified array of floats
static void fill(float[] a int fromIndex int toIndex float val) Assigns the specified float value to each element of the specified range of the specified array of floats
static void fill(int[] a int val) Assigns the specified int value to each element of the specified array of ints
static void fill(int[] a int fromIndex int toIndex int val) Assigns the specified int value to each element of the specified range of the specified array of ints
static void fill(long[] a int fromIndex int toIndex long val) Assigns the specified long value to each element of the specified range of the specified array of longs
static void fill(long[] a long val) Assigns the specified long value to each element of the specified array of longs
static void fill(Object[] a int fromIndex int toIndex Object val) Assigns the specified Object reference to each element of the specified range of the specified array of Objects
static void fill(Object[] a Object val) Assigns the specified Object reference to each element of the specified array of Objects
static void sort(byte[] a) Sorts the specified array of bytes into ascending numerical order
static void sort(byte[] a int fromIndex int toIndex) Sorts the specified range of the specified array of bytes into ascending numerical order
static void sort(char[] a) Sorts the specified array of chars into ascending numerical order
static void sort(char[] a int fromIndex int toIndex) Sorts the specified range of the specified array of chars into ascending numerical order
static void sort(double[] a) Sorts the specified array of doubles into ascending numerical order
static void sort(double[] a int fromIndex int toIndex) Sorts the specified range of the specified array of doubles into ascending numerical order
static void sort(float[] a) Sorts the specified array of floats into ascending numerical order
static void sort(float[] a int fromIndex int toIndex) Sorts the specified range of the specified array of floats into ascending numerical order
static void sort(int[] a) Sorts the specified array of ints into ascending numerical order
static void sort(int[] a int fromIndex int toIndex) Sorts the specified range of the specified array of ints into ascending numerical order
static void sort(long[] a) Sorts the specified array of longs into ascending numerical order
static void sort(long[] a int fromIndex int toIndex) Sorts the specified range of the specified array of longs into ascending numerical order
static void sort(Object[] a) Sorts the specified array of objects into ascending order according to the natural ordering of its elements
static void sort(Object[] a int fromIndex int toIndex) Sorts the specified range of the specified array of objects into ascending order according to the natural ordering of its elements
static sort(T[] a Comparatorlt super Tgt c)
7
ltTgt void Sorts the specified array of objects according to the order induced by the specified comparator
staticltTgt void
sort(T[] a int fromIndex int toIndex Comparatorlt super Tgt c) Sorts the specified range of the specified array of objects according to the order induced by the specified comparator
static String
toString(boolean[] a) Returns a string representation of the contents of the specified array
static String
toString(byte[] a) Returns a string representation of the contents of the specified array
static String
toString(char[] a) Returns a string representation of the contents of the specified array
static String
toString(double[] a) Returns a string representation of the contents of the specified array
static String
toString(float[] a) Returns a string representation of the contents of the specified array
static String
toString(int[] a) Returns a string representation of the contents of the specified array
static String
toString(long[] a) Returns a string representation of the contents of the specified array
static String
toString(Object[] a) Returns a string representation of the contents of the specified array
Appendix D Primitive Wrappers
D11 Integer Class Methods
Method Summarystatic int bitCount(int i)
Returns the number of one-bits in the twos complement binary representation of the specified int value
byte byteValue() Returns the value of this Integer as a byte
int compareTo(Integer anotherInteger) Compares two Integer objects numerically
static Integer
decode(String nm) Decodes a String into an Integer
double doubleValue() Returns the value of this Integer as a double
boolean equals(Object obj) Compares this object to the specified object
float floatValue() Returns the value of this Integer as a float
static Integer
getInteger(String nm) Determines the integer value of the system property with the specified name
static Integer
getInteger(String nm int val) Determines the integer value of the system property with the specified name
static Integer
getInteger(String nm Integer val) Returns the integer value of the system property with the specified name
static int highestOneBit(int i) Returns an int value with at most a single one-bit in the position of the highest-order (leftmost) one-bit in the specified int value
int intValue()
8
Returns the value of this Integer as an int
long longValue() Returns the value of this Integer as a long
static int lowestOneBit(int i) Returns an int value with at most a single one-bit in the position of the lowest-order (rightmost) one-bit in the specified int value
static int numberOfLeadingZeros(int i) Returns the number of zero bits preceding the highest-order (leftmost) one-bit in the twos complement binary representation of the specified int value
static int numberOfTrailingZeros(int i) Returns the number of zero bits following the lowest-order (rightmost) one-bit in the twos complement binary representation of the specified int value
static int parseInt(String s) Parses the string argument as a signed decimal integer
static int parseInt(String s int radix) Parses the string argument as a signed integer in the radix specified by the second argument
static int reverse(int i) Returns the value obtained by reversing the order of the bits in the twos complement binary representation of the specified int value
static int reverseBytes(int i) Returns the value obtained by reversing the order of the bytes in the twos complement representation of the specified int value
static int rotateLeft(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue left by the specified number of bits
static int rotateRight(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue right by the specified number of bits
static String toBinaryString(int i) Returns a string representation of the integer argument as an unsigned integer in base 2
static String toHexString(int i) Returns a string representation of the integer argument as an unsigned integer in base 16
static String toOctalString(int i) Returns a string representation of the integer argument as an unsigned integer in base 8
String toString() Returns a String object representing this Integers value
static String toString(int i) Returns a String object representing the specified integer
static String toString(int i int radix) Returns a string representation of the first argument in the radix specified by the second argument
static Integer
valueOf(int i) Returns a Integer instance representing the specified int value
static Integer
valueOf(String s) Returns an Integer object holding the value of the specified String
static Integer
valueOf(String s int radix) Returns an Integer object holding the value extracted from the specified String when parsed with the radix given by the second argument
D12 Double Class Methods
Method Summary byte byteValue()
9
Returns the value of this Double as a byte (by casting to a byte)
static int compare(double d1 double d2) Compares the two specified double values
int compareTo(Double anotherDouble) Compares two Double objects numerically
double doubleValue() Returns the double value of this Double object
boolean equals(Object obj) Compares this object against the specified object
float floatValue() Returns the float value of this Double object
int intValue() Returns the value of this Double as an int (by casting to type int)
boolean isInfinite() Returns true if this Double value is infinitely large in magnitude false otherwise
static boolean isInfinite(double v) Returns true if the specified number is infinitely large in magnitude false otherwise
boolean isNaN() Returns true if this Double value is a Not-a-Number (NaN) false otherwise
static boolean isNaN(double v) Returns true if the specified number is a Not-a-Number (NaN) value false otherwise
static double longBitsToDouble(long bits) Returns the double value corresponding to a given bit representation
long longValue() Returns the value of this Double as a long (by casting to type long)
static double parseDouble(String s) Returns a new double initialized to the value represented by the specified String as performed by thevalueOf method of class Double
static String toHexString(double d) Returns a hexadecimal string representation of the double argument
String toString() Returns a string representation of this Double object
static String toString(double d) Returns a string representation of the double argument
static Double valueOf(double d) Returns a Double instance representing the specified double value
static Double valueOf(String s) Returns a Double object holding the double value represented by the argument string s
Appendix E String Class Methods
Method Summary char charAt(int index)
Returns the char value at the specified index
int codePointAt(int index) Returns the character (Unicode code point) at the specified index
int codePointBefore(int index) Returns the character (Unicode code point) before the specified index
int codePointCount(int beginIndex int endIndex) Returns the number of Unicode code points in the specified text range of this String
10
int compareTo(String anotherString) Compares two strings lexicographically
int compareToIgnoreCase(String str) Compares two strings lexicographically ignoring case differences
String concat(String str) Concatenates the specified string to the end of this string
boolean contains(CharSequence s) Returns true if and only if this string contains the specified sequence of char values
boolean contentEquals(CharSequence cs) Compares this string to the specified CharSequence
boolean contentEquals(StringBuffer sb) Compares this string to the specified StringBuffer
static String
copyValueOf(char[] data) Returns a String that represents the character sequence in the array specified
static String
copyValueOf(char[] data int offset int count) Returns a String that represents the character sequence in the array specified
boolean endsWith(String suffix) Tests if this string ends with the specified suffix
boolean equals(Object anObject) Compares this string to the specified object
boolean equalsIgnoreCase(String anotherString) Compares this String to another String ignoring case considerations
static String
format(String format Object args) Returns a formatted string using the specified format string and arguments
byte[] getBytes() Encodes this String into a sequence of bytes using the platforms default charset storing the result into a new byte array
byte[] getBytes(Charset charset) Encodes this String into a sequence of bytes using the given charset storing the result into a new byte array
byte[] getBytes(String charsetName) Encodes this String into a sequence of bytes using the named charset storing the result into a new byte array
void getChars(int srcBegin int srcEnd char[] dst int dstBegin) Copies characters from this string into the destination character array
int indexOf(int ch) Returns the index within this string of the first occurrence of the specified character
int indexOf(int ch int fromIndex) Returns the index within this string of the first occurrence of the specified character starting the search at the specified index
int indexOf(String str) Returns the index within this string of the first occurrence of the specified substring
int indexOf(String str int fromIndex) Returns the index within this string of the first occurrence of the specified substring starting at the specified index
boolean isEmpty() Returns true if and only if length() is 0
int lastIndexOf(int ch) Returns the index within this string of the last occurrence of the specified character
int lastIndexOf(int ch int fromIndex) Returns the index within this string of the last occurrence of the specified character searching backward starting at the specified index
int lastIndexOf(String str)
11
Returns the index within this string of the rightmost occurrence of the specified substring
int lastIndexOf(String str int fromIndex) Returns the index within this string of the last occurrence of the specified substring searching backward starting at the specified index
int length() Returns the length of this string
boolean matches(String regex) Tells whether or not this string matches the given regular expression
int offsetByCodePoints(int index int codePointOffset) Returns the index within this String that is offset from the given index by codePointOffset code points
boolean regionMatches(boolean ignoreCase int toffset String other int ooffset int len) Tests if two string regions are equal
boolean regionMatches(int toffset String other int ooffset int len) Tests if two string regions are equal
String replace(char oldChar char newChar) Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar
String replace(CharSequence target CharSequence replacement) Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence
String replaceAll(String regex String replacement) Replaces each substring of this string that matches the given regular expression with the given replacement
String replaceFirst(String regex String replacement) Replaces the first substring of this string that matches the given regular expression with the given replacement
String[] split(String regex) Splits this string around matches of the given regular expression
String[] split(String regex int limit) Splits this string around matches of the given regular expression
boolean startsWith(String prefix) Tests if this string starts with the specified prefix
boolean startsWith(String prefix int toffset) Tests if the substring of this string beginning at the specified index starts with the specified prefix
CharSequence
subSequence(int beginIndex int endIndex) Returns a new character sequence that is a subsequence of this sequence
String substring(int beginIndex) Returns a new string that is a substring of this string
String substring(int beginIndex int endIndex) Returns a new string that is a substring of this string
char[] toCharArray() Converts this string to a new character array
String toLowerCase() Converts all of the characters in this String to lower case using the rules of the default locale
String toString() This object (which is already a string) is itself returned
String toUpperCase() Converts all of the characters in this String to upper case using the rules of the default locale
String trim() Returns a copy of the string with leading and trailing whitespace omitted
static String
valueOf(boolean b) Returns the string representation of the boolean argument
static valueOf(char c)
12
String Returns the string representation of the char argument
static String
valueOf(char[] data) Returns the string representation of the char array argument
static String
valueOf(char[] data int offset int count) Returns the string representation of a specific subarray of the char array argument
static String
valueOf(double d) Returns the string representation of the double argument
static String
valueOf(float f) Returns the string representation of the float argument
static String
valueOf(int i) Returns the string representation of the int argument
static String
valueOf(long l) Returns the string representation of the long argument
static String
valueOf(Object obj) Returns the string representation of the Object argument
Appendix F Random Class Methods
Method Summaryprotected int
next(int bits) Generates the next pseudorandom number
boolean nextBoolean() Returns the next pseudorandom uniformly distributed boolean value from this random number generators sequence
void nextBytes(byte[] bytes) Generates random bytes and places them into a user-supplied byte array
double nextDouble() Returns the next pseudorandom uniformly distributed double value between 00 and 10 from this random number generators sequence
float nextFloat() Returns the next pseudorandom uniformly distributed float value between 00 and 10 from this random number generators sequence
double nextGaussian() Returns the next pseudorandom Gaussian (normally) distributed double value with mean 00 and standard deviation 10 from this random number generators sequence
int nextInt() Returns the next pseudorandom uniformly distributed int value from this random number generators sequence
int nextInt(int n) Returns a pseudorandom uniformly distributed int value between 0 (inclusive) and the specified value (exclusive) drawn from this random number generators sequence
long nextLong() Returns the next pseudorandom uniformly distributed long value from this random number generators sequence
void setSeed(long seed) Sets the seed of this random number generator using a single long seed
Appendix G InputOutput Classes
G11 Scanner Class
Constructor Summary
13
Scanner(File source) Constructs a new Scanner that produces values scanned from the specified file
Scanner(InputStream source) Constructs a new Scanner that produces values scanned from the specified input stream
Scanner(InputStream source String charsetName) Constructs a new Scanner that produces values scanned from the specified input stream
Method Summary void close()
Closes this scanner
Pattern delimiter() Returns the Pattern this Scanner is currently using to match delimiters
String findInLine(Pattern pattern) Attempts to find the next occurrence of the specified pattern ignoring delimiters
String findInLine(String pattern) Attempts to find the next occurrence of a pattern constructed from the specified string ignoring delimiters
boolean hasNext() Returns true if this scanner has another token in its input
boolean hasNext(Pattern pattern) Returns true if the next complete token matches the specified pattern
boolean hasNext(String pattern) Returns true if the next token matches the pattern constructed from the specified string
boolean hasNextBoolean() Returns true if the next token in this scanners input can be interpreted as a boolean value using a case insensitive pattern created from the string true|false
boolean hasNextByte() Returns true if the next token in this scanners input can be interpreted as a byte value in the default radix using the nextByte() method
boolean hasNextByte(int radix) Returns true if the next token in this scanners input can be interpreted as a byte value in the specified radix using the nextByte() method
boolean hasNextDouble() Returns true if the next token in this scanners input can be interpreted as a double value using thenextDouble() method
boolean hasNextFloat() Returns true if the next token in this scanners input can be interpreted as a float value using thenextFloat() method
boolean hasNextInt() Returns true if the next token in this scanners input can be interpreted as an int value in the default radix using the nextInt() method
boolean hasNextInt(int radix) Returns true if the next token in this scanners input can be interpreted as an int value in the specified radix using the nextInt() method
boolean hasNextLine() Returns true if there is another line in the input of this scanner
boolean hasNextLong() Returns true if the next token in this scanners input can be interpreted as a long value in the default radix using the nextLong() method
boolean hasNextLong(int radix) Returns true if the next token in this scanners input can be interpreted as a long value in the specified radix using the nextLong() method
14
IOException ioException() Returns the IOException last thrown by this Scanners underlying Readable
MatchResult match() Returns the match result of the last scanning operation performed by this scanner
String next() Finds and returns the next complete token from this scanner
String next(Pattern pattern) Returns the next token if it matches the specified pattern
String next(String pattern) Returns the next token if it matches the pattern constructed from the specified string
boolean nextBoolean() Scans the next token of the input into a boolean value and returns that value
byte nextByte() Scans the next token of the input as a byte
byte nextByte(int radix) Scans the next token of the input as a byte
double nextDouble() Scans the next token of the input as a double
float nextFloat() Scans the next token of the input as a float
int nextInt() Scans the next token of the input as an int
int nextInt(int radix) Scans the next token of the input as an int
String nextLine() Advances this scanner past the current line and returns the input that was skipped
long nextLong() Scans the next token of the input as a long
long nextLong(int radix) Scans the next token of the input as a long
int radix() Returns this scanners default radix
void remove() The remove operation is not supported by this implementation of Iterator
Scanner reset() Resets this scanner
Scanner skip(Pattern pattern) Skips input that matches the specified pattern ignoring delimiters
Scanner skip(String pattern) Skips input that matches a pattern constructed from the specified string
String toString() Returns the string representation of this Scanner
Scanner useDelimiter(Pattern pattern) Sets this scanners delimiting pattern to the specified pattern
Scanner useDelimiter(String pattern) Sets this scanners delimiting pattern to a pattern constructed from the specified String
Scanner useRadix(int radix) Sets this scanners default radix to the specified radix
15
G12 PrintWriter Class
Constructor SummaryPrintWriter(File file) Creates a new PrintWriter without automatic line flushing with the specified file
Method SummaryPrintWriter append(char c)
Appends the specified character to this writer
PrintWriter append(CharSequence csq) Appends the specified character sequence to this writer
PrintWriter append(CharSequence csq int start int end) Appends a subsequence of the specified character sequence to this writer
boolean checkError() Flushes the stream if its not closed and checks its error state
protected void
clearError() Clears the error state of this stream
void close() Closes the stream and releases any system resources associated with it
void flush() Flushes the stream
PrintWriter format(String format Object args) Writes a formatted string to this writer using the specified format string and arguments
void print(boolean b) Prints a boolean value
void print(char c) Prints a character
void print(char[] s) Prints an array of characters
void print(double d) Prints a double-precision floating-point number
void print(float f) Prints a floating-point number
void print(int i) Prints an integer
void print(long l) Prints a long integer
void print(Object obj) Prints an object
void print(String s) Prints a string
PrintWriter printf(String format Object args) A convenience method to write a formatted string to this writer using the specified format string and arguments
void println() Terminates the current line by writing the line separator string
void println(boolean x) Prints a boolean value and then terminates the line
void println(char x) Prints a character and then terminates the line
16
void println(char[] x) Prints an array of characters and then terminates the line
void println(double x) Prints a double-precision floating-point number and then terminates the line
void println(float x) Prints a floating-point number and then terminates the line
void println(int x) Prints an integer and then terminates the line
void println(long x) Prints a long integer and then terminates the line
void println(Object x) Prints an Object and then terminates the line
void println(String x) Prints a String and then terminates the line
protected void
setError() Indicates that an error has occurred
void write(char[] buf) Writes an array of characters
void write(char[] buf int off int len) Writes A Portion of an array of characters
void write(int c) Writes a single character
void write(String s) Writes a string
void write(String s int off int len) Writes a portion of a string
G13 File Class
Constructor SummaryFile(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname
File(URI uri) Creates a new File instance by converting the given file URI into an abstract pathname
Method Summaryboolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname
boolean canRead() Tests whether the application can read the file denoted by this abstract pathname
boolean canWrite() Tests whether the application can modify the file denoted by this abstract pathname
boolean createNewFile() Atomically creates a new empty file named by this abstract pathname if and only if a file with this name does not yet exist
static File
createTempFile(String prefix String suffix) Creates an empty file in the default temporary-file directory using the given prefix and suffix to generate its name
static File
createTempFile(String prefix String suffix File directory) Creates a new empty file in the specified directory using the given prefix and suffix strings to generate its name
boolean delete()
17
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
Searches the specified array of chars for the specified value using the binary search algorithm
static int binarySearch(char[] a int fromIndex int toIndex char key) Searches a range of the specified array of chars for the specified value using the binary search algorithm
static int binarySearch(double[] a double key) Searches the specified array of doubles for the specified value using the binary search algorithm
static int binarySearch(double[] a int fromIndex int toIndex double key) Searches a range of the specified array of doubles for the specified value using the binary search algorithm
static int binarySearch(float[] a float key) Searches the specified array of floats for the specified value using the binary search algorithm
static int binarySearch(float[] a int fromIndex int toIndex float key) Searches a range of the specified array of floats for the specified value using the binary search algorithm
static int binarySearch(int[] a int key) Searches the specified array of ints for the specified value using the binary search algorithm
static int binarySearch(int[] a int fromIndex int toIndex int key) Searches a range of the specified array of ints for the specified value using the binary search algorithm
static int binarySearch(long[] a int fromIndex int toIndex long key) Searches a range of the specified array of longs for the specified value using the binary search algorithm
static int binarySearch(long[] a long key) Searches the specified array of longs for the specified value using the binary search algorithm
static int binarySearch(Object[] a int fromIndex int toIndex Object key) Searches a range of the specified array for the specified object using the binary search algorithm
static int binarySearch(Object[] a Object key) Searches the specified array for the specified object using the binary search algorithm
staticltTgt int
binarySearch(T[] a int fromIndex int toIndex T key Comparatorlt super Tgt c) Searches a range of the specified array for the specified object using the binary search algorithm
staticltTgt int
binarySearch(T[] a T key Comparatorlt super Tgt c) Searches the specified array for the specified object using the binary search algorithm
static boolean[]
copyOf(boolean[] original int newLength) Copies the specified array truncating or padding with false (if necessary) so the copy has the specified length
static byte[]
copyOf(byte[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static char[]
copyOf(char[] original int newLength) Copies the specified array truncating or padding with null characters (if necessary) so the copy has the specified length
static double[]
copyOf(double[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static float[]
copyOf(float[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static int[]
copyOf(int[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
static long[]
copyOf(long[] original int newLength) Copies the specified array truncating or padding with zeros (if necessary) so the copy has the specified length
staticltTgt T[]
copyOf(T[] original int newLength) Copies the specified array truncating or padding with nulls (if necessary) so the copy has the specified length
static copyOf(U[] original int newLength Classlt extends T[]gt newType)
5
ltTUgt T[] Copies the specified array truncating or padding with nulls (if necessary) so the copy has the specified length
static boolean[]
copyOfRange(boolean[] original int from int to) Copies the specified range of the specified array into a new array
static byte[]
copyOfRange(byte[] original int from int to) Copies the specified range of the specified array into a new array
static char[]
copyOfRange(char[] original int from int to) Copies the specified range of the specified array into a new array
static double[]
copyOfRange(double[] original int from int to) Copies the specified range of the specified array into a new array
static float[]
copyOfRange(float[] original int from int to) Copies the specified range of the specified array into a new array
static int[]
copyOfRange(int[] original int from int to) Copies the specified range of the specified array into a new array
static long[]
copyOfRange(long[] original int from int to) Copies the specified range of the specified array into a new array
staticltTgt T[]
copyOfRange(T[] original int from int to) Copies the specified range of the specified array into a new array
staticltTUgt T[]
copyOfRange(U[] original int from int to Classlt extends T[]gt newType) Copies the specified range of the specified array into a new array
static boolean
deepEquals(Object[] a1 Object[] a2) Returns true if the two specified arrays are deeply equal to one another
static String
deepToString(Object[] a) Returns a string representation of the deep contents of the specified array
static boolean
equals(boolean[] a boolean[] a2) Returns true if the two specified arrays of booleans are equal to one another
static boolean
equals(byte[] a byte[] a2) Returns true if the two specified arrays of bytes are equal to one another
static boolean
equals(char[] a char[] a2) Returns true if the two specified arrays of chars are equal to one another
static boolean
equals(double[] a double[] a2) Returns true if the two specified arrays of doubles are equal to one another
static boolean
equals(float[] a float[] a2) Returns true if the two specified arrays of floats are equal to one another
static boolean
equals(int[] a int[] a2) Returns true if the two specified arrays of ints are equal to one another
static boolean
equals(long[] a long[] a2) Returns true if the two specified arrays of longs are equal to one another
static boolean
equals(Object[] a Object[] a2) Returns true if the two specified arrays of Objects are equal to one another
static void fill(boolean[] a boolean val) Assigns the specified boolean value to each element of the specified array of booleans
static void fill(boolean[] a int fromIndex int toIndex boolean val) Assigns the specified boolean value to each element of the specified range of the specified array of booleans
static void fill(byte[] a byte val) Assigns the specified byte value to each element of the specified array of bytes
static void fill(byte[] a int fromIndex int toIndex byte val) Assigns the specified byte value to each element of the specified range of the specified array of bytes
static void fill(char[] a char val) Assigns the specified char value to each element of the specified array of chars
static void fill(char[] a int fromIndex int toIndex char val) Assigns the specified char value to each element of the specified range of the specified array of chars
6
static void fill(double[] a double val) Assigns the specified double value to each element of the specified array of doubles
static void fill(double[] a int fromIndex int toIndex double val) Assigns the specified double value to each element of the specified range of the specified array of doubles
static void fill(float[] a float val) Assigns the specified float value to each element of the specified array of floats
static void fill(float[] a int fromIndex int toIndex float val) Assigns the specified float value to each element of the specified range of the specified array of floats
static void fill(int[] a int val) Assigns the specified int value to each element of the specified array of ints
static void fill(int[] a int fromIndex int toIndex int val) Assigns the specified int value to each element of the specified range of the specified array of ints
static void fill(long[] a int fromIndex int toIndex long val) Assigns the specified long value to each element of the specified range of the specified array of longs
static void fill(long[] a long val) Assigns the specified long value to each element of the specified array of longs
static void fill(Object[] a int fromIndex int toIndex Object val) Assigns the specified Object reference to each element of the specified range of the specified array of Objects
static void fill(Object[] a Object val) Assigns the specified Object reference to each element of the specified array of Objects
static void sort(byte[] a) Sorts the specified array of bytes into ascending numerical order
static void sort(byte[] a int fromIndex int toIndex) Sorts the specified range of the specified array of bytes into ascending numerical order
static void sort(char[] a) Sorts the specified array of chars into ascending numerical order
static void sort(char[] a int fromIndex int toIndex) Sorts the specified range of the specified array of chars into ascending numerical order
static void sort(double[] a) Sorts the specified array of doubles into ascending numerical order
static void sort(double[] a int fromIndex int toIndex) Sorts the specified range of the specified array of doubles into ascending numerical order
static void sort(float[] a) Sorts the specified array of floats into ascending numerical order
static void sort(float[] a int fromIndex int toIndex) Sorts the specified range of the specified array of floats into ascending numerical order
static void sort(int[] a) Sorts the specified array of ints into ascending numerical order
static void sort(int[] a int fromIndex int toIndex) Sorts the specified range of the specified array of ints into ascending numerical order
static void sort(long[] a) Sorts the specified array of longs into ascending numerical order
static void sort(long[] a int fromIndex int toIndex) Sorts the specified range of the specified array of longs into ascending numerical order
static void sort(Object[] a) Sorts the specified array of objects into ascending order according to the natural ordering of its elements
static void sort(Object[] a int fromIndex int toIndex) Sorts the specified range of the specified array of objects into ascending order according to the natural ordering of its elements
static sort(T[] a Comparatorlt super Tgt c)
7
ltTgt void Sorts the specified array of objects according to the order induced by the specified comparator
staticltTgt void
sort(T[] a int fromIndex int toIndex Comparatorlt super Tgt c) Sorts the specified range of the specified array of objects according to the order induced by the specified comparator
static String
toString(boolean[] a) Returns a string representation of the contents of the specified array
static String
toString(byte[] a) Returns a string representation of the contents of the specified array
static String
toString(char[] a) Returns a string representation of the contents of the specified array
static String
toString(double[] a) Returns a string representation of the contents of the specified array
static String
toString(float[] a) Returns a string representation of the contents of the specified array
static String
toString(int[] a) Returns a string representation of the contents of the specified array
static String
toString(long[] a) Returns a string representation of the contents of the specified array
static String
toString(Object[] a) Returns a string representation of the contents of the specified array
Appendix D Primitive Wrappers
D11 Integer Class Methods
Method Summarystatic int bitCount(int i)
Returns the number of one-bits in the twos complement binary representation of the specified int value
byte byteValue() Returns the value of this Integer as a byte
int compareTo(Integer anotherInteger) Compares two Integer objects numerically
static Integer
decode(String nm) Decodes a String into an Integer
double doubleValue() Returns the value of this Integer as a double
boolean equals(Object obj) Compares this object to the specified object
float floatValue() Returns the value of this Integer as a float
static Integer
getInteger(String nm) Determines the integer value of the system property with the specified name
static Integer
getInteger(String nm int val) Determines the integer value of the system property with the specified name
static Integer
getInteger(String nm Integer val) Returns the integer value of the system property with the specified name
static int highestOneBit(int i) Returns an int value with at most a single one-bit in the position of the highest-order (leftmost) one-bit in the specified int value
int intValue()
8
Returns the value of this Integer as an int
long longValue() Returns the value of this Integer as a long
static int lowestOneBit(int i) Returns an int value with at most a single one-bit in the position of the lowest-order (rightmost) one-bit in the specified int value
static int numberOfLeadingZeros(int i) Returns the number of zero bits preceding the highest-order (leftmost) one-bit in the twos complement binary representation of the specified int value
static int numberOfTrailingZeros(int i) Returns the number of zero bits following the lowest-order (rightmost) one-bit in the twos complement binary representation of the specified int value
static int parseInt(String s) Parses the string argument as a signed decimal integer
static int parseInt(String s int radix) Parses the string argument as a signed integer in the radix specified by the second argument
static int reverse(int i) Returns the value obtained by reversing the order of the bits in the twos complement binary representation of the specified int value
static int reverseBytes(int i) Returns the value obtained by reversing the order of the bytes in the twos complement representation of the specified int value
static int rotateLeft(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue left by the specified number of bits
static int rotateRight(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue right by the specified number of bits
static String toBinaryString(int i) Returns a string representation of the integer argument as an unsigned integer in base 2
static String toHexString(int i) Returns a string representation of the integer argument as an unsigned integer in base 16
static String toOctalString(int i) Returns a string representation of the integer argument as an unsigned integer in base 8
String toString() Returns a String object representing this Integers value
static String toString(int i) Returns a String object representing the specified integer
static String toString(int i int radix) Returns a string representation of the first argument in the radix specified by the second argument
static Integer
valueOf(int i) Returns a Integer instance representing the specified int value
static Integer
valueOf(String s) Returns an Integer object holding the value of the specified String
static Integer
valueOf(String s int radix) Returns an Integer object holding the value extracted from the specified String when parsed with the radix given by the second argument
D12 Double Class Methods
Method Summary byte byteValue()
9
Returns the value of this Double as a byte (by casting to a byte)
static int compare(double d1 double d2) Compares the two specified double values
int compareTo(Double anotherDouble) Compares two Double objects numerically
double doubleValue() Returns the double value of this Double object
boolean equals(Object obj) Compares this object against the specified object
float floatValue() Returns the float value of this Double object
int intValue() Returns the value of this Double as an int (by casting to type int)
boolean isInfinite() Returns true if this Double value is infinitely large in magnitude false otherwise
static boolean isInfinite(double v) Returns true if the specified number is infinitely large in magnitude false otherwise
boolean isNaN() Returns true if this Double value is a Not-a-Number (NaN) false otherwise
static boolean isNaN(double v) Returns true if the specified number is a Not-a-Number (NaN) value false otherwise
static double longBitsToDouble(long bits) Returns the double value corresponding to a given bit representation
long longValue() Returns the value of this Double as a long (by casting to type long)
static double parseDouble(String s) Returns a new double initialized to the value represented by the specified String as performed by thevalueOf method of class Double
static String toHexString(double d) Returns a hexadecimal string representation of the double argument
String toString() Returns a string representation of this Double object
static String toString(double d) Returns a string representation of the double argument
static Double valueOf(double d) Returns a Double instance representing the specified double value
static Double valueOf(String s) Returns a Double object holding the double value represented by the argument string s
Appendix E String Class Methods
Method Summary char charAt(int index)
Returns the char value at the specified index
int codePointAt(int index) Returns the character (Unicode code point) at the specified index
int codePointBefore(int index) Returns the character (Unicode code point) before the specified index
int codePointCount(int beginIndex int endIndex) Returns the number of Unicode code points in the specified text range of this String
10
int compareTo(String anotherString) Compares two strings lexicographically
int compareToIgnoreCase(String str) Compares two strings lexicographically ignoring case differences
String concat(String str) Concatenates the specified string to the end of this string
boolean contains(CharSequence s) Returns true if and only if this string contains the specified sequence of char values
boolean contentEquals(CharSequence cs) Compares this string to the specified CharSequence
boolean contentEquals(StringBuffer sb) Compares this string to the specified StringBuffer
static String
copyValueOf(char[] data) Returns a String that represents the character sequence in the array specified
static String
copyValueOf(char[] data int offset int count) Returns a String that represents the character sequence in the array specified
boolean endsWith(String suffix) Tests if this string ends with the specified suffix
boolean equals(Object anObject) Compares this string to the specified object
boolean equalsIgnoreCase(String anotherString) Compares this String to another String ignoring case considerations
static String
format(String format Object args) Returns a formatted string using the specified format string and arguments
byte[] getBytes() Encodes this String into a sequence of bytes using the platforms default charset storing the result into a new byte array
byte[] getBytes(Charset charset) Encodes this String into a sequence of bytes using the given charset storing the result into a new byte array
byte[] getBytes(String charsetName) Encodes this String into a sequence of bytes using the named charset storing the result into a new byte array
void getChars(int srcBegin int srcEnd char[] dst int dstBegin) Copies characters from this string into the destination character array
int indexOf(int ch) Returns the index within this string of the first occurrence of the specified character
int indexOf(int ch int fromIndex) Returns the index within this string of the first occurrence of the specified character starting the search at the specified index
int indexOf(String str) Returns the index within this string of the first occurrence of the specified substring
int indexOf(String str int fromIndex) Returns the index within this string of the first occurrence of the specified substring starting at the specified index
boolean isEmpty() Returns true if and only if length() is 0
int lastIndexOf(int ch) Returns the index within this string of the last occurrence of the specified character
int lastIndexOf(int ch int fromIndex) Returns the index within this string of the last occurrence of the specified character searching backward starting at the specified index
int lastIndexOf(String str)
11
Returns the index within this string of the rightmost occurrence of the specified substring
int lastIndexOf(String str int fromIndex) Returns the index within this string of the last occurrence of the specified substring searching backward starting at the specified index
int length() Returns the length of this string
boolean matches(String regex) Tells whether or not this string matches the given regular expression
int offsetByCodePoints(int index int codePointOffset) Returns the index within this String that is offset from the given index by codePointOffset code points
boolean regionMatches(boolean ignoreCase int toffset String other int ooffset int len) Tests if two string regions are equal
boolean regionMatches(int toffset String other int ooffset int len) Tests if two string regions are equal
String replace(char oldChar char newChar) Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar
String replace(CharSequence target CharSequence replacement) Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence
String replaceAll(String regex String replacement) Replaces each substring of this string that matches the given regular expression with the given replacement
String replaceFirst(String regex String replacement) Replaces the first substring of this string that matches the given regular expression with the given replacement
String[] split(String regex) Splits this string around matches of the given regular expression
String[] split(String regex int limit) Splits this string around matches of the given regular expression
boolean startsWith(String prefix) Tests if this string starts with the specified prefix
boolean startsWith(String prefix int toffset) Tests if the substring of this string beginning at the specified index starts with the specified prefix
CharSequence
subSequence(int beginIndex int endIndex) Returns a new character sequence that is a subsequence of this sequence
String substring(int beginIndex) Returns a new string that is a substring of this string
String substring(int beginIndex int endIndex) Returns a new string that is a substring of this string
char[] toCharArray() Converts this string to a new character array
String toLowerCase() Converts all of the characters in this String to lower case using the rules of the default locale
String toString() This object (which is already a string) is itself returned
String toUpperCase() Converts all of the characters in this String to upper case using the rules of the default locale
String trim() Returns a copy of the string with leading and trailing whitespace omitted
static String
valueOf(boolean b) Returns the string representation of the boolean argument
static valueOf(char c)
12
String Returns the string representation of the char argument
static String
valueOf(char[] data) Returns the string representation of the char array argument
static String
valueOf(char[] data int offset int count) Returns the string representation of a specific subarray of the char array argument
static String
valueOf(double d) Returns the string representation of the double argument
static String
valueOf(float f) Returns the string representation of the float argument
static String
valueOf(int i) Returns the string representation of the int argument
static String
valueOf(long l) Returns the string representation of the long argument
static String
valueOf(Object obj) Returns the string representation of the Object argument
Appendix F Random Class Methods
Method Summaryprotected int
next(int bits) Generates the next pseudorandom number
boolean nextBoolean() Returns the next pseudorandom uniformly distributed boolean value from this random number generators sequence
void nextBytes(byte[] bytes) Generates random bytes and places them into a user-supplied byte array
double nextDouble() Returns the next pseudorandom uniformly distributed double value between 00 and 10 from this random number generators sequence
float nextFloat() Returns the next pseudorandom uniformly distributed float value between 00 and 10 from this random number generators sequence
double nextGaussian() Returns the next pseudorandom Gaussian (normally) distributed double value with mean 00 and standard deviation 10 from this random number generators sequence
int nextInt() Returns the next pseudorandom uniformly distributed int value from this random number generators sequence
int nextInt(int n) Returns a pseudorandom uniformly distributed int value between 0 (inclusive) and the specified value (exclusive) drawn from this random number generators sequence
long nextLong() Returns the next pseudorandom uniformly distributed long value from this random number generators sequence
void setSeed(long seed) Sets the seed of this random number generator using a single long seed
Appendix G InputOutput Classes
G11 Scanner Class
Constructor Summary
13
Scanner(File source) Constructs a new Scanner that produces values scanned from the specified file
Scanner(InputStream source) Constructs a new Scanner that produces values scanned from the specified input stream
Scanner(InputStream source String charsetName) Constructs a new Scanner that produces values scanned from the specified input stream
Method Summary void close()
Closes this scanner
Pattern delimiter() Returns the Pattern this Scanner is currently using to match delimiters
String findInLine(Pattern pattern) Attempts to find the next occurrence of the specified pattern ignoring delimiters
String findInLine(String pattern) Attempts to find the next occurrence of a pattern constructed from the specified string ignoring delimiters
boolean hasNext() Returns true if this scanner has another token in its input
boolean hasNext(Pattern pattern) Returns true if the next complete token matches the specified pattern
boolean hasNext(String pattern) Returns true if the next token matches the pattern constructed from the specified string
boolean hasNextBoolean() Returns true if the next token in this scanners input can be interpreted as a boolean value using a case insensitive pattern created from the string true|false
boolean hasNextByte() Returns true if the next token in this scanners input can be interpreted as a byte value in the default radix using the nextByte() method
boolean hasNextByte(int radix) Returns true if the next token in this scanners input can be interpreted as a byte value in the specified radix using the nextByte() method
boolean hasNextDouble() Returns true if the next token in this scanners input can be interpreted as a double value using thenextDouble() method
boolean hasNextFloat() Returns true if the next token in this scanners input can be interpreted as a float value using thenextFloat() method
boolean hasNextInt() Returns true if the next token in this scanners input can be interpreted as an int value in the default radix using the nextInt() method
boolean hasNextInt(int radix) Returns true if the next token in this scanners input can be interpreted as an int value in the specified radix using the nextInt() method
boolean hasNextLine() Returns true if there is another line in the input of this scanner
boolean hasNextLong() Returns true if the next token in this scanners input can be interpreted as a long value in the default radix using the nextLong() method
boolean hasNextLong(int radix) Returns true if the next token in this scanners input can be interpreted as a long value in the specified radix using the nextLong() method
14
IOException ioException() Returns the IOException last thrown by this Scanners underlying Readable
MatchResult match() Returns the match result of the last scanning operation performed by this scanner
String next() Finds and returns the next complete token from this scanner
String next(Pattern pattern) Returns the next token if it matches the specified pattern
String next(String pattern) Returns the next token if it matches the pattern constructed from the specified string
boolean nextBoolean() Scans the next token of the input into a boolean value and returns that value
byte nextByte() Scans the next token of the input as a byte
byte nextByte(int radix) Scans the next token of the input as a byte
double nextDouble() Scans the next token of the input as a double
float nextFloat() Scans the next token of the input as a float
int nextInt() Scans the next token of the input as an int
int nextInt(int radix) Scans the next token of the input as an int
String nextLine() Advances this scanner past the current line and returns the input that was skipped
long nextLong() Scans the next token of the input as a long
long nextLong(int radix) Scans the next token of the input as a long
int radix() Returns this scanners default radix
void remove() The remove operation is not supported by this implementation of Iterator
Scanner reset() Resets this scanner
Scanner skip(Pattern pattern) Skips input that matches the specified pattern ignoring delimiters
Scanner skip(String pattern) Skips input that matches a pattern constructed from the specified string
String toString() Returns the string representation of this Scanner
Scanner useDelimiter(Pattern pattern) Sets this scanners delimiting pattern to the specified pattern
Scanner useDelimiter(String pattern) Sets this scanners delimiting pattern to a pattern constructed from the specified String
Scanner useRadix(int radix) Sets this scanners default radix to the specified radix
15
G12 PrintWriter Class
Constructor SummaryPrintWriter(File file) Creates a new PrintWriter without automatic line flushing with the specified file
Method SummaryPrintWriter append(char c)
Appends the specified character to this writer
PrintWriter append(CharSequence csq) Appends the specified character sequence to this writer
PrintWriter append(CharSequence csq int start int end) Appends a subsequence of the specified character sequence to this writer
boolean checkError() Flushes the stream if its not closed and checks its error state
protected void
clearError() Clears the error state of this stream
void close() Closes the stream and releases any system resources associated with it
void flush() Flushes the stream
PrintWriter format(String format Object args) Writes a formatted string to this writer using the specified format string and arguments
void print(boolean b) Prints a boolean value
void print(char c) Prints a character
void print(char[] s) Prints an array of characters
void print(double d) Prints a double-precision floating-point number
void print(float f) Prints a floating-point number
void print(int i) Prints an integer
void print(long l) Prints a long integer
void print(Object obj) Prints an object
void print(String s) Prints a string
PrintWriter printf(String format Object args) A convenience method to write a formatted string to this writer using the specified format string and arguments
void println() Terminates the current line by writing the line separator string
void println(boolean x) Prints a boolean value and then terminates the line
void println(char x) Prints a character and then terminates the line
16
void println(char[] x) Prints an array of characters and then terminates the line
void println(double x) Prints a double-precision floating-point number and then terminates the line
void println(float x) Prints a floating-point number and then terminates the line
void println(int x) Prints an integer and then terminates the line
void println(long x) Prints a long integer and then terminates the line
void println(Object x) Prints an Object and then terminates the line
void println(String x) Prints a String and then terminates the line
protected void
setError() Indicates that an error has occurred
void write(char[] buf) Writes an array of characters
void write(char[] buf int off int len) Writes A Portion of an array of characters
void write(int c) Writes a single character
void write(String s) Writes a string
void write(String s int off int len) Writes a portion of a string
G13 File Class
Constructor SummaryFile(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname
File(URI uri) Creates a new File instance by converting the given file URI into an abstract pathname
Method Summaryboolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname
boolean canRead() Tests whether the application can read the file denoted by this abstract pathname
boolean canWrite() Tests whether the application can modify the file denoted by this abstract pathname
boolean createNewFile() Atomically creates a new empty file named by this abstract pathname if and only if a file with this name does not yet exist
static File
createTempFile(String prefix String suffix) Creates an empty file in the default temporary-file directory using the given prefix and suffix to generate its name
static File
createTempFile(String prefix String suffix File directory) Creates a new empty file in the specified directory using the given prefix and suffix strings to generate its name
boolean delete()
17
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
ltTUgt T[] Copies the specified array truncating or padding with nulls (if necessary) so the copy has the specified length
static boolean[]
copyOfRange(boolean[] original int from int to) Copies the specified range of the specified array into a new array
static byte[]
copyOfRange(byte[] original int from int to) Copies the specified range of the specified array into a new array
static char[]
copyOfRange(char[] original int from int to) Copies the specified range of the specified array into a new array
static double[]
copyOfRange(double[] original int from int to) Copies the specified range of the specified array into a new array
static float[]
copyOfRange(float[] original int from int to) Copies the specified range of the specified array into a new array
static int[]
copyOfRange(int[] original int from int to) Copies the specified range of the specified array into a new array
static long[]
copyOfRange(long[] original int from int to) Copies the specified range of the specified array into a new array
staticltTgt T[]
copyOfRange(T[] original int from int to) Copies the specified range of the specified array into a new array
staticltTUgt T[]
copyOfRange(U[] original int from int to Classlt extends T[]gt newType) Copies the specified range of the specified array into a new array
static boolean
deepEquals(Object[] a1 Object[] a2) Returns true if the two specified arrays are deeply equal to one another
static String
deepToString(Object[] a) Returns a string representation of the deep contents of the specified array
static boolean
equals(boolean[] a boolean[] a2) Returns true if the two specified arrays of booleans are equal to one another
static boolean
equals(byte[] a byte[] a2) Returns true if the two specified arrays of bytes are equal to one another
static boolean
equals(char[] a char[] a2) Returns true if the two specified arrays of chars are equal to one another
static boolean
equals(double[] a double[] a2) Returns true if the two specified arrays of doubles are equal to one another
static boolean
equals(float[] a float[] a2) Returns true if the two specified arrays of floats are equal to one another
static boolean
equals(int[] a int[] a2) Returns true if the two specified arrays of ints are equal to one another
static boolean
equals(long[] a long[] a2) Returns true if the two specified arrays of longs are equal to one another
static boolean
equals(Object[] a Object[] a2) Returns true if the two specified arrays of Objects are equal to one another
static void fill(boolean[] a boolean val) Assigns the specified boolean value to each element of the specified array of booleans
static void fill(boolean[] a int fromIndex int toIndex boolean val) Assigns the specified boolean value to each element of the specified range of the specified array of booleans
static void fill(byte[] a byte val) Assigns the specified byte value to each element of the specified array of bytes
static void fill(byte[] a int fromIndex int toIndex byte val) Assigns the specified byte value to each element of the specified range of the specified array of bytes
static void fill(char[] a char val) Assigns the specified char value to each element of the specified array of chars
static void fill(char[] a int fromIndex int toIndex char val) Assigns the specified char value to each element of the specified range of the specified array of chars
6
static void fill(double[] a double val) Assigns the specified double value to each element of the specified array of doubles
static void fill(double[] a int fromIndex int toIndex double val) Assigns the specified double value to each element of the specified range of the specified array of doubles
static void fill(float[] a float val) Assigns the specified float value to each element of the specified array of floats
static void fill(float[] a int fromIndex int toIndex float val) Assigns the specified float value to each element of the specified range of the specified array of floats
static void fill(int[] a int val) Assigns the specified int value to each element of the specified array of ints
static void fill(int[] a int fromIndex int toIndex int val) Assigns the specified int value to each element of the specified range of the specified array of ints
static void fill(long[] a int fromIndex int toIndex long val) Assigns the specified long value to each element of the specified range of the specified array of longs
static void fill(long[] a long val) Assigns the specified long value to each element of the specified array of longs
static void fill(Object[] a int fromIndex int toIndex Object val) Assigns the specified Object reference to each element of the specified range of the specified array of Objects
static void fill(Object[] a Object val) Assigns the specified Object reference to each element of the specified array of Objects
static void sort(byte[] a) Sorts the specified array of bytes into ascending numerical order
static void sort(byte[] a int fromIndex int toIndex) Sorts the specified range of the specified array of bytes into ascending numerical order
static void sort(char[] a) Sorts the specified array of chars into ascending numerical order
static void sort(char[] a int fromIndex int toIndex) Sorts the specified range of the specified array of chars into ascending numerical order
static void sort(double[] a) Sorts the specified array of doubles into ascending numerical order
static void sort(double[] a int fromIndex int toIndex) Sorts the specified range of the specified array of doubles into ascending numerical order
static void sort(float[] a) Sorts the specified array of floats into ascending numerical order
static void sort(float[] a int fromIndex int toIndex) Sorts the specified range of the specified array of floats into ascending numerical order
static void sort(int[] a) Sorts the specified array of ints into ascending numerical order
static void sort(int[] a int fromIndex int toIndex) Sorts the specified range of the specified array of ints into ascending numerical order
static void sort(long[] a) Sorts the specified array of longs into ascending numerical order
static void sort(long[] a int fromIndex int toIndex) Sorts the specified range of the specified array of longs into ascending numerical order
static void sort(Object[] a) Sorts the specified array of objects into ascending order according to the natural ordering of its elements
static void sort(Object[] a int fromIndex int toIndex) Sorts the specified range of the specified array of objects into ascending order according to the natural ordering of its elements
static sort(T[] a Comparatorlt super Tgt c)
7
ltTgt void Sorts the specified array of objects according to the order induced by the specified comparator
staticltTgt void
sort(T[] a int fromIndex int toIndex Comparatorlt super Tgt c) Sorts the specified range of the specified array of objects according to the order induced by the specified comparator
static String
toString(boolean[] a) Returns a string representation of the contents of the specified array
static String
toString(byte[] a) Returns a string representation of the contents of the specified array
static String
toString(char[] a) Returns a string representation of the contents of the specified array
static String
toString(double[] a) Returns a string representation of the contents of the specified array
static String
toString(float[] a) Returns a string representation of the contents of the specified array
static String
toString(int[] a) Returns a string representation of the contents of the specified array
static String
toString(long[] a) Returns a string representation of the contents of the specified array
static String
toString(Object[] a) Returns a string representation of the contents of the specified array
Appendix D Primitive Wrappers
D11 Integer Class Methods
Method Summarystatic int bitCount(int i)
Returns the number of one-bits in the twos complement binary representation of the specified int value
byte byteValue() Returns the value of this Integer as a byte
int compareTo(Integer anotherInteger) Compares two Integer objects numerically
static Integer
decode(String nm) Decodes a String into an Integer
double doubleValue() Returns the value of this Integer as a double
boolean equals(Object obj) Compares this object to the specified object
float floatValue() Returns the value of this Integer as a float
static Integer
getInteger(String nm) Determines the integer value of the system property with the specified name
static Integer
getInteger(String nm int val) Determines the integer value of the system property with the specified name
static Integer
getInteger(String nm Integer val) Returns the integer value of the system property with the specified name
static int highestOneBit(int i) Returns an int value with at most a single one-bit in the position of the highest-order (leftmost) one-bit in the specified int value
int intValue()
8
Returns the value of this Integer as an int
long longValue() Returns the value of this Integer as a long
static int lowestOneBit(int i) Returns an int value with at most a single one-bit in the position of the lowest-order (rightmost) one-bit in the specified int value
static int numberOfLeadingZeros(int i) Returns the number of zero bits preceding the highest-order (leftmost) one-bit in the twos complement binary representation of the specified int value
static int numberOfTrailingZeros(int i) Returns the number of zero bits following the lowest-order (rightmost) one-bit in the twos complement binary representation of the specified int value
static int parseInt(String s) Parses the string argument as a signed decimal integer
static int parseInt(String s int radix) Parses the string argument as a signed integer in the radix specified by the second argument
static int reverse(int i) Returns the value obtained by reversing the order of the bits in the twos complement binary representation of the specified int value
static int reverseBytes(int i) Returns the value obtained by reversing the order of the bytes in the twos complement representation of the specified int value
static int rotateLeft(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue left by the specified number of bits
static int rotateRight(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue right by the specified number of bits
static String toBinaryString(int i) Returns a string representation of the integer argument as an unsigned integer in base 2
static String toHexString(int i) Returns a string representation of the integer argument as an unsigned integer in base 16
static String toOctalString(int i) Returns a string representation of the integer argument as an unsigned integer in base 8
String toString() Returns a String object representing this Integers value
static String toString(int i) Returns a String object representing the specified integer
static String toString(int i int radix) Returns a string representation of the first argument in the radix specified by the second argument
static Integer
valueOf(int i) Returns a Integer instance representing the specified int value
static Integer
valueOf(String s) Returns an Integer object holding the value of the specified String
static Integer
valueOf(String s int radix) Returns an Integer object holding the value extracted from the specified String when parsed with the radix given by the second argument
D12 Double Class Methods
Method Summary byte byteValue()
9
Returns the value of this Double as a byte (by casting to a byte)
static int compare(double d1 double d2) Compares the two specified double values
int compareTo(Double anotherDouble) Compares two Double objects numerically
double doubleValue() Returns the double value of this Double object
boolean equals(Object obj) Compares this object against the specified object
float floatValue() Returns the float value of this Double object
int intValue() Returns the value of this Double as an int (by casting to type int)
boolean isInfinite() Returns true if this Double value is infinitely large in magnitude false otherwise
static boolean isInfinite(double v) Returns true if the specified number is infinitely large in magnitude false otherwise
boolean isNaN() Returns true if this Double value is a Not-a-Number (NaN) false otherwise
static boolean isNaN(double v) Returns true if the specified number is a Not-a-Number (NaN) value false otherwise
static double longBitsToDouble(long bits) Returns the double value corresponding to a given bit representation
long longValue() Returns the value of this Double as a long (by casting to type long)
static double parseDouble(String s) Returns a new double initialized to the value represented by the specified String as performed by thevalueOf method of class Double
static String toHexString(double d) Returns a hexadecimal string representation of the double argument
String toString() Returns a string representation of this Double object
static String toString(double d) Returns a string representation of the double argument
static Double valueOf(double d) Returns a Double instance representing the specified double value
static Double valueOf(String s) Returns a Double object holding the double value represented by the argument string s
Appendix E String Class Methods
Method Summary char charAt(int index)
Returns the char value at the specified index
int codePointAt(int index) Returns the character (Unicode code point) at the specified index
int codePointBefore(int index) Returns the character (Unicode code point) before the specified index
int codePointCount(int beginIndex int endIndex) Returns the number of Unicode code points in the specified text range of this String
10
int compareTo(String anotherString) Compares two strings lexicographically
int compareToIgnoreCase(String str) Compares two strings lexicographically ignoring case differences
String concat(String str) Concatenates the specified string to the end of this string
boolean contains(CharSequence s) Returns true if and only if this string contains the specified sequence of char values
boolean contentEquals(CharSequence cs) Compares this string to the specified CharSequence
boolean contentEquals(StringBuffer sb) Compares this string to the specified StringBuffer
static String
copyValueOf(char[] data) Returns a String that represents the character sequence in the array specified
static String
copyValueOf(char[] data int offset int count) Returns a String that represents the character sequence in the array specified
boolean endsWith(String suffix) Tests if this string ends with the specified suffix
boolean equals(Object anObject) Compares this string to the specified object
boolean equalsIgnoreCase(String anotherString) Compares this String to another String ignoring case considerations
static String
format(String format Object args) Returns a formatted string using the specified format string and arguments
byte[] getBytes() Encodes this String into a sequence of bytes using the platforms default charset storing the result into a new byte array
byte[] getBytes(Charset charset) Encodes this String into a sequence of bytes using the given charset storing the result into a new byte array
byte[] getBytes(String charsetName) Encodes this String into a sequence of bytes using the named charset storing the result into a new byte array
void getChars(int srcBegin int srcEnd char[] dst int dstBegin) Copies characters from this string into the destination character array
int indexOf(int ch) Returns the index within this string of the first occurrence of the specified character
int indexOf(int ch int fromIndex) Returns the index within this string of the first occurrence of the specified character starting the search at the specified index
int indexOf(String str) Returns the index within this string of the first occurrence of the specified substring
int indexOf(String str int fromIndex) Returns the index within this string of the first occurrence of the specified substring starting at the specified index
boolean isEmpty() Returns true if and only if length() is 0
int lastIndexOf(int ch) Returns the index within this string of the last occurrence of the specified character
int lastIndexOf(int ch int fromIndex) Returns the index within this string of the last occurrence of the specified character searching backward starting at the specified index
int lastIndexOf(String str)
11
Returns the index within this string of the rightmost occurrence of the specified substring
int lastIndexOf(String str int fromIndex) Returns the index within this string of the last occurrence of the specified substring searching backward starting at the specified index
int length() Returns the length of this string
boolean matches(String regex) Tells whether or not this string matches the given regular expression
int offsetByCodePoints(int index int codePointOffset) Returns the index within this String that is offset from the given index by codePointOffset code points
boolean regionMatches(boolean ignoreCase int toffset String other int ooffset int len) Tests if two string regions are equal
boolean regionMatches(int toffset String other int ooffset int len) Tests if two string regions are equal
String replace(char oldChar char newChar) Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar
String replace(CharSequence target CharSequence replacement) Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence
String replaceAll(String regex String replacement) Replaces each substring of this string that matches the given regular expression with the given replacement
String replaceFirst(String regex String replacement) Replaces the first substring of this string that matches the given regular expression with the given replacement
String[] split(String regex) Splits this string around matches of the given regular expression
String[] split(String regex int limit) Splits this string around matches of the given regular expression
boolean startsWith(String prefix) Tests if this string starts with the specified prefix
boolean startsWith(String prefix int toffset) Tests if the substring of this string beginning at the specified index starts with the specified prefix
CharSequence
subSequence(int beginIndex int endIndex) Returns a new character sequence that is a subsequence of this sequence
String substring(int beginIndex) Returns a new string that is a substring of this string
String substring(int beginIndex int endIndex) Returns a new string that is a substring of this string
char[] toCharArray() Converts this string to a new character array
String toLowerCase() Converts all of the characters in this String to lower case using the rules of the default locale
String toString() This object (which is already a string) is itself returned
String toUpperCase() Converts all of the characters in this String to upper case using the rules of the default locale
String trim() Returns a copy of the string with leading and trailing whitespace omitted
static String
valueOf(boolean b) Returns the string representation of the boolean argument
static valueOf(char c)
12
String Returns the string representation of the char argument
static String
valueOf(char[] data) Returns the string representation of the char array argument
static String
valueOf(char[] data int offset int count) Returns the string representation of a specific subarray of the char array argument
static String
valueOf(double d) Returns the string representation of the double argument
static String
valueOf(float f) Returns the string representation of the float argument
static String
valueOf(int i) Returns the string representation of the int argument
static String
valueOf(long l) Returns the string representation of the long argument
static String
valueOf(Object obj) Returns the string representation of the Object argument
Appendix F Random Class Methods
Method Summaryprotected int
next(int bits) Generates the next pseudorandom number
boolean nextBoolean() Returns the next pseudorandom uniformly distributed boolean value from this random number generators sequence
void nextBytes(byte[] bytes) Generates random bytes and places them into a user-supplied byte array
double nextDouble() Returns the next pseudorandom uniformly distributed double value between 00 and 10 from this random number generators sequence
float nextFloat() Returns the next pseudorandom uniformly distributed float value between 00 and 10 from this random number generators sequence
double nextGaussian() Returns the next pseudorandom Gaussian (normally) distributed double value with mean 00 and standard deviation 10 from this random number generators sequence
int nextInt() Returns the next pseudorandom uniformly distributed int value from this random number generators sequence
int nextInt(int n) Returns a pseudorandom uniformly distributed int value between 0 (inclusive) and the specified value (exclusive) drawn from this random number generators sequence
long nextLong() Returns the next pseudorandom uniformly distributed long value from this random number generators sequence
void setSeed(long seed) Sets the seed of this random number generator using a single long seed
Appendix G InputOutput Classes
G11 Scanner Class
Constructor Summary
13
Scanner(File source) Constructs a new Scanner that produces values scanned from the specified file
Scanner(InputStream source) Constructs a new Scanner that produces values scanned from the specified input stream
Scanner(InputStream source String charsetName) Constructs a new Scanner that produces values scanned from the specified input stream
Method Summary void close()
Closes this scanner
Pattern delimiter() Returns the Pattern this Scanner is currently using to match delimiters
String findInLine(Pattern pattern) Attempts to find the next occurrence of the specified pattern ignoring delimiters
String findInLine(String pattern) Attempts to find the next occurrence of a pattern constructed from the specified string ignoring delimiters
boolean hasNext() Returns true if this scanner has another token in its input
boolean hasNext(Pattern pattern) Returns true if the next complete token matches the specified pattern
boolean hasNext(String pattern) Returns true if the next token matches the pattern constructed from the specified string
boolean hasNextBoolean() Returns true if the next token in this scanners input can be interpreted as a boolean value using a case insensitive pattern created from the string true|false
boolean hasNextByte() Returns true if the next token in this scanners input can be interpreted as a byte value in the default radix using the nextByte() method
boolean hasNextByte(int radix) Returns true if the next token in this scanners input can be interpreted as a byte value in the specified radix using the nextByte() method
boolean hasNextDouble() Returns true if the next token in this scanners input can be interpreted as a double value using thenextDouble() method
boolean hasNextFloat() Returns true if the next token in this scanners input can be interpreted as a float value using thenextFloat() method
boolean hasNextInt() Returns true if the next token in this scanners input can be interpreted as an int value in the default radix using the nextInt() method
boolean hasNextInt(int radix) Returns true if the next token in this scanners input can be interpreted as an int value in the specified radix using the nextInt() method
boolean hasNextLine() Returns true if there is another line in the input of this scanner
boolean hasNextLong() Returns true if the next token in this scanners input can be interpreted as a long value in the default radix using the nextLong() method
boolean hasNextLong(int radix) Returns true if the next token in this scanners input can be interpreted as a long value in the specified radix using the nextLong() method
14
IOException ioException() Returns the IOException last thrown by this Scanners underlying Readable
MatchResult match() Returns the match result of the last scanning operation performed by this scanner
String next() Finds and returns the next complete token from this scanner
String next(Pattern pattern) Returns the next token if it matches the specified pattern
String next(String pattern) Returns the next token if it matches the pattern constructed from the specified string
boolean nextBoolean() Scans the next token of the input into a boolean value and returns that value
byte nextByte() Scans the next token of the input as a byte
byte nextByte(int radix) Scans the next token of the input as a byte
double nextDouble() Scans the next token of the input as a double
float nextFloat() Scans the next token of the input as a float
int nextInt() Scans the next token of the input as an int
int nextInt(int radix) Scans the next token of the input as an int
String nextLine() Advances this scanner past the current line and returns the input that was skipped
long nextLong() Scans the next token of the input as a long
long nextLong(int radix) Scans the next token of the input as a long
int radix() Returns this scanners default radix
void remove() The remove operation is not supported by this implementation of Iterator
Scanner reset() Resets this scanner
Scanner skip(Pattern pattern) Skips input that matches the specified pattern ignoring delimiters
Scanner skip(String pattern) Skips input that matches a pattern constructed from the specified string
String toString() Returns the string representation of this Scanner
Scanner useDelimiter(Pattern pattern) Sets this scanners delimiting pattern to the specified pattern
Scanner useDelimiter(String pattern) Sets this scanners delimiting pattern to a pattern constructed from the specified String
Scanner useRadix(int radix) Sets this scanners default radix to the specified radix
15
G12 PrintWriter Class
Constructor SummaryPrintWriter(File file) Creates a new PrintWriter without automatic line flushing with the specified file
Method SummaryPrintWriter append(char c)
Appends the specified character to this writer
PrintWriter append(CharSequence csq) Appends the specified character sequence to this writer
PrintWriter append(CharSequence csq int start int end) Appends a subsequence of the specified character sequence to this writer
boolean checkError() Flushes the stream if its not closed and checks its error state
protected void
clearError() Clears the error state of this stream
void close() Closes the stream and releases any system resources associated with it
void flush() Flushes the stream
PrintWriter format(String format Object args) Writes a formatted string to this writer using the specified format string and arguments
void print(boolean b) Prints a boolean value
void print(char c) Prints a character
void print(char[] s) Prints an array of characters
void print(double d) Prints a double-precision floating-point number
void print(float f) Prints a floating-point number
void print(int i) Prints an integer
void print(long l) Prints a long integer
void print(Object obj) Prints an object
void print(String s) Prints a string
PrintWriter printf(String format Object args) A convenience method to write a formatted string to this writer using the specified format string and arguments
void println() Terminates the current line by writing the line separator string
void println(boolean x) Prints a boolean value and then terminates the line
void println(char x) Prints a character and then terminates the line
16
void println(char[] x) Prints an array of characters and then terminates the line
void println(double x) Prints a double-precision floating-point number and then terminates the line
void println(float x) Prints a floating-point number and then terminates the line
void println(int x) Prints an integer and then terminates the line
void println(long x) Prints a long integer and then terminates the line
void println(Object x) Prints an Object and then terminates the line
void println(String x) Prints a String and then terminates the line
protected void
setError() Indicates that an error has occurred
void write(char[] buf) Writes an array of characters
void write(char[] buf int off int len) Writes A Portion of an array of characters
void write(int c) Writes a single character
void write(String s) Writes a string
void write(String s int off int len) Writes a portion of a string
G13 File Class
Constructor SummaryFile(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname
File(URI uri) Creates a new File instance by converting the given file URI into an abstract pathname
Method Summaryboolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname
boolean canRead() Tests whether the application can read the file denoted by this abstract pathname
boolean canWrite() Tests whether the application can modify the file denoted by this abstract pathname
boolean createNewFile() Atomically creates a new empty file named by this abstract pathname if and only if a file with this name does not yet exist
static File
createTempFile(String prefix String suffix) Creates an empty file in the default temporary-file directory using the given prefix and suffix to generate its name
static File
createTempFile(String prefix String suffix File directory) Creates a new empty file in the specified directory using the given prefix and suffix strings to generate its name
boolean delete()
17
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
static void fill(double[] a double val) Assigns the specified double value to each element of the specified array of doubles
static void fill(double[] a int fromIndex int toIndex double val) Assigns the specified double value to each element of the specified range of the specified array of doubles
static void fill(float[] a float val) Assigns the specified float value to each element of the specified array of floats
static void fill(float[] a int fromIndex int toIndex float val) Assigns the specified float value to each element of the specified range of the specified array of floats
static void fill(int[] a int val) Assigns the specified int value to each element of the specified array of ints
static void fill(int[] a int fromIndex int toIndex int val) Assigns the specified int value to each element of the specified range of the specified array of ints
static void fill(long[] a int fromIndex int toIndex long val) Assigns the specified long value to each element of the specified range of the specified array of longs
static void fill(long[] a long val) Assigns the specified long value to each element of the specified array of longs
static void fill(Object[] a int fromIndex int toIndex Object val) Assigns the specified Object reference to each element of the specified range of the specified array of Objects
static void fill(Object[] a Object val) Assigns the specified Object reference to each element of the specified array of Objects
static void sort(byte[] a) Sorts the specified array of bytes into ascending numerical order
static void sort(byte[] a int fromIndex int toIndex) Sorts the specified range of the specified array of bytes into ascending numerical order
static void sort(char[] a) Sorts the specified array of chars into ascending numerical order
static void sort(char[] a int fromIndex int toIndex) Sorts the specified range of the specified array of chars into ascending numerical order
static void sort(double[] a) Sorts the specified array of doubles into ascending numerical order
static void sort(double[] a int fromIndex int toIndex) Sorts the specified range of the specified array of doubles into ascending numerical order
static void sort(float[] a) Sorts the specified array of floats into ascending numerical order
static void sort(float[] a int fromIndex int toIndex) Sorts the specified range of the specified array of floats into ascending numerical order
static void sort(int[] a) Sorts the specified array of ints into ascending numerical order
static void sort(int[] a int fromIndex int toIndex) Sorts the specified range of the specified array of ints into ascending numerical order
static void sort(long[] a) Sorts the specified array of longs into ascending numerical order
static void sort(long[] a int fromIndex int toIndex) Sorts the specified range of the specified array of longs into ascending numerical order
static void sort(Object[] a) Sorts the specified array of objects into ascending order according to the natural ordering of its elements
static void sort(Object[] a int fromIndex int toIndex) Sorts the specified range of the specified array of objects into ascending order according to the natural ordering of its elements
static sort(T[] a Comparatorlt super Tgt c)
7
ltTgt void Sorts the specified array of objects according to the order induced by the specified comparator
staticltTgt void
sort(T[] a int fromIndex int toIndex Comparatorlt super Tgt c) Sorts the specified range of the specified array of objects according to the order induced by the specified comparator
static String
toString(boolean[] a) Returns a string representation of the contents of the specified array
static String
toString(byte[] a) Returns a string representation of the contents of the specified array
static String
toString(char[] a) Returns a string representation of the contents of the specified array
static String
toString(double[] a) Returns a string representation of the contents of the specified array
static String
toString(float[] a) Returns a string representation of the contents of the specified array
static String
toString(int[] a) Returns a string representation of the contents of the specified array
static String
toString(long[] a) Returns a string representation of the contents of the specified array
static String
toString(Object[] a) Returns a string representation of the contents of the specified array
Appendix D Primitive Wrappers
D11 Integer Class Methods
Method Summarystatic int bitCount(int i)
Returns the number of one-bits in the twos complement binary representation of the specified int value
byte byteValue() Returns the value of this Integer as a byte
int compareTo(Integer anotherInteger) Compares two Integer objects numerically
static Integer
decode(String nm) Decodes a String into an Integer
double doubleValue() Returns the value of this Integer as a double
boolean equals(Object obj) Compares this object to the specified object
float floatValue() Returns the value of this Integer as a float
static Integer
getInteger(String nm) Determines the integer value of the system property with the specified name
static Integer
getInteger(String nm int val) Determines the integer value of the system property with the specified name
static Integer
getInteger(String nm Integer val) Returns the integer value of the system property with the specified name
static int highestOneBit(int i) Returns an int value with at most a single one-bit in the position of the highest-order (leftmost) one-bit in the specified int value
int intValue()
8
Returns the value of this Integer as an int
long longValue() Returns the value of this Integer as a long
static int lowestOneBit(int i) Returns an int value with at most a single one-bit in the position of the lowest-order (rightmost) one-bit in the specified int value
static int numberOfLeadingZeros(int i) Returns the number of zero bits preceding the highest-order (leftmost) one-bit in the twos complement binary representation of the specified int value
static int numberOfTrailingZeros(int i) Returns the number of zero bits following the lowest-order (rightmost) one-bit in the twos complement binary representation of the specified int value
static int parseInt(String s) Parses the string argument as a signed decimal integer
static int parseInt(String s int radix) Parses the string argument as a signed integer in the radix specified by the second argument
static int reverse(int i) Returns the value obtained by reversing the order of the bits in the twos complement binary representation of the specified int value
static int reverseBytes(int i) Returns the value obtained by reversing the order of the bytes in the twos complement representation of the specified int value
static int rotateLeft(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue left by the specified number of bits
static int rotateRight(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue right by the specified number of bits
static String toBinaryString(int i) Returns a string representation of the integer argument as an unsigned integer in base 2
static String toHexString(int i) Returns a string representation of the integer argument as an unsigned integer in base 16
static String toOctalString(int i) Returns a string representation of the integer argument as an unsigned integer in base 8
String toString() Returns a String object representing this Integers value
static String toString(int i) Returns a String object representing the specified integer
static String toString(int i int radix) Returns a string representation of the first argument in the radix specified by the second argument
static Integer
valueOf(int i) Returns a Integer instance representing the specified int value
static Integer
valueOf(String s) Returns an Integer object holding the value of the specified String
static Integer
valueOf(String s int radix) Returns an Integer object holding the value extracted from the specified String when parsed with the radix given by the second argument
D12 Double Class Methods
Method Summary byte byteValue()
9
Returns the value of this Double as a byte (by casting to a byte)
static int compare(double d1 double d2) Compares the two specified double values
int compareTo(Double anotherDouble) Compares two Double objects numerically
double doubleValue() Returns the double value of this Double object
boolean equals(Object obj) Compares this object against the specified object
float floatValue() Returns the float value of this Double object
int intValue() Returns the value of this Double as an int (by casting to type int)
boolean isInfinite() Returns true if this Double value is infinitely large in magnitude false otherwise
static boolean isInfinite(double v) Returns true if the specified number is infinitely large in magnitude false otherwise
boolean isNaN() Returns true if this Double value is a Not-a-Number (NaN) false otherwise
static boolean isNaN(double v) Returns true if the specified number is a Not-a-Number (NaN) value false otherwise
static double longBitsToDouble(long bits) Returns the double value corresponding to a given bit representation
long longValue() Returns the value of this Double as a long (by casting to type long)
static double parseDouble(String s) Returns a new double initialized to the value represented by the specified String as performed by thevalueOf method of class Double
static String toHexString(double d) Returns a hexadecimal string representation of the double argument
String toString() Returns a string representation of this Double object
static String toString(double d) Returns a string representation of the double argument
static Double valueOf(double d) Returns a Double instance representing the specified double value
static Double valueOf(String s) Returns a Double object holding the double value represented by the argument string s
Appendix E String Class Methods
Method Summary char charAt(int index)
Returns the char value at the specified index
int codePointAt(int index) Returns the character (Unicode code point) at the specified index
int codePointBefore(int index) Returns the character (Unicode code point) before the specified index
int codePointCount(int beginIndex int endIndex) Returns the number of Unicode code points in the specified text range of this String
10
int compareTo(String anotherString) Compares two strings lexicographically
int compareToIgnoreCase(String str) Compares two strings lexicographically ignoring case differences
String concat(String str) Concatenates the specified string to the end of this string
boolean contains(CharSequence s) Returns true if and only if this string contains the specified sequence of char values
boolean contentEquals(CharSequence cs) Compares this string to the specified CharSequence
boolean contentEquals(StringBuffer sb) Compares this string to the specified StringBuffer
static String
copyValueOf(char[] data) Returns a String that represents the character sequence in the array specified
static String
copyValueOf(char[] data int offset int count) Returns a String that represents the character sequence in the array specified
boolean endsWith(String suffix) Tests if this string ends with the specified suffix
boolean equals(Object anObject) Compares this string to the specified object
boolean equalsIgnoreCase(String anotherString) Compares this String to another String ignoring case considerations
static String
format(String format Object args) Returns a formatted string using the specified format string and arguments
byte[] getBytes() Encodes this String into a sequence of bytes using the platforms default charset storing the result into a new byte array
byte[] getBytes(Charset charset) Encodes this String into a sequence of bytes using the given charset storing the result into a new byte array
byte[] getBytes(String charsetName) Encodes this String into a sequence of bytes using the named charset storing the result into a new byte array
void getChars(int srcBegin int srcEnd char[] dst int dstBegin) Copies characters from this string into the destination character array
int indexOf(int ch) Returns the index within this string of the first occurrence of the specified character
int indexOf(int ch int fromIndex) Returns the index within this string of the first occurrence of the specified character starting the search at the specified index
int indexOf(String str) Returns the index within this string of the first occurrence of the specified substring
int indexOf(String str int fromIndex) Returns the index within this string of the first occurrence of the specified substring starting at the specified index
boolean isEmpty() Returns true if and only if length() is 0
int lastIndexOf(int ch) Returns the index within this string of the last occurrence of the specified character
int lastIndexOf(int ch int fromIndex) Returns the index within this string of the last occurrence of the specified character searching backward starting at the specified index
int lastIndexOf(String str)
11
Returns the index within this string of the rightmost occurrence of the specified substring
int lastIndexOf(String str int fromIndex) Returns the index within this string of the last occurrence of the specified substring searching backward starting at the specified index
int length() Returns the length of this string
boolean matches(String regex) Tells whether or not this string matches the given regular expression
int offsetByCodePoints(int index int codePointOffset) Returns the index within this String that is offset from the given index by codePointOffset code points
boolean regionMatches(boolean ignoreCase int toffset String other int ooffset int len) Tests if two string regions are equal
boolean regionMatches(int toffset String other int ooffset int len) Tests if two string regions are equal
String replace(char oldChar char newChar) Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar
String replace(CharSequence target CharSequence replacement) Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence
String replaceAll(String regex String replacement) Replaces each substring of this string that matches the given regular expression with the given replacement
String replaceFirst(String regex String replacement) Replaces the first substring of this string that matches the given regular expression with the given replacement
String[] split(String regex) Splits this string around matches of the given regular expression
String[] split(String regex int limit) Splits this string around matches of the given regular expression
boolean startsWith(String prefix) Tests if this string starts with the specified prefix
boolean startsWith(String prefix int toffset) Tests if the substring of this string beginning at the specified index starts with the specified prefix
CharSequence
subSequence(int beginIndex int endIndex) Returns a new character sequence that is a subsequence of this sequence
String substring(int beginIndex) Returns a new string that is a substring of this string
String substring(int beginIndex int endIndex) Returns a new string that is a substring of this string
char[] toCharArray() Converts this string to a new character array
String toLowerCase() Converts all of the characters in this String to lower case using the rules of the default locale
String toString() This object (which is already a string) is itself returned
String toUpperCase() Converts all of the characters in this String to upper case using the rules of the default locale
String trim() Returns a copy of the string with leading and trailing whitespace omitted
static String
valueOf(boolean b) Returns the string representation of the boolean argument
static valueOf(char c)
12
String Returns the string representation of the char argument
static String
valueOf(char[] data) Returns the string representation of the char array argument
static String
valueOf(char[] data int offset int count) Returns the string representation of a specific subarray of the char array argument
static String
valueOf(double d) Returns the string representation of the double argument
static String
valueOf(float f) Returns the string representation of the float argument
static String
valueOf(int i) Returns the string representation of the int argument
static String
valueOf(long l) Returns the string representation of the long argument
static String
valueOf(Object obj) Returns the string representation of the Object argument
Appendix F Random Class Methods
Method Summaryprotected int
next(int bits) Generates the next pseudorandom number
boolean nextBoolean() Returns the next pseudorandom uniformly distributed boolean value from this random number generators sequence
void nextBytes(byte[] bytes) Generates random bytes and places them into a user-supplied byte array
double nextDouble() Returns the next pseudorandom uniformly distributed double value between 00 and 10 from this random number generators sequence
float nextFloat() Returns the next pseudorandom uniformly distributed float value between 00 and 10 from this random number generators sequence
double nextGaussian() Returns the next pseudorandom Gaussian (normally) distributed double value with mean 00 and standard deviation 10 from this random number generators sequence
int nextInt() Returns the next pseudorandom uniformly distributed int value from this random number generators sequence
int nextInt(int n) Returns a pseudorandom uniformly distributed int value between 0 (inclusive) and the specified value (exclusive) drawn from this random number generators sequence
long nextLong() Returns the next pseudorandom uniformly distributed long value from this random number generators sequence
void setSeed(long seed) Sets the seed of this random number generator using a single long seed
Appendix G InputOutput Classes
G11 Scanner Class
Constructor Summary
13
Scanner(File source) Constructs a new Scanner that produces values scanned from the specified file
Scanner(InputStream source) Constructs a new Scanner that produces values scanned from the specified input stream
Scanner(InputStream source String charsetName) Constructs a new Scanner that produces values scanned from the specified input stream
Method Summary void close()
Closes this scanner
Pattern delimiter() Returns the Pattern this Scanner is currently using to match delimiters
String findInLine(Pattern pattern) Attempts to find the next occurrence of the specified pattern ignoring delimiters
String findInLine(String pattern) Attempts to find the next occurrence of a pattern constructed from the specified string ignoring delimiters
boolean hasNext() Returns true if this scanner has another token in its input
boolean hasNext(Pattern pattern) Returns true if the next complete token matches the specified pattern
boolean hasNext(String pattern) Returns true if the next token matches the pattern constructed from the specified string
boolean hasNextBoolean() Returns true if the next token in this scanners input can be interpreted as a boolean value using a case insensitive pattern created from the string true|false
boolean hasNextByte() Returns true if the next token in this scanners input can be interpreted as a byte value in the default radix using the nextByte() method
boolean hasNextByte(int radix) Returns true if the next token in this scanners input can be interpreted as a byte value in the specified radix using the nextByte() method
boolean hasNextDouble() Returns true if the next token in this scanners input can be interpreted as a double value using thenextDouble() method
boolean hasNextFloat() Returns true if the next token in this scanners input can be interpreted as a float value using thenextFloat() method
boolean hasNextInt() Returns true if the next token in this scanners input can be interpreted as an int value in the default radix using the nextInt() method
boolean hasNextInt(int radix) Returns true if the next token in this scanners input can be interpreted as an int value in the specified radix using the nextInt() method
boolean hasNextLine() Returns true if there is another line in the input of this scanner
boolean hasNextLong() Returns true if the next token in this scanners input can be interpreted as a long value in the default radix using the nextLong() method
boolean hasNextLong(int radix) Returns true if the next token in this scanners input can be interpreted as a long value in the specified radix using the nextLong() method
14
IOException ioException() Returns the IOException last thrown by this Scanners underlying Readable
MatchResult match() Returns the match result of the last scanning operation performed by this scanner
String next() Finds and returns the next complete token from this scanner
String next(Pattern pattern) Returns the next token if it matches the specified pattern
String next(String pattern) Returns the next token if it matches the pattern constructed from the specified string
boolean nextBoolean() Scans the next token of the input into a boolean value and returns that value
byte nextByte() Scans the next token of the input as a byte
byte nextByte(int radix) Scans the next token of the input as a byte
double nextDouble() Scans the next token of the input as a double
float nextFloat() Scans the next token of the input as a float
int nextInt() Scans the next token of the input as an int
int nextInt(int radix) Scans the next token of the input as an int
String nextLine() Advances this scanner past the current line and returns the input that was skipped
long nextLong() Scans the next token of the input as a long
long nextLong(int radix) Scans the next token of the input as a long
int radix() Returns this scanners default radix
void remove() The remove operation is not supported by this implementation of Iterator
Scanner reset() Resets this scanner
Scanner skip(Pattern pattern) Skips input that matches the specified pattern ignoring delimiters
Scanner skip(String pattern) Skips input that matches a pattern constructed from the specified string
String toString() Returns the string representation of this Scanner
Scanner useDelimiter(Pattern pattern) Sets this scanners delimiting pattern to the specified pattern
Scanner useDelimiter(String pattern) Sets this scanners delimiting pattern to a pattern constructed from the specified String
Scanner useRadix(int radix) Sets this scanners default radix to the specified radix
15
G12 PrintWriter Class
Constructor SummaryPrintWriter(File file) Creates a new PrintWriter without automatic line flushing with the specified file
Method SummaryPrintWriter append(char c)
Appends the specified character to this writer
PrintWriter append(CharSequence csq) Appends the specified character sequence to this writer
PrintWriter append(CharSequence csq int start int end) Appends a subsequence of the specified character sequence to this writer
boolean checkError() Flushes the stream if its not closed and checks its error state
protected void
clearError() Clears the error state of this stream
void close() Closes the stream and releases any system resources associated with it
void flush() Flushes the stream
PrintWriter format(String format Object args) Writes a formatted string to this writer using the specified format string and arguments
void print(boolean b) Prints a boolean value
void print(char c) Prints a character
void print(char[] s) Prints an array of characters
void print(double d) Prints a double-precision floating-point number
void print(float f) Prints a floating-point number
void print(int i) Prints an integer
void print(long l) Prints a long integer
void print(Object obj) Prints an object
void print(String s) Prints a string
PrintWriter printf(String format Object args) A convenience method to write a formatted string to this writer using the specified format string and arguments
void println() Terminates the current line by writing the line separator string
void println(boolean x) Prints a boolean value and then terminates the line
void println(char x) Prints a character and then terminates the line
16
void println(char[] x) Prints an array of characters and then terminates the line
void println(double x) Prints a double-precision floating-point number and then terminates the line
void println(float x) Prints a floating-point number and then terminates the line
void println(int x) Prints an integer and then terminates the line
void println(long x) Prints a long integer and then terminates the line
void println(Object x) Prints an Object and then terminates the line
void println(String x) Prints a String and then terminates the line
protected void
setError() Indicates that an error has occurred
void write(char[] buf) Writes an array of characters
void write(char[] buf int off int len) Writes A Portion of an array of characters
void write(int c) Writes a single character
void write(String s) Writes a string
void write(String s int off int len) Writes a portion of a string
G13 File Class
Constructor SummaryFile(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname
File(URI uri) Creates a new File instance by converting the given file URI into an abstract pathname
Method Summaryboolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname
boolean canRead() Tests whether the application can read the file denoted by this abstract pathname
boolean canWrite() Tests whether the application can modify the file denoted by this abstract pathname
boolean createNewFile() Atomically creates a new empty file named by this abstract pathname if and only if a file with this name does not yet exist
static File
createTempFile(String prefix String suffix) Creates an empty file in the default temporary-file directory using the given prefix and suffix to generate its name
static File
createTempFile(String prefix String suffix File directory) Creates a new empty file in the specified directory using the given prefix and suffix strings to generate its name
boolean delete()
17
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
ltTgt void Sorts the specified array of objects according to the order induced by the specified comparator
staticltTgt void
sort(T[] a int fromIndex int toIndex Comparatorlt super Tgt c) Sorts the specified range of the specified array of objects according to the order induced by the specified comparator
static String
toString(boolean[] a) Returns a string representation of the contents of the specified array
static String
toString(byte[] a) Returns a string representation of the contents of the specified array
static String
toString(char[] a) Returns a string representation of the contents of the specified array
static String
toString(double[] a) Returns a string representation of the contents of the specified array
static String
toString(float[] a) Returns a string representation of the contents of the specified array
static String
toString(int[] a) Returns a string representation of the contents of the specified array
static String
toString(long[] a) Returns a string representation of the contents of the specified array
static String
toString(Object[] a) Returns a string representation of the contents of the specified array
Appendix D Primitive Wrappers
D11 Integer Class Methods
Method Summarystatic int bitCount(int i)
Returns the number of one-bits in the twos complement binary representation of the specified int value
byte byteValue() Returns the value of this Integer as a byte
int compareTo(Integer anotherInteger) Compares two Integer objects numerically
static Integer
decode(String nm) Decodes a String into an Integer
double doubleValue() Returns the value of this Integer as a double
boolean equals(Object obj) Compares this object to the specified object
float floatValue() Returns the value of this Integer as a float
static Integer
getInteger(String nm) Determines the integer value of the system property with the specified name
static Integer
getInteger(String nm int val) Determines the integer value of the system property with the specified name
static Integer
getInteger(String nm Integer val) Returns the integer value of the system property with the specified name
static int highestOneBit(int i) Returns an int value with at most a single one-bit in the position of the highest-order (leftmost) one-bit in the specified int value
int intValue()
8
Returns the value of this Integer as an int
long longValue() Returns the value of this Integer as a long
static int lowestOneBit(int i) Returns an int value with at most a single one-bit in the position of the lowest-order (rightmost) one-bit in the specified int value
static int numberOfLeadingZeros(int i) Returns the number of zero bits preceding the highest-order (leftmost) one-bit in the twos complement binary representation of the specified int value
static int numberOfTrailingZeros(int i) Returns the number of zero bits following the lowest-order (rightmost) one-bit in the twos complement binary representation of the specified int value
static int parseInt(String s) Parses the string argument as a signed decimal integer
static int parseInt(String s int radix) Parses the string argument as a signed integer in the radix specified by the second argument
static int reverse(int i) Returns the value obtained by reversing the order of the bits in the twos complement binary representation of the specified int value
static int reverseBytes(int i) Returns the value obtained by reversing the order of the bytes in the twos complement representation of the specified int value
static int rotateLeft(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue left by the specified number of bits
static int rotateRight(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue right by the specified number of bits
static String toBinaryString(int i) Returns a string representation of the integer argument as an unsigned integer in base 2
static String toHexString(int i) Returns a string representation of the integer argument as an unsigned integer in base 16
static String toOctalString(int i) Returns a string representation of the integer argument as an unsigned integer in base 8
String toString() Returns a String object representing this Integers value
static String toString(int i) Returns a String object representing the specified integer
static String toString(int i int radix) Returns a string representation of the first argument in the radix specified by the second argument
static Integer
valueOf(int i) Returns a Integer instance representing the specified int value
static Integer
valueOf(String s) Returns an Integer object holding the value of the specified String
static Integer
valueOf(String s int radix) Returns an Integer object holding the value extracted from the specified String when parsed with the radix given by the second argument
D12 Double Class Methods
Method Summary byte byteValue()
9
Returns the value of this Double as a byte (by casting to a byte)
static int compare(double d1 double d2) Compares the two specified double values
int compareTo(Double anotherDouble) Compares two Double objects numerically
double doubleValue() Returns the double value of this Double object
boolean equals(Object obj) Compares this object against the specified object
float floatValue() Returns the float value of this Double object
int intValue() Returns the value of this Double as an int (by casting to type int)
boolean isInfinite() Returns true if this Double value is infinitely large in magnitude false otherwise
static boolean isInfinite(double v) Returns true if the specified number is infinitely large in magnitude false otherwise
boolean isNaN() Returns true if this Double value is a Not-a-Number (NaN) false otherwise
static boolean isNaN(double v) Returns true if the specified number is a Not-a-Number (NaN) value false otherwise
static double longBitsToDouble(long bits) Returns the double value corresponding to a given bit representation
long longValue() Returns the value of this Double as a long (by casting to type long)
static double parseDouble(String s) Returns a new double initialized to the value represented by the specified String as performed by thevalueOf method of class Double
static String toHexString(double d) Returns a hexadecimal string representation of the double argument
String toString() Returns a string representation of this Double object
static String toString(double d) Returns a string representation of the double argument
static Double valueOf(double d) Returns a Double instance representing the specified double value
static Double valueOf(String s) Returns a Double object holding the double value represented by the argument string s
Appendix E String Class Methods
Method Summary char charAt(int index)
Returns the char value at the specified index
int codePointAt(int index) Returns the character (Unicode code point) at the specified index
int codePointBefore(int index) Returns the character (Unicode code point) before the specified index
int codePointCount(int beginIndex int endIndex) Returns the number of Unicode code points in the specified text range of this String
10
int compareTo(String anotherString) Compares two strings lexicographically
int compareToIgnoreCase(String str) Compares two strings lexicographically ignoring case differences
String concat(String str) Concatenates the specified string to the end of this string
boolean contains(CharSequence s) Returns true if and only if this string contains the specified sequence of char values
boolean contentEquals(CharSequence cs) Compares this string to the specified CharSequence
boolean contentEquals(StringBuffer sb) Compares this string to the specified StringBuffer
static String
copyValueOf(char[] data) Returns a String that represents the character sequence in the array specified
static String
copyValueOf(char[] data int offset int count) Returns a String that represents the character sequence in the array specified
boolean endsWith(String suffix) Tests if this string ends with the specified suffix
boolean equals(Object anObject) Compares this string to the specified object
boolean equalsIgnoreCase(String anotherString) Compares this String to another String ignoring case considerations
static String
format(String format Object args) Returns a formatted string using the specified format string and arguments
byte[] getBytes() Encodes this String into a sequence of bytes using the platforms default charset storing the result into a new byte array
byte[] getBytes(Charset charset) Encodes this String into a sequence of bytes using the given charset storing the result into a new byte array
byte[] getBytes(String charsetName) Encodes this String into a sequence of bytes using the named charset storing the result into a new byte array
void getChars(int srcBegin int srcEnd char[] dst int dstBegin) Copies characters from this string into the destination character array
int indexOf(int ch) Returns the index within this string of the first occurrence of the specified character
int indexOf(int ch int fromIndex) Returns the index within this string of the first occurrence of the specified character starting the search at the specified index
int indexOf(String str) Returns the index within this string of the first occurrence of the specified substring
int indexOf(String str int fromIndex) Returns the index within this string of the first occurrence of the specified substring starting at the specified index
boolean isEmpty() Returns true if and only if length() is 0
int lastIndexOf(int ch) Returns the index within this string of the last occurrence of the specified character
int lastIndexOf(int ch int fromIndex) Returns the index within this string of the last occurrence of the specified character searching backward starting at the specified index
int lastIndexOf(String str)
11
Returns the index within this string of the rightmost occurrence of the specified substring
int lastIndexOf(String str int fromIndex) Returns the index within this string of the last occurrence of the specified substring searching backward starting at the specified index
int length() Returns the length of this string
boolean matches(String regex) Tells whether or not this string matches the given regular expression
int offsetByCodePoints(int index int codePointOffset) Returns the index within this String that is offset from the given index by codePointOffset code points
boolean regionMatches(boolean ignoreCase int toffset String other int ooffset int len) Tests if two string regions are equal
boolean regionMatches(int toffset String other int ooffset int len) Tests if two string regions are equal
String replace(char oldChar char newChar) Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar
String replace(CharSequence target CharSequence replacement) Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence
String replaceAll(String regex String replacement) Replaces each substring of this string that matches the given regular expression with the given replacement
String replaceFirst(String regex String replacement) Replaces the first substring of this string that matches the given regular expression with the given replacement
String[] split(String regex) Splits this string around matches of the given regular expression
String[] split(String regex int limit) Splits this string around matches of the given regular expression
boolean startsWith(String prefix) Tests if this string starts with the specified prefix
boolean startsWith(String prefix int toffset) Tests if the substring of this string beginning at the specified index starts with the specified prefix
CharSequence
subSequence(int beginIndex int endIndex) Returns a new character sequence that is a subsequence of this sequence
String substring(int beginIndex) Returns a new string that is a substring of this string
String substring(int beginIndex int endIndex) Returns a new string that is a substring of this string
char[] toCharArray() Converts this string to a new character array
String toLowerCase() Converts all of the characters in this String to lower case using the rules of the default locale
String toString() This object (which is already a string) is itself returned
String toUpperCase() Converts all of the characters in this String to upper case using the rules of the default locale
String trim() Returns a copy of the string with leading and trailing whitespace omitted
static String
valueOf(boolean b) Returns the string representation of the boolean argument
static valueOf(char c)
12
String Returns the string representation of the char argument
static String
valueOf(char[] data) Returns the string representation of the char array argument
static String
valueOf(char[] data int offset int count) Returns the string representation of a specific subarray of the char array argument
static String
valueOf(double d) Returns the string representation of the double argument
static String
valueOf(float f) Returns the string representation of the float argument
static String
valueOf(int i) Returns the string representation of the int argument
static String
valueOf(long l) Returns the string representation of the long argument
static String
valueOf(Object obj) Returns the string representation of the Object argument
Appendix F Random Class Methods
Method Summaryprotected int
next(int bits) Generates the next pseudorandom number
boolean nextBoolean() Returns the next pseudorandom uniformly distributed boolean value from this random number generators sequence
void nextBytes(byte[] bytes) Generates random bytes and places them into a user-supplied byte array
double nextDouble() Returns the next pseudorandom uniformly distributed double value between 00 and 10 from this random number generators sequence
float nextFloat() Returns the next pseudorandom uniformly distributed float value between 00 and 10 from this random number generators sequence
double nextGaussian() Returns the next pseudorandom Gaussian (normally) distributed double value with mean 00 and standard deviation 10 from this random number generators sequence
int nextInt() Returns the next pseudorandom uniformly distributed int value from this random number generators sequence
int nextInt(int n) Returns a pseudorandom uniformly distributed int value between 0 (inclusive) and the specified value (exclusive) drawn from this random number generators sequence
long nextLong() Returns the next pseudorandom uniformly distributed long value from this random number generators sequence
void setSeed(long seed) Sets the seed of this random number generator using a single long seed
Appendix G InputOutput Classes
G11 Scanner Class
Constructor Summary
13
Scanner(File source) Constructs a new Scanner that produces values scanned from the specified file
Scanner(InputStream source) Constructs a new Scanner that produces values scanned from the specified input stream
Scanner(InputStream source String charsetName) Constructs a new Scanner that produces values scanned from the specified input stream
Method Summary void close()
Closes this scanner
Pattern delimiter() Returns the Pattern this Scanner is currently using to match delimiters
String findInLine(Pattern pattern) Attempts to find the next occurrence of the specified pattern ignoring delimiters
String findInLine(String pattern) Attempts to find the next occurrence of a pattern constructed from the specified string ignoring delimiters
boolean hasNext() Returns true if this scanner has another token in its input
boolean hasNext(Pattern pattern) Returns true if the next complete token matches the specified pattern
boolean hasNext(String pattern) Returns true if the next token matches the pattern constructed from the specified string
boolean hasNextBoolean() Returns true if the next token in this scanners input can be interpreted as a boolean value using a case insensitive pattern created from the string true|false
boolean hasNextByte() Returns true if the next token in this scanners input can be interpreted as a byte value in the default radix using the nextByte() method
boolean hasNextByte(int radix) Returns true if the next token in this scanners input can be interpreted as a byte value in the specified radix using the nextByte() method
boolean hasNextDouble() Returns true if the next token in this scanners input can be interpreted as a double value using thenextDouble() method
boolean hasNextFloat() Returns true if the next token in this scanners input can be interpreted as a float value using thenextFloat() method
boolean hasNextInt() Returns true if the next token in this scanners input can be interpreted as an int value in the default radix using the nextInt() method
boolean hasNextInt(int radix) Returns true if the next token in this scanners input can be interpreted as an int value in the specified radix using the nextInt() method
boolean hasNextLine() Returns true if there is another line in the input of this scanner
boolean hasNextLong() Returns true if the next token in this scanners input can be interpreted as a long value in the default radix using the nextLong() method
boolean hasNextLong(int radix) Returns true if the next token in this scanners input can be interpreted as a long value in the specified radix using the nextLong() method
14
IOException ioException() Returns the IOException last thrown by this Scanners underlying Readable
MatchResult match() Returns the match result of the last scanning operation performed by this scanner
String next() Finds and returns the next complete token from this scanner
String next(Pattern pattern) Returns the next token if it matches the specified pattern
String next(String pattern) Returns the next token if it matches the pattern constructed from the specified string
boolean nextBoolean() Scans the next token of the input into a boolean value and returns that value
byte nextByte() Scans the next token of the input as a byte
byte nextByte(int radix) Scans the next token of the input as a byte
double nextDouble() Scans the next token of the input as a double
float nextFloat() Scans the next token of the input as a float
int nextInt() Scans the next token of the input as an int
int nextInt(int radix) Scans the next token of the input as an int
String nextLine() Advances this scanner past the current line and returns the input that was skipped
long nextLong() Scans the next token of the input as a long
long nextLong(int radix) Scans the next token of the input as a long
int radix() Returns this scanners default radix
void remove() The remove operation is not supported by this implementation of Iterator
Scanner reset() Resets this scanner
Scanner skip(Pattern pattern) Skips input that matches the specified pattern ignoring delimiters
Scanner skip(String pattern) Skips input that matches a pattern constructed from the specified string
String toString() Returns the string representation of this Scanner
Scanner useDelimiter(Pattern pattern) Sets this scanners delimiting pattern to the specified pattern
Scanner useDelimiter(String pattern) Sets this scanners delimiting pattern to a pattern constructed from the specified String
Scanner useRadix(int radix) Sets this scanners default radix to the specified radix
15
G12 PrintWriter Class
Constructor SummaryPrintWriter(File file) Creates a new PrintWriter without automatic line flushing with the specified file
Method SummaryPrintWriter append(char c)
Appends the specified character to this writer
PrintWriter append(CharSequence csq) Appends the specified character sequence to this writer
PrintWriter append(CharSequence csq int start int end) Appends a subsequence of the specified character sequence to this writer
boolean checkError() Flushes the stream if its not closed and checks its error state
protected void
clearError() Clears the error state of this stream
void close() Closes the stream and releases any system resources associated with it
void flush() Flushes the stream
PrintWriter format(String format Object args) Writes a formatted string to this writer using the specified format string and arguments
void print(boolean b) Prints a boolean value
void print(char c) Prints a character
void print(char[] s) Prints an array of characters
void print(double d) Prints a double-precision floating-point number
void print(float f) Prints a floating-point number
void print(int i) Prints an integer
void print(long l) Prints a long integer
void print(Object obj) Prints an object
void print(String s) Prints a string
PrintWriter printf(String format Object args) A convenience method to write a formatted string to this writer using the specified format string and arguments
void println() Terminates the current line by writing the line separator string
void println(boolean x) Prints a boolean value and then terminates the line
void println(char x) Prints a character and then terminates the line
16
void println(char[] x) Prints an array of characters and then terminates the line
void println(double x) Prints a double-precision floating-point number and then terminates the line
void println(float x) Prints a floating-point number and then terminates the line
void println(int x) Prints an integer and then terminates the line
void println(long x) Prints a long integer and then terminates the line
void println(Object x) Prints an Object and then terminates the line
void println(String x) Prints a String and then terminates the line
protected void
setError() Indicates that an error has occurred
void write(char[] buf) Writes an array of characters
void write(char[] buf int off int len) Writes A Portion of an array of characters
void write(int c) Writes a single character
void write(String s) Writes a string
void write(String s int off int len) Writes a portion of a string
G13 File Class
Constructor SummaryFile(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname
File(URI uri) Creates a new File instance by converting the given file URI into an abstract pathname
Method Summaryboolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname
boolean canRead() Tests whether the application can read the file denoted by this abstract pathname
boolean canWrite() Tests whether the application can modify the file denoted by this abstract pathname
boolean createNewFile() Atomically creates a new empty file named by this abstract pathname if and only if a file with this name does not yet exist
static File
createTempFile(String prefix String suffix) Creates an empty file in the default temporary-file directory using the given prefix and suffix to generate its name
static File
createTempFile(String prefix String suffix File directory) Creates a new empty file in the specified directory using the given prefix and suffix strings to generate its name
boolean delete()
17
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
Returns the value of this Integer as an int
long longValue() Returns the value of this Integer as a long
static int lowestOneBit(int i) Returns an int value with at most a single one-bit in the position of the lowest-order (rightmost) one-bit in the specified int value
static int numberOfLeadingZeros(int i) Returns the number of zero bits preceding the highest-order (leftmost) one-bit in the twos complement binary representation of the specified int value
static int numberOfTrailingZeros(int i) Returns the number of zero bits following the lowest-order (rightmost) one-bit in the twos complement binary representation of the specified int value
static int parseInt(String s) Parses the string argument as a signed decimal integer
static int parseInt(String s int radix) Parses the string argument as a signed integer in the radix specified by the second argument
static int reverse(int i) Returns the value obtained by reversing the order of the bits in the twos complement binary representation of the specified int value
static int reverseBytes(int i) Returns the value obtained by reversing the order of the bytes in the twos complement representation of the specified int value
static int rotateLeft(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue left by the specified number of bits
static int rotateRight(int i int distance) Returns the value obtained by rotating the twos complement binary representation of the specified intvalue right by the specified number of bits
static String toBinaryString(int i) Returns a string representation of the integer argument as an unsigned integer in base 2
static String toHexString(int i) Returns a string representation of the integer argument as an unsigned integer in base 16
static String toOctalString(int i) Returns a string representation of the integer argument as an unsigned integer in base 8
String toString() Returns a String object representing this Integers value
static String toString(int i) Returns a String object representing the specified integer
static String toString(int i int radix) Returns a string representation of the first argument in the radix specified by the second argument
static Integer
valueOf(int i) Returns a Integer instance representing the specified int value
static Integer
valueOf(String s) Returns an Integer object holding the value of the specified String
static Integer
valueOf(String s int radix) Returns an Integer object holding the value extracted from the specified String when parsed with the radix given by the second argument
D12 Double Class Methods
Method Summary byte byteValue()
9
Returns the value of this Double as a byte (by casting to a byte)
static int compare(double d1 double d2) Compares the two specified double values
int compareTo(Double anotherDouble) Compares two Double objects numerically
double doubleValue() Returns the double value of this Double object
boolean equals(Object obj) Compares this object against the specified object
float floatValue() Returns the float value of this Double object
int intValue() Returns the value of this Double as an int (by casting to type int)
boolean isInfinite() Returns true if this Double value is infinitely large in magnitude false otherwise
static boolean isInfinite(double v) Returns true if the specified number is infinitely large in magnitude false otherwise
boolean isNaN() Returns true if this Double value is a Not-a-Number (NaN) false otherwise
static boolean isNaN(double v) Returns true if the specified number is a Not-a-Number (NaN) value false otherwise
static double longBitsToDouble(long bits) Returns the double value corresponding to a given bit representation
long longValue() Returns the value of this Double as a long (by casting to type long)
static double parseDouble(String s) Returns a new double initialized to the value represented by the specified String as performed by thevalueOf method of class Double
static String toHexString(double d) Returns a hexadecimal string representation of the double argument
String toString() Returns a string representation of this Double object
static String toString(double d) Returns a string representation of the double argument
static Double valueOf(double d) Returns a Double instance representing the specified double value
static Double valueOf(String s) Returns a Double object holding the double value represented by the argument string s
Appendix E String Class Methods
Method Summary char charAt(int index)
Returns the char value at the specified index
int codePointAt(int index) Returns the character (Unicode code point) at the specified index
int codePointBefore(int index) Returns the character (Unicode code point) before the specified index
int codePointCount(int beginIndex int endIndex) Returns the number of Unicode code points in the specified text range of this String
10
int compareTo(String anotherString) Compares two strings lexicographically
int compareToIgnoreCase(String str) Compares two strings lexicographically ignoring case differences
String concat(String str) Concatenates the specified string to the end of this string
boolean contains(CharSequence s) Returns true if and only if this string contains the specified sequence of char values
boolean contentEquals(CharSequence cs) Compares this string to the specified CharSequence
boolean contentEquals(StringBuffer sb) Compares this string to the specified StringBuffer
static String
copyValueOf(char[] data) Returns a String that represents the character sequence in the array specified
static String
copyValueOf(char[] data int offset int count) Returns a String that represents the character sequence in the array specified
boolean endsWith(String suffix) Tests if this string ends with the specified suffix
boolean equals(Object anObject) Compares this string to the specified object
boolean equalsIgnoreCase(String anotherString) Compares this String to another String ignoring case considerations
static String
format(String format Object args) Returns a formatted string using the specified format string and arguments
byte[] getBytes() Encodes this String into a sequence of bytes using the platforms default charset storing the result into a new byte array
byte[] getBytes(Charset charset) Encodes this String into a sequence of bytes using the given charset storing the result into a new byte array
byte[] getBytes(String charsetName) Encodes this String into a sequence of bytes using the named charset storing the result into a new byte array
void getChars(int srcBegin int srcEnd char[] dst int dstBegin) Copies characters from this string into the destination character array
int indexOf(int ch) Returns the index within this string of the first occurrence of the specified character
int indexOf(int ch int fromIndex) Returns the index within this string of the first occurrence of the specified character starting the search at the specified index
int indexOf(String str) Returns the index within this string of the first occurrence of the specified substring
int indexOf(String str int fromIndex) Returns the index within this string of the first occurrence of the specified substring starting at the specified index
boolean isEmpty() Returns true if and only if length() is 0
int lastIndexOf(int ch) Returns the index within this string of the last occurrence of the specified character
int lastIndexOf(int ch int fromIndex) Returns the index within this string of the last occurrence of the specified character searching backward starting at the specified index
int lastIndexOf(String str)
11
Returns the index within this string of the rightmost occurrence of the specified substring
int lastIndexOf(String str int fromIndex) Returns the index within this string of the last occurrence of the specified substring searching backward starting at the specified index
int length() Returns the length of this string
boolean matches(String regex) Tells whether or not this string matches the given regular expression
int offsetByCodePoints(int index int codePointOffset) Returns the index within this String that is offset from the given index by codePointOffset code points
boolean regionMatches(boolean ignoreCase int toffset String other int ooffset int len) Tests if two string regions are equal
boolean regionMatches(int toffset String other int ooffset int len) Tests if two string regions are equal
String replace(char oldChar char newChar) Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar
String replace(CharSequence target CharSequence replacement) Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence
String replaceAll(String regex String replacement) Replaces each substring of this string that matches the given regular expression with the given replacement
String replaceFirst(String regex String replacement) Replaces the first substring of this string that matches the given regular expression with the given replacement
String[] split(String regex) Splits this string around matches of the given regular expression
String[] split(String regex int limit) Splits this string around matches of the given regular expression
boolean startsWith(String prefix) Tests if this string starts with the specified prefix
boolean startsWith(String prefix int toffset) Tests if the substring of this string beginning at the specified index starts with the specified prefix
CharSequence
subSequence(int beginIndex int endIndex) Returns a new character sequence that is a subsequence of this sequence
String substring(int beginIndex) Returns a new string that is a substring of this string
String substring(int beginIndex int endIndex) Returns a new string that is a substring of this string
char[] toCharArray() Converts this string to a new character array
String toLowerCase() Converts all of the characters in this String to lower case using the rules of the default locale
String toString() This object (which is already a string) is itself returned
String toUpperCase() Converts all of the characters in this String to upper case using the rules of the default locale
String trim() Returns a copy of the string with leading and trailing whitespace omitted
static String
valueOf(boolean b) Returns the string representation of the boolean argument
static valueOf(char c)
12
String Returns the string representation of the char argument
static String
valueOf(char[] data) Returns the string representation of the char array argument
static String
valueOf(char[] data int offset int count) Returns the string representation of a specific subarray of the char array argument
static String
valueOf(double d) Returns the string representation of the double argument
static String
valueOf(float f) Returns the string representation of the float argument
static String
valueOf(int i) Returns the string representation of the int argument
static String
valueOf(long l) Returns the string representation of the long argument
static String
valueOf(Object obj) Returns the string representation of the Object argument
Appendix F Random Class Methods
Method Summaryprotected int
next(int bits) Generates the next pseudorandom number
boolean nextBoolean() Returns the next pseudorandom uniformly distributed boolean value from this random number generators sequence
void nextBytes(byte[] bytes) Generates random bytes and places them into a user-supplied byte array
double nextDouble() Returns the next pseudorandom uniformly distributed double value between 00 and 10 from this random number generators sequence
float nextFloat() Returns the next pseudorandom uniformly distributed float value between 00 and 10 from this random number generators sequence
double nextGaussian() Returns the next pseudorandom Gaussian (normally) distributed double value with mean 00 and standard deviation 10 from this random number generators sequence
int nextInt() Returns the next pseudorandom uniformly distributed int value from this random number generators sequence
int nextInt(int n) Returns a pseudorandom uniformly distributed int value between 0 (inclusive) and the specified value (exclusive) drawn from this random number generators sequence
long nextLong() Returns the next pseudorandom uniformly distributed long value from this random number generators sequence
void setSeed(long seed) Sets the seed of this random number generator using a single long seed
Appendix G InputOutput Classes
G11 Scanner Class
Constructor Summary
13
Scanner(File source) Constructs a new Scanner that produces values scanned from the specified file
Scanner(InputStream source) Constructs a new Scanner that produces values scanned from the specified input stream
Scanner(InputStream source String charsetName) Constructs a new Scanner that produces values scanned from the specified input stream
Method Summary void close()
Closes this scanner
Pattern delimiter() Returns the Pattern this Scanner is currently using to match delimiters
String findInLine(Pattern pattern) Attempts to find the next occurrence of the specified pattern ignoring delimiters
String findInLine(String pattern) Attempts to find the next occurrence of a pattern constructed from the specified string ignoring delimiters
boolean hasNext() Returns true if this scanner has another token in its input
boolean hasNext(Pattern pattern) Returns true if the next complete token matches the specified pattern
boolean hasNext(String pattern) Returns true if the next token matches the pattern constructed from the specified string
boolean hasNextBoolean() Returns true if the next token in this scanners input can be interpreted as a boolean value using a case insensitive pattern created from the string true|false
boolean hasNextByte() Returns true if the next token in this scanners input can be interpreted as a byte value in the default radix using the nextByte() method
boolean hasNextByte(int radix) Returns true if the next token in this scanners input can be interpreted as a byte value in the specified radix using the nextByte() method
boolean hasNextDouble() Returns true if the next token in this scanners input can be interpreted as a double value using thenextDouble() method
boolean hasNextFloat() Returns true if the next token in this scanners input can be interpreted as a float value using thenextFloat() method
boolean hasNextInt() Returns true if the next token in this scanners input can be interpreted as an int value in the default radix using the nextInt() method
boolean hasNextInt(int radix) Returns true if the next token in this scanners input can be interpreted as an int value in the specified radix using the nextInt() method
boolean hasNextLine() Returns true if there is another line in the input of this scanner
boolean hasNextLong() Returns true if the next token in this scanners input can be interpreted as a long value in the default radix using the nextLong() method
boolean hasNextLong(int radix) Returns true if the next token in this scanners input can be interpreted as a long value in the specified radix using the nextLong() method
14
IOException ioException() Returns the IOException last thrown by this Scanners underlying Readable
MatchResult match() Returns the match result of the last scanning operation performed by this scanner
String next() Finds and returns the next complete token from this scanner
String next(Pattern pattern) Returns the next token if it matches the specified pattern
String next(String pattern) Returns the next token if it matches the pattern constructed from the specified string
boolean nextBoolean() Scans the next token of the input into a boolean value and returns that value
byte nextByte() Scans the next token of the input as a byte
byte nextByte(int radix) Scans the next token of the input as a byte
double nextDouble() Scans the next token of the input as a double
float nextFloat() Scans the next token of the input as a float
int nextInt() Scans the next token of the input as an int
int nextInt(int radix) Scans the next token of the input as an int
String nextLine() Advances this scanner past the current line and returns the input that was skipped
long nextLong() Scans the next token of the input as a long
long nextLong(int radix) Scans the next token of the input as a long
int radix() Returns this scanners default radix
void remove() The remove operation is not supported by this implementation of Iterator
Scanner reset() Resets this scanner
Scanner skip(Pattern pattern) Skips input that matches the specified pattern ignoring delimiters
Scanner skip(String pattern) Skips input that matches a pattern constructed from the specified string
String toString() Returns the string representation of this Scanner
Scanner useDelimiter(Pattern pattern) Sets this scanners delimiting pattern to the specified pattern
Scanner useDelimiter(String pattern) Sets this scanners delimiting pattern to a pattern constructed from the specified String
Scanner useRadix(int radix) Sets this scanners default radix to the specified radix
15
G12 PrintWriter Class
Constructor SummaryPrintWriter(File file) Creates a new PrintWriter without automatic line flushing with the specified file
Method SummaryPrintWriter append(char c)
Appends the specified character to this writer
PrintWriter append(CharSequence csq) Appends the specified character sequence to this writer
PrintWriter append(CharSequence csq int start int end) Appends a subsequence of the specified character sequence to this writer
boolean checkError() Flushes the stream if its not closed and checks its error state
protected void
clearError() Clears the error state of this stream
void close() Closes the stream and releases any system resources associated with it
void flush() Flushes the stream
PrintWriter format(String format Object args) Writes a formatted string to this writer using the specified format string and arguments
void print(boolean b) Prints a boolean value
void print(char c) Prints a character
void print(char[] s) Prints an array of characters
void print(double d) Prints a double-precision floating-point number
void print(float f) Prints a floating-point number
void print(int i) Prints an integer
void print(long l) Prints a long integer
void print(Object obj) Prints an object
void print(String s) Prints a string
PrintWriter printf(String format Object args) A convenience method to write a formatted string to this writer using the specified format string and arguments
void println() Terminates the current line by writing the line separator string
void println(boolean x) Prints a boolean value and then terminates the line
void println(char x) Prints a character and then terminates the line
16
void println(char[] x) Prints an array of characters and then terminates the line
void println(double x) Prints a double-precision floating-point number and then terminates the line
void println(float x) Prints a floating-point number and then terminates the line
void println(int x) Prints an integer and then terminates the line
void println(long x) Prints a long integer and then terminates the line
void println(Object x) Prints an Object and then terminates the line
void println(String x) Prints a String and then terminates the line
protected void
setError() Indicates that an error has occurred
void write(char[] buf) Writes an array of characters
void write(char[] buf int off int len) Writes A Portion of an array of characters
void write(int c) Writes a single character
void write(String s) Writes a string
void write(String s int off int len) Writes a portion of a string
G13 File Class
Constructor SummaryFile(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname
File(URI uri) Creates a new File instance by converting the given file URI into an abstract pathname
Method Summaryboolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname
boolean canRead() Tests whether the application can read the file denoted by this abstract pathname
boolean canWrite() Tests whether the application can modify the file denoted by this abstract pathname
boolean createNewFile() Atomically creates a new empty file named by this abstract pathname if and only if a file with this name does not yet exist
static File
createTempFile(String prefix String suffix) Creates an empty file in the default temporary-file directory using the given prefix and suffix to generate its name
static File
createTempFile(String prefix String suffix File directory) Creates a new empty file in the specified directory using the given prefix and suffix strings to generate its name
boolean delete()
17
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
Returns the value of this Double as a byte (by casting to a byte)
static int compare(double d1 double d2) Compares the two specified double values
int compareTo(Double anotherDouble) Compares two Double objects numerically
double doubleValue() Returns the double value of this Double object
boolean equals(Object obj) Compares this object against the specified object
float floatValue() Returns the float value of this Double object
int intValue() Returns the value of this Double as an int (by casting to type int)
boolean isInfinite() Returns true if this Double value is infinitely large in magnitude false otherwise
static boolean isInfinite(double v) Returns true if the specified number is infinitely large in magnitude false otherwise
boolean isNaN() Returns true if this Double value is a Not-a-Number (NaN) false otherwise
static boolean isNaN(double v) Returns true if the specified number is a Not-a-Number (NaN) value false otherwise
static double longBitsToDouble(long bits) Returns the double value corresponding to a given bit representation
long longValue() Returns the value of this Double as a long (by casting to type long)
static double parseDouble(String s) Returns a new double initialized to the value represented by the specified String as performed by thevalueOf method of class Double
static String toHexString(double d) Returns a hexadecimal string representation of the double argument
String toString() Returns a string representation of this Double object
static String toString(double d) Returns a string representation of the double argument
static Double valueOf(double d) Returns a Double instance representing the specified double value
static Double valueOf(String s) Returns a Double object holding the double value represented by the argument string s
Appendix E String Class Methods
Method Summary char charAt(int index)
Returns the char value at the specified index
int codePointAt(int index) Returns the character (Unicode code point) at the specified index
int codePointBefore(int index) Returns the character (Unicode code point) before the specified index
int codePointCount(int beginIndex int endIndex) Returns the number of Unicode code points in the specified text range of this String
10
int compareTo(String anotherString) Compares two strings lexicographically
int compareToIgnoreCase(String str) Compares two strings lexicographically ignoring case differences
String concat(String str) Concatenates the specified string to the end of this string
boolean contains(CharSequence s) Returns true if and only if this string contains the specified sequence of char values
boolean contentEquals(CharSequence cs) Compares this string to the specified CharSequence
boolean contentEquals(StringBuffer sb) Compares this string to the specified StringBuffer
static String
copyValueOf(char[] data) Returns a String that represents the character sequence in the array specified
static String
copyValueOf(char[] data int offset int count) Returns a String that represents the character sequence in the array specified
boolean endsWith(String suffix) Tests if this string ends with the specified suffix
boolean equals(Object anObject) Compares this string to the specified object
boolean equalsIgnoreCase(String anotherString) Compares this String to another String ignoring case considerations
static String
format(String format Object args) Returns a formatted string using the specified format string and arguments
byte[] getBytes() Encodes this String into a sequence of bytes using the platforms default charset storing the result into a new byte array
byte[] getBytes(Charset charset) Encodes this String into a sequence of bytes using the given charset storing the result into a new byte array
byte[] getBytes(String charsetName) Encodes this String into a sequence of bytes using the named charset storing the result into a new byte array
void getChars(int srcBegin int srcEnd char[] dst int dstBegin) Copies characters from this string into the destination character array
int indexOf(int ch) Returns the index within this string of the first occurrence of the specified character
int indexOf(int ch int fromIndex) Returns the index within this string of the first occurrence of the specified character starting the search at the specified index
int indexOf(String str) Returns the index within this string of the first occurrence of the specified substring
int indexOf(String str int fromIndex) Returns the index within this string of the first occurrence of the specified substring starting at the specified index
boolean isEmpty() Returns true if and only if length() is 0
int lastIndexOf(int ch) Returns the index within this string of the last occurrence of the specified character
int lastIndexOf(int ch int fromIndex) Returns the index within this string of the last occurrence of the specified character searching backward starting at the specified index
int lastIndexOf(String str)
11
Returns the index within this string of the rightmost occurrence of the specified substring
int lastIndexOf(String str int fromIndex) Returns the index within this string of the last occurrence of the specified substring searching backward starting at the specified index
int length() Returns the length of this string
boolean matches(String regex) Tells whether or not this string matches the given regular expression
int offsetByCodePoints(int index int codePointOffset) Returns the index within this String that is offset from the given index by codePointOffset code points
boolean regionMatches(boolean ignoreCase int toffset String other int ooffset int len) Tests if two string regions are equal
boolean regionMatches(int toffset String other int ooffset int len) Tests if two string regions are equal
String replace(char oldChar char newChar) Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar
String replace(CharSequence target CharSequence replacement) Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence
String replaceAll(String regex String replacement) Replaces each substring of this string that matches the given regular expression with the given replacement
String replaceFirst(String regex String replacement) Replaces the first substring of this string that matches the given regular expression with the given replacement
String[] split(String regex) Splits this string around matches of the given regular expression
String[] split(String regex int limit) Splits this string around matches of the given regular expression
boolean startsWith(String prefix) Tests if this string starts with the specified prefix
boolean startsWith(String prefix int toffset) Tests if the substring of this string beginning at the specified index starts with the specified prefix
CharSequence
subSequence(int beginIndex int endIndex) Returns a new character sequence that is a subsequence of this sequence
String substring(int beginIndex) Returns a new string that is a substring of this string
String substring(int beginIndex int endIndex) Returns a new string that is a substring of this string
char[] toCharArray() Converts this string to a new character array
String toLowerCase() Converts all of the characters in this String to lower case using the rules of the default locale
String toString() This object (which is already a string) is itself returned
String toUpperCase() Converts all of the characters in this String to upper case using the rules of the default locale
String trim() Returns a copy of the string with leading and trailing whitespace omitted
static String
valueOf(boolean b) Returns the string representation of the boolean argument
static valueOf(char c)
12
String Returns the string representation of the char argument
static String
valueOf(char[] data) Returns the string representation of the char array argument
static String
valueOf(char[] data int offset int count) Returns the string representation of a specific subarray of the char array argument
static String
valueOf(double d) Returns the string representation of the double argument
static String
valueOf(float f) Returns the string representation of the float argument
static String
valueOf(int i) Returns the string representation of the int argument
static String
valueOf(long l) Returns the string representation of the long argument
static String
valueOf(Object obj) Returns the string representation of the Object argument
Appendix F Random Class Methods
Method Summaryprotected int
next(int bits) Generates the next pseudorandom number
boolean nextBoolean() Returns the next pseudorandom uniformly distributed boolean value from this random number generators sequence
void nextBytes(byte[] bytes) Generates random bytes and places them into a user-supplied byte array
double nextDouble() Returns the next pseudorandom uniformly distributed double value between 00 and 10 from this random number generators sequence
float nextFloat() Returns the next pseudorandom uniformly distributed float value between 00 and 10 from this random number generators sequence
double nextGaussian() Returns the next pseudorandom Gaussian (normally) distributed double value with mean 00 and standard deviation 10 from this random number generators sequence
int nextInt() Returns the next pseudorandom uniformly distributed int value from this random number generators sequence
int nextInt(int n) Returns a pseudorandom uniformly distributed int value between 0 (inclusive) and the specified value (exclusive) drawn from this random number generators sequence
long nextLong() Returns the next pseudorandom uniformly distributed long value from this random number generators sequence
void setSeed(long seed) Sets the seed of this random number generator using a single long seed
Appendix G InputOutput Classes
G11 Scanner Class
Constructor Summary
13
Scanner(File source) Constructs a new Scanner that produces values scanned from the specified file
Scanner(InputStream source) Constructs a new Scanner that produces values scanned from the specified input stream
Scanner(InputStream source String charsetName) Constructs a new Scanner that produces values scanned from the specified input stream
Method Summary void close()
Closes this scanner
Pattern delimiter() Returns the Pattern this Scanner is currently using to match delimiters
String findInLine(Pattern pattern) Attempts to find the next occurrence of the specified pattern ignoring delimiters
String findInLine(String pattern) Attempts to find the next occurrence of a pattern constructed from the specified string ignoring delimiters
boolean hasNext() Returns true if this scanner has another token in its input
boolean hasNext(Pattern pattern) Returns true if the next complete token matches the specified pattern
boolean hasNext(String pattern) Returns true if the next token matches the pattern constructed from the specified string
boolean hasNextBoolean() Returns true if the next token in this scanners input can be interpreted as a boolean value using a case insensitive pattern created from the string true|false
boolean hasNextByte() Returns true if the next token in this scanners input can be interpreted as a byte value in the default radix using the nextByte() method
boolean hasNextByte(int radix) Returns true if the next token in this scanners input can be interpreted as a byte value in the specified radix using the nextByte() method
boolean hasNextDouble() Returns true if the next token in this scanners input can be interpreted as a double value using thenextDouble() method
boolean hasNextFloat() Returns true if the next token in this scanners input can be interpreted as a float value using thenextFloat() method
boolean hasNextInt() Returns true if the next token in this scanners input can be interpreted as an int value in the default radix using the nextInt() method
boolean hasNextInt(int radix) Returns true if the next token in this scanners input can be interpreted as an int value in the specified radix using the nextInt() method
boolean hasNextLine() Returns true if there is another line in the input of this scanner
boolean hasNextLong() Returns true if the next token in this scanners input can be interpreted as a long value in the default radix using the nextLong() method
boolean hasNextLong(int radix) Returns true if the next token in this scanners input can be interpreted as a long value in the specified radix using the nextLong() method
14
IOException ioException() Returns the IOException last thrown by this Scanners underlying Readable
MatchResult match() Returns the match result of the last scanning operation performed by this scanner
String next() Finds and returns the next complete token from this scanner
String next(Pattern pattern) Returns the next token if it matches the specified pattern
String next(String pattern) Returns the next token if it matches the pattern constructed from the specified string
boolean nextBoolean() Scans the next token of the input into a boolean value and returns that value
byte nextByte() Scans the next token of the input as a byte
byte nextByte(int radix) Scans the next token of the input as a byte
double nextDouble() Scans the next token of the input as a double
float nextFloat() Scans the next token of the input as a float
int nextInt() Scans the next token of the input as an int
int nextInt(int radix) Scans the next token of the input as an int
String nextLine() Advances this scanner past the current line and returns the input that was skipped
long nextLong() Scans the next token of the input as a long
long nextLong(int radix) Scans the next token of the input as a long
int radix() Returns this scanners default radix
void remove() The remove operation is not supported by this implementation of Iterator
Scanner reset() Resets this scanner
Scanner skip(Pattern pattern) Skips input that matches the specified pattern ignoring delimiters
Scanner skip(String pattern) Skips input that matches a pattern constructed from the specified string
String toString() Returns the string representation of this Scanner
Scanner useDelimiter(Pattern pattern) Sets this scanners delimiting pattern to the specified pattern
Scanner useDelimiter(String pattern) Sets this scanners delimiting pattern to a pattern constructed from the specified String
Scanner useRadix(int radix) Sets this scanners default radix to the specified radix
15
G12 PrintWriter Class
Constructor SummaryPrintWriter(File file) Creates a new PrintWriter without automatic line flushing with the specified file
Method SummaryPrintWriter append(char c)
Appends the specified character to this writer
PrintWriter append(CharSequence csq) Appends the specified character sequence to this writer
PrintWriter append(CharSequence csq int start int end) Appends a subsequence of the specified character sequence to this writer
boolean checkError() Flushes the stream if its not closed and checks its error state
protected void
clearError() Clears the error state of this stream
void close() Closes the stream and releases any system resources associated with it
void flush() Flushes the stream
PrintWriter format(String format Object args) Writes a formatted string to this writer using the specified format string and arguments
void print(boolean b) Prints a boolean value
void print(char c) Prints a character
void print(char[] s) Prints an array of characters
void print(double d) Prints a double-precision floating-point number
void print(float f) Prints a floating-point number
void print(int i) Prints an integer
void print(long l) Prints a long integer
void print(Object obj) Prints an object
void print(String s) Prints a string
PrintWriter printf(String format Object args) A convenience method to write a formatted string to this writer using the specified format string and arguments
void println() Terminates the current line by writing the line separator string
void println(boolean x) Prints a boolean value and then terminates the line
void println(char x) Prints a character and then terminates the line
16
void println(char[] x) Prints an array of characters and then terminates the line
void println(double x) Prints a double-precision floating-point number and then terminates the line
void println(float x) Prints a floating-point number and then terminates the line
void println(int x) Prints an integer and then terminates the line
void println(long x) Prints a long integer and then terminates the line
void println(Object x) Prints an Object and then terminates the line
void println(String x) Prints a String and then terminates the line
protected void
setError() Indicates that an error has occurred
void write(char[] buf) Writes an array of characters
void write(char[] buf int off int len) Writes A Portion of an array of characters
void write(int c) Writes a single character
void write(String s) Writes a string
void write(String s int off int len) Writes a portion of a string
G13 File Class
Constructor SummaryFile(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname
File(URI uri) Creates a new File instance by converting the given file URI into an abstract pathname
Method Summaryboolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname
boolean canRead() Tests whether the application can read the file denoted by this abstract pathname
boolean canWrite() Tests whether the application can modify the file denoted by this abstract pathname
boolean createNewFile() Atomically creates a new empty file named by this abstract pathname if and only if a file with this name does not yet exist
static File
createTempFile(String prefix String suffix) Creates an empty file in the default temporary-file directory using the given prefix and suffix to generate its name
static File
createTempFile(String prefix String suffix File directory) Creates a new empty file in the specified directory using the given prefix and suffix strings to generate its name
boolean delete()
17
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
int compareTo(String anotherString) Compares two strings lexicographically
int compareToIgnoreCase(String str) Compares two strings lexicographically ignoring case differences
String concat(String str) Concatenates the specified string to the end of this string
boolean contains(CharSequence s) Returns true if and only if this string contains the specified sequence of char values
boolean contentEquals(CharSequence cs) Compares this string to the specified CharSequence
boolean contentEquals(StringBuffer sb) Compares this string to the specified StringBuffer
static String
copyValueOf(char[] data) Returns a String that represents the character sequence in the array specified
static String
copyValueOf(char[] data int offset int count) Returns a String that represents the character sequence in the array specified
boolean endsWith(String suffix) Tests if this string ends with the specified suffix
boolean equals(Object anObject) Compares this string to the specified object
boolean equalsIgnoreCase(String anotherString) Compares this String to another String ignoring case considerations
static String
format(String format Object args) Returns a formatted string using the specified format string and arguments
byte[] getBytes() Encodes this String into a sequence of bytes using the platforms default charset storing the result into a new byte array
byte[] getBytes(Charset charset) Encodes this String into a sequence of bytes using the given charset storing the result into a new byte array
byte[] getBytes(String charsetName) Encodes this String into a sequence of bytes using the named charset storing the result into a new byte array
void getChars(int srcBegin int srcEnd char[] dst int dstBegin) Copies characters from this string into the destination character array
int indexOf(int ch) Returns the index within this string of the first occurrence of the specified character
int indexOf(int ch int fromIndex) Returns the index within this string of the first occurrence of the specified character starting the search at the specified index
int indexOf(String str) Returns the index within this string of the first occurrence of the specified substring
int indexOf(String str int fromIndex) Returns the index within this string of the first occurrence of the specified substring starting at the specified index
boolean isEmpty() Returns true if and only if length() is 0
int lastIndexOf(int ch) Returns the index within this string of the last occurrence of the specified character
int lastIndexOf(int ch int fromIndex) Returns the index within this string of the last occurrence of the specified character searching backward starting at the specified index
int lastIndexOf(String str)
11
Returns the index within this string of the rightmost occurrence of the specified substring
int lastIndexOf(String str int fromIndex) Returns the index within this string of the last occurrence of the specified substring searching backward starting at the specified index
int length() Returns the length of this string
boolean matches(String regex) Tells whether or not this string matches the given regular expression
int offsetByCodePoints(int index int codePointOffset) Returns the index within this String that is offset from the given index by codePointOffset code points
boolean regionMatches(boolean ignoreCase int toffset String other int ooffset int len) Tests if two string regions are equal
boolean regionMatches(int toffset String other int ooffset int len) Tests if two string regions are equal
String replace(char oldChar char newChar) Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar
String replace(CharSequence target CharSequence replacement) Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence
String replaceAll(String regex String replacement) Replaces each substring of this string that matches the given regular expression with the given replacement
String replaceFirst(String regex String replacement) Replaces the first substring of this string that matches the given regular expression with the given replacement
String[] split(String regex) Splits this string around matches of the given regular expression
String[] split(String regex int limit) Splits this string around matches of the given regular expression
boolean startsWith(String prefix) Tests if this string starts with the specified prefix
boolean startsWith(String prefix int toffset) Tests if the substring of this string beginning at the specified index starts with the specified prefix
CharSequence
subSequence(int beginIndex int endIndex) Returns a new character sequence that is a subsequence of this sequence
String substring(int beginIndex) Returns a new string that is a substring of this string
String substring(int beginIndex int endIndex) Returns a new string that is a substring of this string
char[] toCharArray() Converts this string to a new character array
String toLowerCase() Converts all of the characters in this String to lower case using the rules of the default locale
String toString() This object (which is already a string) is itself returned
String toUpperCase() Converts all of the characters in this String to upper case using the rules of the default locale
String trim() Returns a copy of the string with leading and trailing whitespace omitted
static String
valueOf(boolean b) Returns the string representation of the boolean argument
static valueOf(char c)
12
String Returns the string representation of the char argument
static String
valueOf(char[] data) Returns the string representation of the char array argument
static String
valueOf(char[] data int offset int count) Returns the string representation of a specific subarray of the char array argument
static String
valueOf(double d) Returns the string representation of the double argument
static String
valueOf(float f) Returns the string representation of the float argument
static String
valueOf(int i) Returns the string representation of the int argument
static String
valueOf(long l) Returns the string representation of the long argument
static String
valueOf(Object obj) Returns the string representation of the Object argument
Appendix F Random Class Methods
Method Summaryprotected int
next(int bits) Generates the next pseudorandom number
boolean nextBoolean() Returns the next pseudorandom uniformly distributed boolean value from this random number generators sequence
void nextBytes(byte[] bytes) Generates random bytes and places them into a user-supplied byte array
double nextDouble() Returns the next pseudorandom uniformly distributed double value between 00 and 10 from this random number generators sequence
float nextFloat() Returns the next pseudorandom uniformly distributed float value between 00 and 10 from this random number generators sequence
double nextGaussian() Returns the next pseudorandom Gaussian (normally) distributed double value with mean 00 and standard deviation 10 from this random number generators sequence
int nextInt() Returns the next pseudorandom uniformly distributed int value from this random number generators sequence
int nextInt(int n) Returns a pseudorandom uniformly distributed int value between 0 (inclusive) and the specified value (exclusive) drawn from this random number generators sequence
long nextLong() Returns the next pseudorandom uniformly distributed long value from this random number generators sequence
void setSeed(long seed) Sets the seed of this random number generator using a single long seed
Appendix G InputOutput Classes
G11 Scanner Class
Constructor Summary
13
Scanner(File source) Constructs a new Scanner that produces values scanned from the specified file
Scanner(InputStream source) Constructs a new Scanner that produces values scanned from the specified input stream
Scanner(InputStream source String charsetName) Constructs a new Scanner that produces values scanned from the specified input stream
Method Summary void close()
Closes this scanner
Pattern delimiter() Returns the Pattern this Scanner is currently using to match delimiters
String findInLine(Pattern pattern) Attempts to find the next occurrence of the specified pattern ignoring delimiters
String findInLine(String pattern) Attempts to find the next occurrence of a pattern constructed from the specified string ignoring delimiters
boolean hasNext() Returns true if this scanner has another token in its input
boolean hasNext(Pattern pattern) Returns true if the next complete token matches the specified pattern
boolean hasNext(String pattern) Returns true if the next token matches the pattern constructed from the specified string
boolean hasNextBoolean() Returns true if the next token in this scanners input can be interpreted as a boolean value using a case insensitive pattern created from the string true|false
boolean hasNextByte() Returns true if the next token in this scanners input can be interpreted as a byte value in the default radix using the nextByte() method
boolean hasNextByte(int radix) Returns true if the next token in this scanners input can be interpreted as a byte value in the specified radix using the nextByte() method
boolean hasNextDouble() Returns true if the next token in this scanners input can be interpreted as a double value using thenextDouble() method
boolean hasNextFloat() Returns true if the next token in this scanners input can be interpreted as a float value using thenextFloat() method
boolean hasNextInt() Returns true if the next token in this scanners input can be interpreted as an int value in the default radix using the nextInt() method
boolean hasNextInt(int radix) Returns true if the next token in this scanners input can be interpreted as an int value in the specified radix using the nextInt() method
boolean hasNextLine() Returns true if there is another line in the input of this scanner
boolean hasNextLong() Returns true if the next token in this scanners input can be interpreted as a long value in the default radix using the nextLong() method
boolean hasNextLong(int radix) Returns true if the next token in this scanners input can be interpreted as a long value in the specified radix using the nextLong() method
14
IOException ioException() Returns the IOException last thrown by this Scanners underlying Readable
MatchResult match() Returns the match result of the last scanning operation performed by this scanner
String next() Finds and returns the next complete token from this scanner
String next(Pattern pattern) Returns the next token if it matches the specified pattern
String next(String pattern) Returns the next token if it matches the pattern constructed from the specified string
boolean nextBoolean() Scans the next token of the input into a boolean value and returns that value
byte nextByte() Scans the next token of the input as a byte
byte nextByte(int radix) Scans the next token of the input as a byte
double nextDouble() Scans the next token of the input as a double
float nextFloat() Scans the next token of the input as a float
int nextInt() Scans the next token of the input as an int
int nextInt(int radix) Scans the next token of the input as an int
String nextLine() Advances this scanner past the current line and returns the input that was skipped
long nextLong() Scans the next token of the input as a long
long nextLong(int radix) Scans the next token of the input as a long
int radix() Returns this scanners default radix
void remove() The remove operation is not supported by this implementation of Iterator
Scanner reset() Resets this scanner
Scanner skip(Pattern pattern) Skips input that matches the specified pattern ignoring delimiters
Scanner skip(String pattern) Skips input that matches a pattern constructed from the specified string
String toString() Returns the string representation of this Scanner
Scanner useDelimiter(Pattern pattern) Sets this scanners delimiting pattern to the specified pattern
Scanner useDelimiter(String pattern) Sets this scanners delimiting pattern to a pattern constructed from the specified String
Scanner useRadix(int radix) Sets this scanners default radix to the specified radix
15
G12 PrintWriter Class
Constructor SummaryPrintWriter(File file) Creates a new PrintWriter without automatic line flushing with the specified file
Method SummaryPrintWriter append(char c)
Appends the specified character to this writer
PrintWriter append(CharSequence csq) Appends the specified character sequence to this writer
PrintWriter append(CharSequence csq int start int end) Appends a subsequence of the specified character sequence to this writer
boolean checkError() Flushes the stream if its not closed and checks its error state
protected void
clearError() Clears the error state of this stream
void close() Closes the stream and releases any system resources associated with it
void flush() Flushes the stream
PrintWriter format(String format Object args) Writes a formatted string to this writer using the specified format string and arguments
void print(boolean b) Prints a boolean value
void print(char c) Prints a character
void print(char[] s) Prints an array of characters
void print(double d) Prints a double-precision floating-point number
void print(float f) Prints a floating-point number
void print(int i) Prints an integer
void print(long l) Prints a long integer
void print(Object obj) Prints an object
void print(String s) Prints a string
PrintWriter printf(String format Object args) A convenience method to write a formatted string to this writer using the specified format string and arguments
void println() Terminates the current line by writing the line separator string
void println(boolean x) Prints a boolean value and then terminates the line
void println(char x) Prints a character and then terminates the line
16
void println(char[] x) Prints an array of characters and then terminates the line
void println(double x) Prints a double-precision floating-point number and then terminates the line
void println(float x) Prints a floating-point number and then terminates the line
void println(int x) Prints an integer and then terminates the line
void println(long x) Prints a long integer and then terminates the line
void println(Object x) Prints an Object and then terminates the line
void println(String x) Prints a String and then terminates the line
protected void
setError() Indicates that an error has occurred
void write(char[] buf) Writes an array of characters
void write(char[] buf int off int len) Writes A Portion of an array of characters
void write(int c) Writes a single character
void write(String s) Writes a string
void write(String s int off int len) Writes a portion of a string
G13 File Class
Constructor SummaryFile(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname
File(URI uri) Creates a new File instance by converting the given file URI into an abstract pathname
Method Summaryboolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname
boolean canRead() Tests whether the application can read the file denoted by this abstract pathname
boolean canWrite() Tests whether the application can modify the file denoted by this abstract pathname
boolean createNewFile() Atomically creates a new empty file named by this abstract pathname if and only if a file with this name does not yet exist
static File
createTempFile(String prefix String suffix) Creates an empty file in the default temporary-file directory using the given prefix and suffix to generate its name
static File
createTempFile(String prefix String suffix File directory) Creates a new empty file in the specified directory using the given prefix and suffix strings to generate its name
boolean delete()
17
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
Returns the index within this string of the rightmost occurrence of the specified substring
int lastIndexOf(String str int fromIndex) Returns the index within this string of the last occurrence of the specified substring searching backward starting at the specified index
int length() Returns the length of this string
boolean matches(String regex) Tells whether or not this string matches the given regular expression
int offsetByCodePoints(int index int codePointOffset) Returns the index within this String that is offset from the given index by codePointOffset code points
boolean regionMatches(boolean ignoreCase int toffset String other int ooffset int len) Tests if two string regions are equal
boolean regionMatches(int toffset String other int ooffset int len) Tests if two string regions are equal
String replace(char oldChar char newChar) Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar
String replace(CharSequence target CharSequence replacement) Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence
String replaceAll(String regex String replacement) Replaces each substring of this string that matches the given regular expression with the given replacement
String replaceFirst(String regex String replacement) Replaces the first substring of this string that matches the given regular expression with the given replacement
String[] split(String regex) Splits this string around matches of the given regular expression
String[] split(String regex int limit) Splits this string around matches of the given regular expression
boolean startsWith(String prefix) Tests if this string starts with the specified prefix
boolean startsWith(String prefix int toffset) Tests if the substring of this string beginning at the specified index starts with the specified prefix
CharSequence
subSequence(int beginIndex int endIndex) Returns a new character sequence that is a subsequence of this sequence
String substring(int beginIndex) Returns a new string that is a substring of this string
String substring(int beginIndex int endIndex) Returns a new string that is a substring of this string
char[] toCharArray() Converts this string to a new character array
String toLowerCase() Converts all of the characters in this String to lower case using the rules of the default locale
String toString() This object (which is already a string) is itself returned
String toUpperCase() Converts all of the characters in this String to upper case using the rules of the default locale
String trim() Returns a copy of the string with leading and trailing whitespace omitted
static String
valueOf(boolean b) Returns the string representation of the boolean argument
static valueOf(char c)
12
String Returns the string representation of the char argument
static String
valueOf(char[] data) Returns the string representation of the char array argument
static String
valueOf(char[] data int offset int count) Returns the string representation of a specific subarray of the char array argument
static String
valueOf(double d) Returns the string representation of the double argument
static String
valueOf(float f) Returns the string representation of the float argument
static String
valueOf(int i) Returns the string representation of the int argument
static String
valueOf(long l) Returns the string representation of the long argument
static String
valueOf(Object obj) Returns the string representation of the Object argument
Appendix F Random Class Methods
Method Summaryprotected int
next(int bits) Generates the next pseudorandom number
boolean nextBoolean() Returns the next pseudorandom uniformly distributed boolean value from this random number generators sequence
void nextBytes(byte[] bytes) Generates random bytes and places them into a user-supplied byte array
double nextDouble() Returns the next pseudorandom uniformly distributed double value between 00 and 10 from this random number generators sequence
float nextFloat() Returns the next pseudorandom uniformly distributed float value between 00 and 10 from this random number generators sequence
double nextGaussian() Returns the next pseudorandom Gaussian (normally) distributed double value with mean 00 and standard deviation 10 from this random number generators sequence
int nextInt() Returns the next pseudorandom uniformly distributed int value from this random number generators sequence
int nextInt(int n) Returns a pseudorandom uniformly distributed int value between 0 (inclusive) and the specified value (exclusive) drawn from this random number generators sequence
long nextLong() Returns the next pseudorandom uniformly distributed long value from this random number generators sequence
void setSeed(long seed) Sets the seed of this random number generator using a single long seed
Appendix G InputOutput Classes
G11 Scanner Class
Constructor Summary
13
Scanner(File source) Constructs a new Scanner that produces values scanned from the specified file
Scanner(InputStream source) Constructs a new Scanner that produces values scanned from the specified input stream
Scanner(InputStream source String charsetName) Constructs a new Scanner that produces values scanned from the specified input stream
Method Summary void close()
Closes this scanner
Pattern delimiter() Returns the Pattern this Scanner is currently using to match delimiters
String findInLine(Pattern pattern) Attempts to find the next occurrence of the specified pattern ignoring delimiters
String findInLine(String pattern) Attempts to find the next occurrence of a pattern constructed from the specified string ignoring delimiters
boolean hasNext() Returns true if this scanner has another token in its input
boolean hasNext(Pattern pattern) Returns true if the next complete token matches the specified pattern
boolean hasNext(String pattern) Returns true if the next token matches the pattern constructed from the specified string
boolean hasNextBoolean() Returns true if the next token in this scanners input can be interpreted as a boolean value using a case insensitive pattern created from the string true|false
boolean hasNextByte() Returns true if the next token in this scanners input can be interpreted as a byte value in the default radix using the nextByte() method
boolean hasNextByte(int radix) Returns true if the next token in this scanners input can be interpreted as a byte value in the specified radix using the nextByte() method
boolean hasNextDouble() Returns true if the next token in this scanners input can be interpreted as a double value using thenextDouble() method
boolean hasNextFloat() Returns true if the next token in this scanners input can be interpreted as a float value using thenextFloat() method
boolean hasNextInt() Returns true if the next token in this scanners input can be interpreted as an int value in the default radix using the nextInt() method
boolean hasNextInt(int radix) Returns true if the next token in this scanners input can be interpreted as an int value in the specified radix using the nextInt() method
boolean hasNextLine() Returns true if there is another line in the input of this scanner
boolean hasNextLong() Returns true if the next token in this scanners input can be interpreted as a long value in the default radix using the nextLong() method
boolean hasNextLong(int radix) Returns true if the next token in this scanners input can be interpreted as a long value in the specified radix using the nextLong() method
14
IOException ioException() Returns the IOException last thrown by this Scanners underlying Readable
MatchResult match() Returns the match result of the last scanning operation performed by this scanner
String next() Finds and returns the next complete token from this scanner
String next(Pattern pattern) Returns the next token if it matches the specified pattern
String next(String pattern) Returns the next token if it matches the pattern constructed from the specified string
boolean nextBoolean() Scans the next token of the input into a boolean value and returns that value
byte nextByte() Scans the next token of the input as a byte
byte nextByte(int radix) Scans the next token of the input as a byte
double nextDouble() Scans the next token of the input as a double
float nextFloat() Scans the next token of the input as a float
int nextInt() Scans the next token of the input as an int
int nextInt(int radix) Scans the next token of the input as an int
String nextLine() Advances this scanner past the current line and returns the input that was skipped
long nextLong() Scans the next token of the input as a long
long nextLong(int radix) Scans the next token of the input as a long
int radix() Returns this scanners default radix
void remove() The remove operation is not supported by this implementation of Iterator
Scanner reset() Resets this scanner
Scanner skip(Pattern pattern) Skips input that matches the specified pattern ignoring delimiters
Scanner skip(String pattern) Skips input that matches a pattern constructed from the specified string
String toString() Returns the string representation of this Scanner
Scanner useDelimiter(Pattern pattern) Sets this scanners delimiting pattern to the specified pattern
Scanner useDelimiter(String pattern) Sets this scanners delimiting pattern to a pattern constructed from the specified String
Scanner useRadix(int radix) Sets this scanners default radix to the specified radix
15
G12 PrintWriter Class
Constructor SummaryPrintWriter(File file) Creates a new PrintWriter without automatic line flushing with the specified file
Method SummaryPrintWriter append(char c)
Appends the specified character to this writer
PrintWriter append(CharSequence csq) Appends the specified character sequence to this writer
PrintWriter append(CharSequence csq int start int end) Appends a subsequence of the specified character sequence to this writer
boolean checkError() Flushes the stream if its not closed and checks its error state
protected void
clearError() Clears the error state of this stream
void close() Closes the stream and releases any system resources associated with it
void flush() Flushes the stream
PrintWriter format(String format Object args) Writes a formatted string to this writer using the specified format string and arguments
void print(boolean b) Prints a boolean value
void print(char c) Prints a character
void print(char[] s) Prints an array of characters
void print(double d) Prints a double-precision floating-point number
void print(float f) Prints a floating-point number
void print(int i) Prints an integer
void print(long l) Prints a long integer
void print(Object obj) Prints an object
void print(String s) Prints a string
PrintWriter printf(String format Object args) A convenience method to write a formatted string to this writer using the specified format string and arguments
void println() Terminates the current line by writing the line separator string
void println(boolean x) Prints a boolean value and then terminates the line
void println(char x) Prints a character and then terminates the line
16
void println(char[] x) Prints an array of characters and then terminates the line
void println(double x) Prints a double-precision floating-point number and then terminates the line
void println(float x) Prints a floating-point number and then terminates the line
void println(int x) Prints an integer and then terminates the line
void println(long x) Prints a long integer and then terminates the line
void println(Object x) Prints an Object and then terminates the line
void println(String x) Prints a String and then terminates the line
protected void
setError() Indicates that an error has occurred
void write(char[] buf) Writes an array of characters
void write(char[] buf int off int len) Writes A Portion of an array of characters
void write(int c) Writes a single character
void write(String s) Writes a string
void write(String s int off int len) Writes a portion of a string
G13 File Class
Constructor SummaryFile(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname
File(URI uri) Creates a new File instance by converting the given file URI into an abstract pathname
Method Summaryboolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname
boolean canRead() Tests whether the application can read the file denoted by this abstract pathname
boolean canWrite() Tests whether the application can modify the file denoted by this abstract pathname
boolean createNewFile() Atomically creates a new empty file named by this abstract pathname if and only if a file with this name does not yet exist
static File
createTempFile(String prefix String suffix) Creates an empty file in the default temporary-file directory using the given prefix and suffix to generate its name
static File
createTempFile(String prefix String suffix File directory) Creates a new empty file in the specified directory using the given prefix and suffix strings to generate its name
boolean delete()
17
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
String Returns the string representation of the char argument
static String
valueOf(char[] data) Returns the string representation of the char array argument
static String
valueOf(char[] data int offset int count) Returns the string representation of a specific subarray of the char array argument
static String
valueOf(double d) Returns the string representation of the double argument
static String
valueOf(float f) Returns the string representation of the float argument
static String
valueOf(int i) Returns the string representation of the int argument
static String
valueOf(long l) Returns the string representation of the long argument
static String
valueOf(Object obj) Returns the string representation of the Object argument
Appendix F Random Class Methods
Method Summaryprotected int
next(int bits) Generates the next pseudorandom number
boolean nextBoolean() Returns the next pseudorandom uniformly distributed boolean value from this random number generators sequence
void nextBytes(byte[] bytes) Generates random bytes and places them into a user-supplied byte array
double nextDouble() Returns the next pseudorandom uniformly distributed double value between 00 and 10 from this random number generators sequence
float nextFloat() Returns the next pseudorandom uniformly distributed float value between 00 and 10 from this random number generators sequence
double nextGaussian() Returns the next pseudorandom Gaussian (normally) distributed double value with mean 00 and standard deviation 10 from this random number generators sequence
int nextInt() Returns the next pseudorandom uniformly distributed int value from this random number generators sequence
int nextInt(int n) Returns a pseudorandom uniformly distributed int value between 0 (inclusive) and the specified value (exclusive) drawn from this random number generators sequence
long nextLong() Returns the next pseudorandom uniformly distributed long value from this random number generators sequence
void setSeed(long seed) Sets the seed of this random number generator using a single long seed
Appendix G InputOutput Classes
G11 Scanner Class
Constructor Summary
13
Scanner(File source) Constructs a new Scanner that produces values scanned from the specified file
Scanner(InputStream source) Constructs a new Scanner that produces values scanned from the specified input stream
Scanner(InputStream source String charsetName) Constructs a new Scanner that produces values scanned from the specified input stream
Method Summary void close()
Closes this scanner
Pattern delimiter() Returns the Pattern this Scanner is currently using to match delimiters
String findInLine(Pattern pattern) Attempts to find the next occurrence of the specified pattern ignoring delimiters
String findInLine(String pattern) Attempts to find the next occurrence of a pattern constructed from the specified string ignoring delimiters
boolean hasNext() Returns true if this scanner has another token in its input
boolean hasNext(Pattern pattern) Returns true if the next complete token matches the specified pattern
boolean hasNext(String pattern) Returns true if the next token matches the pattern constructed from the specified string
boolean hasNextBoolean() Returns true if the next token in this scanners input can be interpreted as a boolean value using a case insensitive pattern created from the string true|false
boolean hasNextByte() Returns true if the next token in this scanners input can be interpreted as a byte value in the default radix using the nextByte() method
boolean hasNextByte(int radix) Returns true if the next token in this scanners input can be interpreted as a byte value in the specified radix using the nextByte() method
boolean hasNextDouble() Returns true if the next token in this scanners input can be interpreted as a double value using thenextDouble() method
boolean hasNextFloat() Returns true if the next token in this scanners input can be interpreted as a float value using thenextFloat() method
boolean hasNextInt() Returns true if the next token in this scanners input can be interpreted as an int value in the default radix using the nextInt() method
boolean hasNextInt(int radix) Returns true if the next token in this scanners input can be interpreted as an int value in the specified radix using the nextInt() method
boolean hasNextLine() Returns true if there is another line in the input of this scanner
boolean hasNextLong() Returns true if the next token in this scanners input can be interpreted as a long value in the default radix using the nextLong() method
boolean hasNextLong(int radix) Returns true if the next token in this scanners input can be interpreted as a long value in the specified radix using the nextLong() method
14
IOException ioException() Returns the IOException last thrown by this Scanners underlying Readable
MatchResult match() Returns the match result of the last scanning operation performed by this scanner
String next() Finds and returns the next complete token from this scanner
String next(Pattern pattern) Returns the next token if it matches the specified pattern
String next(String pattern) Returns the next token if it matches the pattern constructed from the specified string
boolean nextBoolean() Scans the next token of the input into a boolean value and returns that value
byte nextByte() Scans the next token of the input as a byte
byte nextByte(int radix) Scans the next token of the input as a byte
double nextDouble() Scans the next token of the input as a double
float nextFloat() Scans the next token of the input as a float
int nextInt() Scans the next token of the input as an int
int nextInt(int radix) Scans the next token of the input as an int
String nextLine() Advances this scanner past the current line and returns the input that was skipped
long nextLong() Scans the next token of the input as a long
long nextLong(int radix) Scans the next token of the input as a long
int radix() Returns this scanners default radix
void remove() The remove operation is not supported by this implementation of Iterator
Scanner reset() Resets this scanner
Scanner skip(Pattern pattern) Skips input that matches the specified pattern ignoring delimiters
Scanner skip(String pattern) Skips input that matches a pattern constructed from the specified string
String toString() Returns the string representation of this Scanner
Scanner useDelimiter(Pattern pattern) Sets this scanners delimiting pattern to the specified pattern
Scanner useDelimiter(String pattern) Sets this scanners delimiting pattern to a pattern constructed from the specified String
Scanner useRadix(int radix) Sets this scanners default radix to the specified radix
15
G12 PrintWriter Class
Constructor SummaryPrintWriter(File file) Creates a new PrintWriter without automatic line flushing with the specified file
Method SummaryPrintWriter append(char c)
Appends the specified character to this writer
PrintWriter append(CharSequence csq) Appends the specified character sequence to this writer
PrintWriter append(CharSequence csq int start int end) Appends a subsequence of the specified character sequence to this writer
boolean checkError() Flushes the stream if its not closed and checks its error state
protected void
clearError() Clears the error state of this stream
void close() Closes the stream and releases any system resources associated with it
void flush() Flushes the stream
PrintWriter format(String format Object args) Writes a formatted string to this writer using the specified format string and arguments
void print(boolean b) Prints a boolean value
void print(char c) Prints a character
void print(char[] s) Prints an array of characters
void print(double d) Prints a double-precision floating-point number
void print(float f) Prints a floating-point number
void print(int i) Prints an integer
void print(long l) Prints a long integer
void print(Object obj) Prints an object
void print(String s) Prints a string
PrintWriter printf(String format Object args) A convenience method to write a formatted string to this writer using the specified format string and arguments
void println() Terminates the current line by writing the line separator string
void println(boolean x) Prints a boolean value and then terminates the line
void println(char x) Prints a character and then terminates the line
16
void println(char[] x) Prints an array of characters and then terminates the line
void println(double x) Prints a double-precision floating-point number and then terminates the line
void println(float x) Prints a floating-point number and then terminates the line
void println(int x) Prints an integer and then terminates the line
void println(long x) Prints a long integer and then terminates the line
void println(Object x) Prints an Object and then terminates the line
void println(String x) Prints a String and then terminates the line
protected void
setError() Indicates that an error has occurred
void write(char[] buf) Writes an array of characters
void write(char[] buf int off int len) Writes A Portion of an array of characters
void write(int c) Writes a single character
void write(String s) Writes a string
void write(String s int off int len) Writes a portion of a string
G13 File Class
Constructor SummaryFile(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname
File(URI uri) Creates a new File instance by converting the given file URI into an abstract pathname
Method Summaryboolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname
boolean canRead() Tests whether the application can read the file denoted by this abstract pathname
boolean canWrite() Tests whether the application can modify the file denoted by this abstract pathname
boolean createNewFile() Atomically creates a new empty file named by this abstract pathname if and only if a file with this name does not yet exist
static File
createTempFile(String prefix String suffix) Creates an empty file in the default temporary-file directory using the given prefix and suffix to generate its name
static File
createTempFile(String prefix String suffix File directory) Creates a new empty file in the specified directory using the given prefix and suffix strings to generate its name
boolean delete()
17
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
Scanner(File source) Constructs a new Scanner that produces values scanned from the specified file
Scanner(InputStream source) Constructs a new Scanner that produces values scanned from the specified input stream
Scanner(InputStream source String charsetName) Constructs a new Scanner that produces values scanned from the specified input stream
Method Summary void close()
Closes this scanner
Pattern delimiter() Returns the Pattern this Scanner is currently using to match delimiters
String findInLine(Pattern pattern) Attempts to find the next occurrence of the specified pattern ignoring delimiters
String findInLine(String pattern) Attempts to find the next occurrence of a pattern constructed from the specified string ignoring delimiters
boolean hasNext() Returns true if this scanner has another token in its input
boolean hasNext(Pattern pattern) Returns true if the next complete token matches the specified pattern
boolean hasNext(String pattern) Returns true if the next token matches the pattern constructed from the specified string
boolean hasNextBoolean() Returns true if the next token in this scanners input can be interpreted as a boolean value using a case insensitive pattern created from the string true|false
boolean hasNextByte() Returns true if the next token in this scanners input can be interpreted as a byte value in the default radix using the nextByte() method
boolean hasNextByte(int radix) Returns true if the next token in this scanners input can be interpreted as a byte value in the specified radix using the nextByte() method
boolean hasNextDouble() Returns true if the next token in this scanners input can be interpreted as a double value using thenextDouble() method
boolean hasNextFloat() Returns true if the next token in this scanners input can be interpreted as a float value using thenextFloat() method
boolean hasNextInt() Returns true if the next token in this scanners input can be interpreted as an int value in the default radix using the nextInt() method
boolean hasNextInt(int radix) Returns true if the next token in this scanners input can be interpreted as an int value in the specified radix using the nextInt() method
boolean hasNextLine() Returns true if there is another line in the input of this scanner
boolean hasNextLong() Returns true if the next token in this scanners input can be interpreted as a long value in the default radix using the nextLong() method
boolean hasNextLong(int radix) Returns true if the next token in this scanners input can be interpreted as a long value in the specified radix using the nextLong() method
14
IOException ioException() Returns the IOException last thrown by this Scanners underlying Readable
MatchResult match() Returns the match result of the last scanning operation performed by this scanner
String next() Finds and returns the next complete token from this scanner
String next(Pattern pattern) Returns the next token if it matches the specified pattern
String next(String pattern) Returns the next token if it matches the pattern constructed from the specified string
boolean nextBoolean() Scans the next token of the input into a boolean value and returns that value
byte nextByte() Scans the next token of the input as a byte
byte nextByte(int radix) Scans the next token of the input as a byte
double nextDouble() Scans the next token of the input as a double
float nextFloat() Scans the next token of the input as a float
int nextInt() Scans the next token of the input as an int
int nextInt(int radix) Scans the next token of the input as an int
String nextLine() Advances this scanner past the current line and returns the input that was skipped
long nextLong() Scans the next token of the input as a long
long nextLong(int radix) Scans the next token of the input as a long
int radix() Returns this scanners default radix
void remove() The remove operation is not supported by this implementation of Iterator
Scanner reset() Resets this scanner
Scanner skip(Pattern pattern) Skips input that matches the specified pattern ignoring delimiters
Scanner skip(String pattern) Skips input that matches a pattern constructed from the specified string
String toString() Returns the string representation of this Scanner
Scanner useDelimiter(Pattern pattern) Sets this scanners delimiting pattern to the specified pattern
Scanner useDelimiter(String pattern) Sets this scanners delimiting pattern to a pattern constructed from the specified String
Scanner useRadix(int radix) Sets this scanners default radix to the specified radix
15
G12 PrintWriter Class
Constructor SummaryPrintWriter(File file) Creates a new PrintWriter without automatic line flushing with the specified file
Method SummaryPrintWriter append(char c)
Appends the specified character to this writer
PrintWriter append(CharSequence csq) Appends the specified character sequence to this writer
PrintWriter append(CharSequence csq int start int end) Appends a subsequence of the specified character sequence to this writer
boolean checkError() Flushes the stream if its not closed and checks its error state
protected void
clearError() Clears the error state of this stream
void close() Closes the stream and releases any system resources associated with it
void flush() Flushes the stream
PrintWriter format(String format Object args) Writes a formatted string to this writer using the specified format string and arguments
void print(boolean b) Prints a boolean value
void print(char c) Prints a character
void print(char[] s) Prints an array of characters
void print(double d) Prints a double-precision floating-point number
void print(float f) Prints a floating-point number
void print(int i) Prints an integer
void print(long l) Prints a long integer
void print(Object obj) Prints an object
void print(String s) Prints a string
PrintWriter printf(String format Object args) A convenience method to write a formatted string to this writer using the specified format string and arguments
void println() Terminates the current line by writing the line separator string
void println(boolean x) Prints a boolean value and then terminates the line
void println(char x) Prints a character and then terminates the line
16
void println(char[] x) Prints an array of characters and then terminates the line
void println(double x) Prints a double-precision floating-point number and then terminates the line
void println(float x) Prints a floating-point number and then terminates the line
void println(int x) Prints an integer and then terminates the line
void println(long x) Prints a long integer and then terminates the line
void println(Object x) Prints an Object and then terminates the line
void println(String x) Prints a String and then terminates the line
protected void
setError() Indicates that an error has occurred
void write(char[] buf) Writes an array of characters
void write(char[] buf int off int len) Writes A Portion of an array of characters
void write(int c) Writes a single character
void write(String s) Writes a string
void write(String s int off int len) Writes a portion of a string
G13 File Class
Constructor SummaryFile(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname
File(URI uri) Creates a new File instance by converting the given file URI into an abstract pathname
Method Summaryboolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname
boolean canRead() Tests whether the application can read the file denoted by this abstract pathname
boolean canWrite() Tests whether the application can modify the file denoted by this abstract pathname
boolean createNewFile() Atomically creates a new empty file named by this abstract pathname if and only if a file with this name does not yet exist
static File
createTempFile(String prefix String suffix) Creates an empty file in the default temporary-file directory using the given prefix and suffix to generate its name
static File
createTempFile(String prefix String suffix File directory) Creates a new empty file in the specified directory using the given prefix and suffix strings to generate its name
boolean delete()
17
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
IOException ioException() Returns the IOException last thrown by this Scanners underlying Readable
MatchResult match() Returns the match result of the last scanning operation performed by this scanner
String next() Finds and returns the next complete token from this scanner
String next(Pattern pattern) Returns the next token if it matches the specified pattern
String next(String pattern) Returns the next token if it matches the pattern constructed from the specified string
boolean nextBoolean() Scans the next token of the input into a boolean value and returns that value
byte nextByte() Scans the next token of the input as a byte
byte nextByte(int radix) Scans the next token of the input as a byte
double nextDouble() Scans the next token of the input as a double
float nextFloat() Scans the next token of the input as a float
int nextInt() Scans the next token of the input as an int
int nextInt(int radix) Scans the next token of the input as an int
String nextLine() Advances this scanner past the current line and returns the input that was skipped
long nextLong() Scans the next token of the input as a long
long nextLong(int radix) Scans the next token of the input as a long
int radix() Returns this scanners default radix
void remove() The remove operation is not supported by this implementation of Iterator
Scanner reset() Resets this scanner
Scanner skip(Pattern pattern) Skips input that matches the specified pattern ignoring delimiters
Scanner skip(String pattern) Skips input that matches a pattern constructed from the specified string
String toString() Returns the string representation of this Scanner
Scanner useDelimiter(Pattern pattern) Sets this scanners delimiting pattern to the specified pattern
Scanner useDelimiter(String pattern) Sets this scanners delimiting pattern to a pattern constructed from the specified String
Scanner useRadix(int radix) Sets this scanners default radix to the specified radix
15
G12 PrintWriter Class
Constructor SummaryPrintWriter(File file) Creates a new PrintWriter without automatic line flushing with the specified file
Method SummaryPrintWriter append(char c)
Appends the specified character to this writer
PrintWriter append(CharSequence csq) Appends the specified character sequence to this writer
PrintWriter append(CharSequence csq int start int end) Appends a subsequence of the specified character sequence to this writer
boolean checkError() Flushes the stream if its not closed and checks its error state
protected void
clearError() Clears the error state of this stream
void close() Closes the stream and releases any system resources associated with it
void flush() Flushes the stream
PrintWriter format(String format Object args) Writes a formatted string to this writer using the specified format string and arguments
void print(boolean b) Prints a boolean value
void print(char c) Prints a character
void print(char[] s) Prints an array of characters
void print(double d) Prints a double-precision floating-point number
void print(float f) Prints a floating-point number
void print(int i) Prints an integer
void print(long l) Prints a long integer
void print(Object obj) Prints an object
void print(String s) Prints a string
PrintWriter printf(String format Object args) A convenience method to write a formatted string to this writer using the specified format string and arguments
void println() Terminates the current line by writing the line separator string
void println(boolean x) Prints a boolean value and then terminates the line
void println(char x) Prints a character and then terminates the line
16
void println(char[] x) Prints an array of characters and then terminates the line
void println(double x) Prints a double-precision floating-point number and then terminates the line
void println(float x) Prints a floating-point number and then terminates the line
void println(int x) Prints an integer and then terminates the line
void println(long x) Prints a long integer and then terminates the line
void println(Object x) Prints an Object and then terminates the line
void println(String x) Prints a String and then terminates the line
protected void
setError() Indicates that an error has occurred
void write(char[] buf) Writes an array of characters
void write(char[] buf int off int len) Writes A Portion of an array of characters
void write(int c) Writes a single character
void write(String s) Writes a string
void write(String s int off int len) Writes a portion of a string
G13 File Class
Constructor SummaryFile(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname
File(URI uri) Creates a new File instance by converting the given file URI into an abstract pathname
Method Summaryboolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname
boolean canRead() Tests whether the application can read the file denoted by this abstract pathname
boolean canWrite() Tests whether the application can modify the file denoted by this abstract pathname
boolean createNewFile() Atomically creates a new empty file named by this abstract pathname if and only if a file with this name does not yet exist
static File
createTempFile(String prefix String suffix) Creates an empty file in the default temporary-file directory using the given prefix and suffix to generate its name
static File
createTempFile(String prefix String suffix File directory) Creates a new empty file in the specified directory using the given prefix and suffix strings to generate its name
boolean delete()
17
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
G12 PrintWriter Class
Constructor SummaryPrintWriter(File file) Creates a new PrintWriter without automatic line flushing with the specified file
Method SummaryPrintWriter append(char c)
Appends the specified character to this writer
PrintWriter append(CharSequence csq) Appends the specified character sequence to this writer
PrintWriter append(CharSequence csq int start int end) Appends a subsequence of the specified character sequence to this writer
boolean checkError() Flushes the stream if its not closed and checks its error state
protected void
clearError() Clears the error state of this stream
void close() Closes the stream and releases any system resources associated with it
void flush() Flushes the stream
PrintWriter format(String format Object args) Writes a formatted string to this writer using the specified format string and arguments
void print(boolean b) Prints a boolean value
void print(char c) Prints a character
void print(char[] s) Prints an array of characters
void print(double d) Prints a double-precision floating-point number
void print(float f) Prints a floating-point number
void print(int i) Prints an integer
void print(long l) Prints a long integer
void print(Object obj) Prints an object
void print(String s) Prints a string
PrintWriter printf(String format Object args) A convenience method to write a formatted string to this writer using the specified format string and arguments
void println() Terminates the current line by writing the line separator string
void println(boolean x) Prints a boolean value and then terminates the line
void println(char x) Prints a character and then terminates the line
16
void println(char[] x) Prints an array of characters and then terminates the line
void println(double x) Prints a double-precision floating-point number and then terminates the line
void println(float x) Prints a floating-point number and then terminates the line
void println(int x) Prints an integer and then terminates the line
void println(long x) Prints a long integer and then terminates the line
void println(Object x) Prints an Object and then terminates the line
void println(String x) Prints a String and then terminates the line
protected void
setError() Indicates that an error has occurred
void write(char[] buf) Writes an array of characters
void write(char[] buf int off int len) Writes A Portion of an array of characters
void write(int c) Writes a single character
void write(String s) Writes a string
void write(String s int off int len) Writes a portion of a string
G13 File Class
Constructor SummaryFile(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname
File(URI uri) Creates a new File instance by converting the given file URI into an abstract pathname
Method Summaryboolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname
boolean canRead() Tests whether the application can read the file denoted by this abstract pathname
boolean canWrite() Tests whether the application can modify the file denoted by this abstract pathname
boolean createNewFile() Atomically creates a new empty file named by this abstract pathname if and only if a file with this name does not yet exist
static File
createTempFile(String prefix String suffix) Creates an empty file in the default temporary-file directory using the given prefix and suffix to generate its name
static File
createTempFile(String prefix String suffix File directory) Creates a new empty file in the specified directory using the given prefix and suffix strings to generate its name
boolean delete()
17
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
void println(char[] x) Prints an array of characters and then terminates the line
void println(double x) Prints a double-precision floating-point number and then terminates the line
void println(float x) Prints a floating-point number and then terminates the line
void println(int x) Prints an integer and then terminates the line
void println(long x) Prints a long integer and then terminates the line
void println(Object x) Prints an Object and then terminates the line
void println(String x) Prints a String and then terminates the line
protected void
setError() Indicates that an error has occurred
void write(char[] buf) Writes an array of characters
void write(char[] buf int off int len) Writes A Portion of an array of characters
void write(int c) Writes a single character
void write(String s) Writes a string
void write(String s int off int len) Writes a portion of a string
G13 File Class
Constructor SummaryFile(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname
File(URI uri) Creates a new File instance by converting the given file URI into an abstract pathname
Method Summaryboolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname
boolean canRead() Tests whether the application can read the file denoted by this abstract pathname
boolean canWrite() Tests whether the application can modify the file denoted by this abstract pathname
boolean createNewFile() Atomically creates a new empty file named by this abstract pathname if and only if a file with this name does not yet exist
static File
createTempFile(String prefix String suffix) Creates an empty file in the default temporary-file directory using the given prefix and suffix to generate its name
static File
createTempFile(String prefix String suffix File directory) Creates a new empty file in the specified directory using the given prefix and suffix strings to generate its name
boolean delete()
17
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
Deletes the file or directory denoted by this abstract pathname
void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates
boolean equals(Object obj) Tests this abstract pathname for equality with the given object
boolean exists() Tests whether the file or directory denoted by this abstract pathname exists
File getAbsoluteFile() Returns the absolute form of this abstract pathname
String getAbsolutePath() Returns the absolute pathname string of this abstract pathname
File getCanonicalFile() Returns the canonical form of this abstract pathname
String getCanonicalPath() Returns the canonical pathname string of this abstract pathname
long getFreeSpace() Returns the number of unallocated bytes in the partition named by this abstract path name
String getName() Returns the name of the file or directory denoted by this abstract pathname
String getParent() Returns the pathname string of this abstract pathnames parent or null if this pathname does not name a parent directory
File getParentFile() Returns the abstract pathname of this abstract pathnames parent or null if this pathname does not name a parent directory
String getPath() Converts this abstract pathname into a pathname string
long getTotalSpace() Returns the size of the partition named by this abstract pathname
long getUsableSpace() Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname
boolean isDirectory() Tests whether the file denoted by this abstract pathname is a directory
boolean isFile() Tests whether the file denoted by this abstract pathname is a normal file
boolean isHidden() Tests whether the file named by this abstract pathname is a hidden file
long lastModified() Returns the time that the file denoted by this abstract pathname was last modified
long length() Returns the length of the file denoted by this abstract pathname
String[] list() Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname
String[] list(FilenameFilter filter) Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
File[] listFiles() Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname
File[] listFiles(FileFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract
18
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
pathname that satisfy the specified filter
File[] listFiles(FilenameFilter filter) Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter
static File[]
listRoots() List the available filesystem roots
boolean mkdir() Creates the directory named by this abstract pathname
boolean mkdirs() Creates the directory named by this abstract pathname including any necessary but nonexistent parent directories
boolean renameTo(File dest) Renames the file denoted by this abstract pathname
boolean setExecutable(boolean executable) A convenience method to set the owners execute permission for this abstract pathname
boolean setExecutable(boolean executable boolean ownerOnly) Sets the owners or everybodys execute permission for this abstract pathname
boolean setLastModified(long time) Sets the last-modified time of the file or directory named by this abstract pathname
boolean setReadable(boolean readable) A convenience method to set the owners read permission for this abstract pathname
boolean setReadable(boolean readable boolean ownerOnly) Sets the owners or everybodys read permission for this abstract pathname
boolean setReadOnly() Marks the file or directory named by this abstract pathname so that only read operations are allowed
boolean setWritable(boolean writable) A convenience method to set the owners write permission for this abstract pathname
boolean setWritable(boolean writable boolean ownerOnly) Sets the owners or everybodys write permission for this abstract pathname
String toString() Returns the pathname string of this abstract pathname
URI toURI() Constructs a file URI that represents this abstract pathname
Appendix H Java SWINGAWT Graphics Classes
H11 Layout Managers
H111 BorderLayout Class
Field Summarystatic String CENTER
The center layout constraint (middle of container)
static String EAST The east layout constraint (right side of container)
static String NORTH The north layout constraint (top of container)
static String SOUTH The south layout constraint (bottom of container)
static String WEST The west layout constraint (left side of container)
19
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
Constructor SummaryBorderLayout() Constructs a new border layout with no gaps between components
Method Summary
void addLayoutComponent(Component comp Object constraints) Adds the specified component to the layout using the specified constraint object
Component getLayoutComponent(Container target Object constraints) Returns the component that corresponds to the given constraint location based on the target Containers component orientation
Component getLayoutComponent(Object constraints) Gets the component that was added using the given constraint
void layoutContainer(Container target) Lays out the container argument using this border layout
Dimension maximumLayoutSize(Container target) Returns the maximum dimensions for this layout given the components in the specified target container
Dimension minimumLayoutSize(Container target) Determines the minimum size of the target container using this layout manager
Dimension preferredLayoutSize(Container target) Determines the preferred size of the target container using this layout manager based on the components in the container
void removeLayoutComponent(Component comp) Removes the specified component from this border layout
String toString() Returns a string representation of the state of this border layout
H112 GridLayout Class
Constructor SummaryGridLayout() Creates a grid layout with a default of one column per component in a single row
GridLayout(int rows int cols) Creates a grid layout with the specified number of rows and columns
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component with the specified name to the layout
int getColumns() Gets the number of columns in this layout
void layoutContainer(Container parent) Lays out the specified container using this layout
Dimension minimumLayoutSize(Container parent) Determines the minimum size of the container argument using this grid layout
Dimension preferredLayoutSize(Container parent) Determines the preferred size of the container argument using this grid layout
void removeLayoutComponent(Component comp) Removes the specified component from the layout
void setColumns(int cols) Sets the number of columns in this layout to the specified value
20
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
void setRows(int rows) Sets the number of rows in this layout to the specified value
String toString() Returns the string representation of this grid layouts values
H113 FlowLayout Class
Field Summarystatic int CENTER
This value indicates that each row of components should be centered
static int LEADING This value indicates that each row of components should be justified to the leading edge of the containers orientation for example to the left in left-to-right orientations
static int LEFT This value indicates that each row of components should be left-justified
static int RIGHT This value indicates that each row of components should be right-justified
static int TRAILING This value indicates that each row of components should be justified to the trailing edge of the containers orientation for example to the right in left-to-right orientations
Constructor SummaryFlowLayout() Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap
Method Summary
void addLayoutComponent(String name Component comp) Adds the specified component to the layout
void layoutContainer(Container target) Lays out the container
Dimension minimumLayoutSize(Container target) Returns the minimum dimensions needed to layout the visible components contained in the specified target container
Dimension preferredLayoutSize(Container target) Returns the preferred dimensions for this layout given the visible components in the specified target container
void removeLayoutComponent(Component comp) Removes the specified component from the layout
String toString() Returns a string representation of this FlowLayout object and its values
H12 Event Listeners
H121 ActionListener Interface
Method Summary void actionPerformed(ActionEvent e)
Invoked when an action occurs
21
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
H122 MouseListener Interface
Method Summaryvoid mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component
void mouseEntered(MouseEvent e) Invoked when the mouse enters a component
void mouseExited(MouseEvent e) Invoked when the mouse exits a component
void mousePressed(MouseEvent e) Invoked when a mouse button has been pressed on a component
void mouseReleased(MouseEvent e) Invoked when a mouse button has been released on a component
H123 MouseMotionListener Interface
Method Summary void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged
void mouseMoved(MouseEvent e) Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed
H13 Color Class
Constructor SummaryColor(float r float g float b) Creates an opaque sRGB color with the specified red green and blue values in the range (00 - 10)
Color(float r float g float b float a) Creates an sRGB color with the specified red green blue and alpha values in the range (00 - 10)
Color(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int rgba boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31 the red component in bits 16-23 the green component in bits 8-15 and the blue component in bits 0-7
Color(int r int g int b) Creates an opaque sRGB color with the specified red green and blue values in the range (0 - 255)
Color(int r int g int b int a) Creates an sRGB color with the specified red green blue and alpha values in the range (0 - 255)
Method Summary
Color brighter() Creates a new Color that is a brighter version of this Color
Color darker() Creates a new Color that is a darker version of this Color
static Color
decode(String nm) Converts a String to an integer and returns the specified opaque Color
boolean equals(Object obj) Determines whether another object is equal to this Color
int getAlpha() Returns the alpha component in the range 0-255
22
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
int getBlue() Returns the blue component in the range 0-255 in the default sRGB space
static Color
getColor(String nm) Finds a color in the system properties
static Color
getColor(String nm Color v) Finds a color in the system properties
static Color
getColor(String nm int v) Finds a color in the system properties
float[] getColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the ColorSpace of the Color
float[] getComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color in the ColorSpace of the Color
int getGreen() Returns the green component in the range 0-255 in the default sRGB space
static Color
getHSBColor(float h float s float b) Creates a Color object based on the specified values for the HSB color model
int getRed() Returns the red component in the range 0-255 in the default sRGB space
int getRGB() Returns the RGB value representing the color in the default sRGB ColorModel
float[] getRGBColorComponents(float[] compArray) Returns a float array containing only the color components of the Color in the default sRGB color space
float[] getRGBComponents(float[] compArray) Returns a float array containing the color and alpha components of the Color as represented in the default sRGB color space
int getTransparency() Returns the transparency mode for this Color
static int HSBtoRGB(float hue float saturation float brightness) Converts the components of a color as specified by the HSB model to an equivalent set of values for the default RGB model
static float[]
RGBtoHSB(int r int g int b float[] hsbvals) Converts the components of a color as specified by the default RGB model to an equivalent set of values for hue saturation and brightness that are the three components of the HSB model
String toString() Returns a string representation of this Color
H14 ImageIcon Class
Constructor SummaryImageIcon() Creates an uninitialized image icon
ImageIcon(byte[] imageData) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(byte[] imageData String description) Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF JPEG or (as of 13) PNG
ImageIcon(Image image) Creates an ImageIcon from an image object
ImageIcon(Image image String description)
23
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
Creates an ImageIcon from the image
ImageIcon(String filename) Creates an ImageIcon from the specified file
ImageIcon(String filename String description) Creates an ImageIcon from the specified file
ImageIcon(URL location) Creates an ImageIcon from the specified URL
ImageIcon(URL location String description) Creates an ImageIcon from the specified URL
Method Summary
String getDescription() Gets the description of the image
int getIconHeight() Gets the height of the icon
int getIconWidth() Gets the width of the icon
Image getImage() Returns this icons Image
int getImageLoadStatus() Returns the status of the image loading operation
ImageObserver getImageObserver() Returns the image observer for the image
protected void
loadImage(Image image) Loads the image returning only when the image is loaded
void paintIcon(Component c Graphics g int x int y) Paints the icon
void setDescription(String description) Sets the description of the image
void setImage(Image image) Sets the image displayed by this icon
void setImageObserver(ImageObserver observer) Sets the image observer for the image
String toString() Returns a string representation of this image
H15 Component Class
Method Summary void add(PopupMenu popup)
Adds the specified popup menu to the component
void addComponentListener(ComponentListener l) Adds the specified component listener to receive component events from this component
void addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus
void addInputMethodListener(InputMethodListener l) Adds the specified input method listener to receive input method events from this component
void addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component
void addMouseListener(MouseListener l)
24
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
Adds the specified mouse listener to receive mouse events from this component
void addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component
void addMouseWheelListener(MouseWheelListener l) Adds the specified mouse wheel listener to receive mouse wheel events from this component
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation orientation) Sets the ComponentOrientation property of this component and all components contained within it
int checkImage(Image image ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
int checkImage(Image image int width int height ImageObserver observer) Returns the status of the construction of a screen representation of the specified image
boolean contains(int x int y) Checks whether this component contains the specified point where x and y are defined to be relative to the coordinate system of this component
boolean contains(Point p) Checks whether this component contains the specified point where the points x and y coordinates are defined to be relative to the coordinate system of this component
Image createImage(ImageProducer producer) Creates an image from the specified image producer
Image createImage(int width int height) Creates an off-screen drawable image to be used for double buffering
protected void
disableEvents(long eventsToDisable) Disables the events defined by the specified event mask parameter from being delivered to this component
void dispatchEvent(AWTEvent e) Dispatches an event to this component or one of its sub components
void doLayout() Prompts the layout manager to lay out this component
protected void
enableEvents(long eventsToEnable) Enables the events defined by the specified event mask parameter to be delivered to this component
void enableInputMethods(boolean enable) Enables or disables input method support for this component
Color getBackground() Gets the background color of this component
Rectangle getBounds() Gets the bounds of this component in the form of a Rectangle object
Rectangle getBounds(Rectangle rv) Stores the bounds of this component into return value rv and return rv
Component getComponentAt(int x int y) Determines if this component or one of its immediate subcomponents contains the (x y) location and if so returns the containing component
Component getComponentAt(Point p) Returns the component or subcomponent that contains the specified point
ComponentListener[]
getComponentListeners() Returns an array of all the component listeners registered on this component
ComponentOrientation
getComponentOrientation() Retrieves the language-sensitive orientation that is to be used to order the elements or text within this
25
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
component
Cursor getCursor() Gets the cursor set in the component
FocusListener[]
getFocusListeners() Returns an array of all the focus listeners registered on this component
Font getFont() Gets the font of this component
FontMetrics getFontMetrics(Font font) Gets the font metrics for the specified font
Color getForeground() Gets the foreground color of this component
Graphics getGraphics() Creates a graphics context for this component
GraphicsConfiguration
getGraphicsConfiguration() Gets the GraphicsConfiguration associated with this Component
int getHeight() Returns the current height of this component
boolean getIgnoreRepaint()
InputMethodListener[]
getInputMethodListeners() Returns an array of all the input method listeners registered on this component
InputMethodRequests
getInputMethodRequests() Gets the input method request handler which supports requests from input methods for this component
KeyListener[]getKeyListeners() Returns an array of all the key listeners registered on this component
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Component
Point getLocation() Gets the location of this component in the form of a point specifying the components top-left corner
Point getLocation(Point rv) Stores the xy origin of this component into return value rv and return rv
Point getLocationOnScreen() Gets the location of this component in the form of a point specifying the components top-left corner in the screens coordinate space
Dimension getMaximumSize() Gets the maximum size of this component
Dimension getMinimumSize() Gets the mininimum size of this component
MouseListener[]
getMouseListeners() Returns an array of all the mouse listeners registered on this component
MouseMotionListener[]
getMouseMotionListeners() Returns an array of all the mouse motion listeners registered on this component
Point getMousePosition() Returns the position of the mouse pointer in this Components coordinate space if the Component is directly under the mouse pointer otherwise returns null
MouseWheelListener[]
getMouseWheelListeners() Returns an array of all the mouse wheel listeners registered on this component
String getName() Gets the name of the component
Container getParent() Gets the parent of this component
26
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
Dimension getPreferredSize() Gets the preferred size of this component
PropertyChangeListener[]
getPropertyChangeListeners() Returns an array of all the property change listeners registered on this component
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName) Returns an array of all the listeners which have been associated with the named property
Dimension getSize() Returns the size of this component in the form of a Dimension object
Dimension getSize(Dimension rv) Stores the widthheight of this component into return value rv and return rv
int getWidth() Returns the current width of this component
int getX() Returns the current x coordinate of the components origin
int getY() Returns the current y coordinate of the components origin
boolean hasFocus() Returns true if this Component is the focus owner
boolean imageUpdate(Image img int infoflags int x int y int w int h) Repaints the component when the image has changed
boolean isBackgroundSet() Returns whether the background color has been explicitly set for this Component
boolean isCursorSet() Returns whether the cursor has been explicitly set for this Component
boolean isDisplayable() Determines whether this component is displayable
boolean isDoubleBuffered() Returns true if this component is painted to an offscreen image (buffer) thats copied to the screen later
boolean isEnabled() Determines whether this component is enabled
boolean isFocusable() Returns whether this Component can be focused
boolean isFocusOwner() Returns true if this Component is the focus owner
boolean isFontSet() Returns whether the font has been explicitly set for this Component
boolean isForegroundSet() Returns whether the foreground color has been explicitly set for this Component
boolean isMaximumSizeSet() Returns true if the maximum size has been set to a non-null value otherwise returns false
boolean isMinimumSizeSet() Returns whether or not setMinimumSize has been invoked with a non-null value
boolean isOpaque() Returns true if this component is completely opaque returns false by default
boolean isPreferredSizeSet() Returns true if the preferred size has been set to a non-null value otherwise returns false
boolean isShowing() Determines whether this component is showing on screen
boolean isValid() Determines whether this component is valid
boolean isVisible()
27
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
Determines whether this component should be visible when its parent is visible
void list() Prints a listing of this component to the standard system output stream Systemout
void list(PrintStream out) Prints a listing of this component to the specified output stream
void list(PrintStream out int indent) Prints out a list starting at the specified indentation to the specified print stream
void list(PrintWriter out) Prints a listing to the specified print writer
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints this component
void paintAll(Graphics g) Paints this component and all of its subcomponents
boolean prepareImage(Image image ImageObserver observer) Prepares an image for rendering on this component
boolean prepareImage(Image image int width int height ImageObserver observer) Prepares an image for rendering on this component at the specified width and height
void print(Graphics g) Prints this component
void printAll(Graphics g) Prints this component and all of its subcomponents
protected void
processComponentEvent(ComponentEvent e) Processes component events occurring on this component by dispatching them to any registered ComponentListenerobjects
protected void
processEvent(AWTEvent e) Processes events occurring on this component
protected void
processFocusEvent(FocusEvent e) Processes focus events occurring on this component by dispatching them to any registered FocusListener objects
protected void
processInputMethodEvent(InputMethodEvent e) Processes input method events occurring on this component by dispatching them to any registered InputMethodListenerobjects
protected void
processKeyEvent(KeyEvent e) Processes key events occurring on this component by dispatching them to any registered KeyListener objects
protected void
processMouseEvent(MouseEvent e) Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects
protected void
processMouseMotionEvent(MouseEvent e) Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListenerobjects
protected void
processMouseWheelEvent(MouseWheelEvent e) Processes mouse wheel events occurring on this component by dispatching them to any registered MouseWheelListenerobjects
void remove(MenuComponent popup) Removes the specified popup menu from the component
void removeComponentListener(ComponentListener l) Removes the specified component listener so that it no longer receives component events from this component
void removeFocusListener(FocusListener l)
28
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
Removes the specified focus listener so that it no longer receives focus events from this component
void removeInputMethodListener(InputMethodListener l) Removes the specified input method listener so that it no longer receives input method events from this component
void removeKeyListener(KeyListener l) Removes the specified key listener so that it no longer receives key events from this component
void removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component
void removeMouseMotionListener(MouseMotionListener l) Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component
void removeMouseWheelListener(MouseWheelListener l) Removes the specified mouse wheel listener so that it no longer receives mouse wheel events from this component
void removePropertyChangeListener(PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list
void removePropertyChangeListener(String propertyName PropertyChangeListener listener) Removes a PropertyChangeListener from the listener list for a specific property
void repaint() Repaints this component
void repaint(int x int y int width int height) Repaints the specified rectangle of this component
void repaint(long tm) Repaints the component
void repaint(long tm int x int y int width int height) Repaints the specified rectangle of this component within tm milliseconds
void requestFocus() Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
protected boolean
requestFocus(boolean temporary) Requests that this Component get the input focus and that this Components top-level ancestor become the focused Window
boolean requestFocusInWindow() Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
protected boolean
requestFocusInWindow(boolean temporary) Requests that this Component get the input focus if this Components top-level ancestor is already the focused Window
void setBackground(Color c) Sets the background color of this component
void setBounds(int x int y int width int height) Moves and resizes this component
void setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r
void setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component
void setCursor(Cursor cursor) Sets the cursor image to the specified cursor
void setEnabled(boolean b) Enables or disables this component depending on the value of the parameter b
29
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
void setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value
void setFocusTraversalKeys(int id Setlt extends AWTKeyStrokegt keystrokes) Sets the focus traversal keys for a given traversal operation for this Component
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) Sets whether focus traversal keys are enabled for this Component
void setFont(Font f) Sets the font of this component
void setForeground(Color c) Sets the foreground color of this component
void setIgnoreRepaint(boolean ignoreRepaint) Sets whether or not paint messages received from the operating system should be ignored
void setLocation(int x int y) Moves this component to a new location
void setLocation(Point p) Moves this component to a new location
void setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value
void setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value
void setName(String name) Sets the name of the component to the specified string
void setPreferredSize(Dimension preferredSize) Sets the preferred size of this component to a constant value
void setSize(Dimension d) Resizes this component so that it has width dwidth and height dheight
void setSize(int width int height) Resizes this component so that it has width width and height height
void setVisible(boolean b) Shows or hides this component depending on the value of parameter b
String toString() Returns a string representation of this component and its values
void transferFocus() Transfers the focus to the next component as though this Component were the focus owner
void transferFocusBackward() Transfers the focus to the previous component as though this Component were the focus owner
void transferFocusUpCycle() Transfers the focus up one focus traversal cycle
void update(Graphics g) Updates this component
void validate() Ensures that this component has a valid layout
H16 Container Class
Method SummaryComponent add(Component comp)
Appends the specified component to the end of this container
Component add(Component comp int index) Adds the specified component to this container at the given position
void add(Component comp Object constraints)
30
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
Adds the specified component to the end of this container
void add(Component comp Object constraints int index) Adds the specified component to this container with the specified constraints at the specified index
Component add(String name Component comp) Adds the specified component to this container
void addContainerListener(ContainerListener l) Adds the specified container listener to receive container events from this container
protected void
addImpl(Component comp Object constraints int index) Adds the specified component to this container at the specified index
void addNotify() Makes this Container displayable by connecting it to a native screen resource
void addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list
void addPropertyChangeListener(String propertyName PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property
void applyComponentOrientation(ComponentOrientation o) Sets the ComponentOrientation property of this container and all components contained within it
boolean areFocusTraversalKeysSet(int id) Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container
void doLayout() Causes this container to lay out its components
Component findComponentAt(int x int y) Locates the visible child component that contains the specified position
Component findComponentAt(Point p) Locates the visible child component that contains the specified point
Component getComponent(int n) Gets the nth component in this container
Component getComponentAt(int x int y) Locates the component that contains the xy position
Component getComponentAt(Point p) Gets the component that contains the specified point
int getComponentCount() Gets the number of components in this panel
Component[] getComponents() Gets all the components in this container
ContainerListener[]
getContainerListeners() Returns an array of all the container listeners registered on this container
Insets getInsets() Determines the insets of this container which indicate the size of the containers border
LayoutManagergetLayout() Gets the layout manager for this container
EventListenergt T[]
getListeners(ClassltTgt listenerType) Returns an array of all the objects currently registered as FooListeners upon this Container
Dimension getMaximumSize() Returns the maximum size of this container
Dimension getMinimumSize() Returns the minimum size of this container
Point getMousePosition(boolean allowChildren) Returns the position of the mouse pointer in this Containers coordinate space if the Container is
31
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
under the mouse pointer otherwise returns null
Dimension getPreferredSize() Returns the preferred size of this container
void invalidate() Invalidates the container
boolean isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of this container
void list(PrintStream out int indent) Prints a listing of this container to the specified output stream
void list(PrintWriter out int indent) Prints out a list starting at the specified indentation to the specified print writer
void paint(Graphics g) Paints the container
void paintComponents(Graphics g) Paints each of the components in this container
void print(Graphics g) Prints the container
void printComponents(Graphics g) Prints each of the components in this container
protected void
processContainerEvent(ContainerEvent e) Processes container events occurring on this container by dispatching them to any registered ContainerListener objects
protected void
processEvent(AWTEvent e) Processes events on this container
void remove(Component comp) Removes the specified component from this container
void remove(int index) Removes the component specified by index from this container
void removeAll() Removes all the components from this container
void removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives container events from this container
void setFont(Font f) Sets the font of this container
void setLayout(LayoutManager mgr) Sets the layout manager for this container
void update(Graphics g) Updates the container
Appendix I Proccessing Graphics Framework
I11 PApplet Class (abridged)
Field Summary
intheight( begin auto-generated from heightxml ) System variable which stores the height of the display window
charkey( begin auto-generated from keyxml ) The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released)
32
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
intkeyCode( begin auto-generated from keyCodexml ) The variable keyCode is used to detect special keys such as the UP DOWN LEFT RIGHT arrow keys and ALT CONTROL SHIFT
booleankeyPressed( begin auto-generated from keyPressed_varxml ) The boolean system variable keyPressed istrue if any key is pressed and false if no keys are pressed
intmouseButton( begin auto-generated from mouseButtonxml ) Processing automatically tracks if the mouse button is pressed and which button is pressed
booleanmousePressed( begin auto-generated from mousePressed_varxml ) Variable storing if a mouse button is pressed
intmouseX( begin auto-generated from mouseXxml ) The system variable mouseX always contains the current horizontal coordinate of the mouse
intmouseY( begin auto-generated from mouseYxml ) The system variable mouseY always contains the current vertical coordinate of the mouse
booleanpausedtrue if the animation thread is paused
int[]pixels( begin auto-generated from pixelsxml ) Array containing the values for all the pixels in the display window
intwidth( begin auto-generated from widthxml ) System variable which stores the width of the display window
Method Summary
voidarc(float a float b float c float d float start float stop)( begin auto-generated from arcxml ) Draws an arc in the display window
voidarc(float a float b float c float d float start float stop int mode)
void background(float gray) void background(float v1 float v2 float v3)
voidbackground(int rgb)( begin auto-generated from backgroundxml ) The background() function sets the color used for the background of the Processing window
voidbackground(PImage image)Takes an RGB or ARGB image and sets it as the background
voidbeginShape()Start a new shape of type POLYGON
void clear()
PFont
createFont(String name float size boolean smooth char[] charset)( begin auto-generated from createFontxml ) Dynamically converts a font to the format used by Processing from either a font name thats installed on the computer or from a ttf or otf file inside the sketches data folder
PImage createImage(int w int h int format)
33
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
( begin auto-generated from createImagexml ) Creates a new PImage (the datatype for storing images)
static float
degrees(float radians)( begin auto-generated from degreesxml ) Converts a radian measurement to its corresponding value in degrees
voiddelay(int napTime)The delay() function causes the program to halt for a specified time
voiddraw()( begin auto-generated from drawxml ) Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called
voidellipse(float a float b float c float d)( begin auto-generated from ellipsexml ) Draws an ellipse (oval) in the display window
void fill(float gray) void fill(float v1 float v2 float v3)
voidfill(int rgb)( begin auto-generated from fillxml ) Sets the color used to fill shapes
PImageget()Returns a copy of this PImage
intget(int x int y)( begin auto-generated from PImage_getxml ) Reads the color of any pixel or grabs a section of an image
PImage get(int x int y int w int h)
voidimage(PImage img float a float b)( begin auto-generated from imagexml ) Displays images to the screen
void image(PImage img float a float b float c float d)
voidimage(PImage img float a float b float c float d int u1 int v1 int u2 int v2)Draw an image() also specifying uv coordinates
voidkeyPressed()( begin auto-generated from keyPressedxml ) The keyPressed() function is called once every time a key is pressed
void
keyPressed(KeyEvent e)Overriding keyXxxxx(KeyEvent e) functions will cause the key keyCode and keyEvent variables to no longer work key events will no longer be queued until the end of draw() and the keyPressed() keyReleased() and keyTyped() methods will no longer be called
voidkeyReleased()( begin auto-generated from keyReleasedxml ) The keyReleased() function is called once every time a key is released
voidline(float x1 float y1 float x2 float y2)( begin auto-generated from linexml ) Draws a line (a direct path between two points) to the screen
void line(float x1 float y1 float z1 float x2 float y2 float z2)
PImageloadImage(String filename)( begin auto-generated from loadImagexml ) Loads an image into a variable of type PImage
void loadPixels()( begin auto-generated from loadPixelsxml ) Loads the pixel data for the display window into thepixels[] array
int millis()
34
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
( begin auto-generated from millisxml ) Returns the number of milliseconds (thousandths of a second) since starting an applet
voidmouseClicked()( begin auto-generated from mouseClickedxml ) The mouseClicked() function is called once after a mouse button has been pressed and then released
void mouseClicked(MouseEvent event)
voidmouseDragged()( begin auto-generated from mouseDraggedxml ) The mouseDragged() function is called once every time the mouse moves and a mouse button is pressed
void mouseDragged(MouseEvent event) void mouseEntered() void mouseEntered(MouseEvent event) void mouseExited() void mouseExited(MouseEvent event)
voidmouseMoved()( begin auto-generated from mouseMovedxml ) The mouseMoved() function is called every time the mouse moves and a mouse button is not pressed
void mouseMoved(MouseEvent event)
voidmousePressed()( begin auto-generated from mousePressedxml ) The mousePressed() function is called once after every time a mouse button is pressed
voidmousePressed(MouseEvent e)If you override this or any function that takes a MouseEvent e without calling its supermouseXxxx() then mouseX mouseY mousePressed and mouseEvent will no longer be set
voidmouseReleased()( begin auto-generated from mouseReleasedxml ) The mouseReleased() function is called every time a mouse button is released
void mouseReleased(MouseEvent event) void mouseWheel()
voidmouseWheel(MouseEvent event)The eventgetAmount() method returns negative values if the mouse wheel if rotated up or away from the user and positive in the other direction
voidnoCursor()( begin auto-generated from noCursorxml ) Hides the cursor from view
voidnoFill()( begin auto-generated from noFillxml ) Disables filling geometry
voidnoLoop()( begin auto-generated from noLoopxml ) Stops Processing from continuously executing the code within draw()
voidnoStroke()( begin auto-generated from noStrokexml ) Disables drawing the stroke (outline)
voidpause()Sketch has been paused
void point(float x float y)( begin auto-generated from pointxml ) Draws a point a coordinate in space at the dimension of one pixel
void point(float x float y float z) void popMatrix()
35
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
( begin auto-generated from popMatrixxml ) Pops the current transformation matrix off the matrix stack
voidpushMatrix()( begin auto-generated from pushMatrixxml ) Pushes the current transformation matrix onto the matrix stack
static float
radians(float degrees)( begin auto-generated from radiansxml ) Converts a degree measurement to its corresponding value in radians
voidrect(float a float b float c float d)( begin auto-generated from rectxml ) Draws a rectangle to the screen
void rect(float a float b float c float d float r)
voidrect(float a float b float c float d float tl float tr float br float bl)
voidresetMatrix()( begin auto-generated from resetMatrixxml ) Replaces the current matrix with the identity matrix
voidresume()Sketch has resumed
voidrotate(float angle)( begin auto-generated from rotatexml ) Rotates a shape the amount specified by the angleparameter
voidrotate(float angle float x float y float z)Advanced
voidrotateX(float angle)( begin auto-generated from rotateXxml ) Rotates a shape around the x-axis the amount specified by the angle parameter
voidrotateY(float angle)( begin auto-generated from rotateYxml ) Rotates a shape around the y-axis the amount specified by the angle parameter
voidrotateZ(float angle)( begin auto-generated from rotateZxml ) Rotates a shape around the z-axis the amount specified by the angle parameter
voidscale(float s)( begin auto-generated from scalexml ) Increases or decreases the size of a shape by expanding and contracting vertices
voidscale(float x float y)Advanced
void scale(float x float y float z) static int
second()( begin auto-generated from secondxml ) Processing communicates with the clock on your computer
voidsetMatrix(PMatrix source)Set the current transformation matrix to the contents of another
voidsetup()( begin auto-generated from setupxml ) The setup() function is called once when the program starts
void shape(PShape shape) void shape(PShape shape float x float y)
( begin auto-generated from shapexml ) Displays shapes to the screenvoid shape(PShape shape float a float b float c float d) void size(int w int h)
36
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
( begin auto-generated from sizexml ) Defines the dimension of the display window in units of pixels
voidsmooth()( begin auto-generated from smoothxml ) Draws all geometry with smooth (anti-aliased) edges
void smooth(int level)
voidsphere(float r)( begin auto-generated from spherexml ) A sphere is a hollow ball made from tessellated triangles
void stroke(float gray) void stroke(float v1 float v2 float v3)
voidstroke(int rgb)( begin auto-generated from strokexml ) Sets the color used to draw lines and borders around shapes
voidtext(char c float x float y)( begin auto-generated from textxml ) Draws text to the screen
voidtextFont(PFont which)( begin auto-generated from textFontxml ) Sets the current font that will be drawn with the text()function
voidtranslate(float x float y)( begin auto-generated from translatexml ) Specifies an amount to displace objects within the display window
voidtriangle(float x1 float y1 float x2 float y2 float x3 float y3)( begin auto-generated from trianglexml ) A triangle is a plane created by connecting three points
Appendix J ArrayList (javautilArrayList) Library
Constructor SummaryArrayList() Constructs an empty list with an initial capacity of ten
ArrayList(Collectionlt extends Egt c) Constructs a list containing the elements of the specified collection in the order they are returned by the collections iterator
ArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity
Method Summary boolean add(E e)
Appends the specified element to the end of this list
void add(int index E element) Inserts the specified element at the specified position in this list
boolean addAll(Collectionlt extends Egt c) Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collections Iterator
boolean addAll(int index Collectionlt extends Egt c) Inserts all of the elements in the specified collection into this list starting at the specified position
void clear() Removes all of the elements from this list
Object clone() Returns a shallow copy of this ArrayList instance
boolean contains(Object o) Returns true if this list contains the specified element
37
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
void ensureCapacity(int minCapacity) Increases the capacity of this ArrayList instance if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument
E get(int index) Returns the element at the specified position in this list
int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list or -1 if this list does not contain the element
boolean isEmpty() Returns true if this list contains no elements
int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list or -1 if this list does not contain the element
E remove(int index) Removes the element at the specified position in this list
boolean remove(Object o) Removes the first occurrence of the specified element from this list if it is present
protected void
removeRange(int fromIndex int toIndex) Removes from this list all of the elements whose index is between fromIndex inclusive and toIndex exclusive
E set(int index E element) Replaces the element at the specified position in this list with the specified element
int size() Returns the number of elements in this list
Object[] toArray() Returns an array containing all of the elements in this list in proper sequence (from first to last element)
ltTgt T[] toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element) the runtime type of the returned array is that of the specified array
void trimToSize() Trims the capacity of this ArrayList instance to be the lists current size
Appendix K URL Class
Constructor SummaryURL(String spec) Creates a URL object from the String representation
URL(String protocol String host int port String file) Creates a URL object from the specified protocol host port number and file
URL(String protocol String host int port String file URLStreamHandler handler) Creates a URL object from the specified protocol host port number file and handler
URL(String protocol String host String file) Creates a URL from the specified protocol name host name and file name
URL(URL context String spec) Creates a URL by parsing the given spec within a specified context
URL(URL context String spec URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context
38
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
Method Summary boolean equals(Object obj)
Compares this URL for equality with another object
String getAuthority() Gets the authority part of this URL
Object getContent() Gets the contents of this URL
Object getContent(Class[] classes) Gets the contents of this URL
int getDefaultPort() Gets the default port number of the protocol associated with this URL
String getFile() Gets the file name of this URL
String getHost() Gets the host name of this URL if applicable
String getPath() Gets the path part of this URL
int getPort() Gets the port number of this URL
String getProtocol() Gets the protocol name of this URL
String getQuery() Gets the query part of this URL
String getRef() Gets the anchor (also known as the reference) of this URL
String getUserInfo() Gets the userInfo part of this URL
int hashCode() Creates an integer suitable for hash table indexing
URLConnection openConnection() Returns a URLConnection object that represents a connection to the remote object referred to by the URL
URLConnection openConnection(Proxy proxy) Same as openConnection() except that the connection will be made through the specified proxy Protocol handlers that do not support proxing will ignore the proxy parameter and make a normal connection
InputStream openStream() Opens a connection to this URL and returns an InputStream for reading from that connection
boolean sameFile(URL other) Compares two URLs excluding the fragment component
39
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-
protected void
set(String protocol String host int port String file String ref) Sets the fields of the URL
protected void
set(String protocol String host int port String authority String userInfo String path String queryString ref) Sets the specified 8 fields of the URL
static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an applications URLStreamHandlerFactory
String toExternalForm() Constructs a string representation of this URL
String toString() Constructs a string representation of this URL
URI toURI() Returns a URI equivalent to this URL
40
- Java Abridged Documentation
- Appendix A System (javalangSystem) Library
- Appendix B Math (javalangMath) Library
- Appendix C Array (javautilArrays) Library
- Appendix D Primitive Wrappers
-
- D11 Integer Class Methods
- D12 Double Class Methods
-
- Appendix E String Class Methods
- Appendix F Random Class Methods
- Appendix G InputOutput Classes
-
- G11 Scanner Class
- G12 PrintWriter Class
- G13 File Class
-
- Appendix H Java SWINGAWT Graphics Classes
-
- H11 Layout Managers
-
- H111 BorderLayout Class
- H112 GridLayout Class
- H113 FlowLayout Class
-
- H12 Event Listeners
-
- H121 ActionListener Interface
- H122 MouseListener Interface
- H123 MouseMotionListener Interface
-
- H13 Color Class
- H14 ImageIcon Class
- H15 Component Class
- H16 Container Class
-
- Appendix I Proccessing Graphics Framework
-
- I11 PApplet Class (abridged)
-
- Appendix J ArrayList (javautilArrayList) Library
- Appendix K URL Class
-