|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Expo
public class Expo
EXPO CLASS VERSION 07/16/2008
The concept and implementation of the original set of Expo class methods was
created by John L. M. Schram (the Son), who is called John Schram.
The Expo class was created to teach programming skills to students in introductory
computer science courses. Use of the Expo class eliminates many program steps that
are tedious and frustrating for beginning students. Program input is simplified and
graphics commands are more intuitive. Many additional graphics commands are added to
allow for interesting displays with minimal effort.
Since the creation of the initial bulk of the Expo class, John L. A. Schram (the father),
who is called Leon Schram, has added some additional methods.
Both John Schram and Leon Schram are computer science teachers at John Paul II High School
in Plano, Texas.
The Expo class is a work in progress and you can expect the Schrams to add additional
methods in time to come. The version date will indicate if you have the latest update.
25 constant colors are built into the Expo class and are listed below.
red, green, blue, orange, cyan, magenta, yellow, gray, lightGray, darkGray,
pink, black, white, brown, purple, violet, lightRed, darkRed, lightGreen,
darkGreen, lightBlue, darkBlue, gold, tan, and turquoise.
This code is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation.
This code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Constructor Summary | |
---|---|
Expo()
|
Method Summary | |
---|---|
static void |
center(java.lang.String str)
Displays centered text on an 80 column text screen. |
static double |
cube(double number)
Returns the "cube" of number, which is number raised to the 3rd power. Example: System.out.println(Expo.cube(2)); This will display 8.0 |
static double |
cubeRoot(double number)
Returns the cubeRoot (3rd root) of number. |
static void |
delay(int n)
Pauses the output for a specified number of milliseconds (1/1000ths of a second). |
static void |
displayGUI(boolean temp)
Displays a boolean (true or false) value in a GUI window; The window will stay on the screen until the user clicks "OK". |
static void |
displayGUI(char temp)
Displays a char in a GUI window; The window will stay on the screen until the user clicks "OK". |
static void |
displayGUI(double temp)
Displays a double (real number) in a GUI window; The window will stay on the screen until the user clicks "OK". |
static void |
displayGUI(int temp)
Displays an int (integer) in a GUI window; The window will stay on the screen until the user clicks "OK". |
static void |
displayGUI(java.lang.String text)
Displays a String in a GUI window; The window will stay on the screen until the user clicks "OK". |
static void |
drawArc(java.awt.Graphics g,
int centerX,
int centerY,
int xRadius,
int yRadius,
int start,
int finish)
Draws and arc which looks like a curve. |
static void |
drawBurst(java.awt.Graphics g,
int centerX,
int centerY,
int radius,
int numLines)
Draws a certain number of lines (numLines) in a burst like pattern. |
static void |
drawCircle(java.awt.Graphics g,
int centerX,
int centerY,
int radius)
Draws an open circle. |
static void |
drawGrid(java.awt.Graphics g,
int w,
int h,
int s)
Draws a Cartesian grid with X-axis and Y-axis. |
static void |
drawLine(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2)
Draws the line segment connecting coordinates x1,y2 and x2,y2. |
static void |
drawOval(java.awt.Graphics g,
int centerX,
int centerY,
int hRadius,
int vRadius)
Draws an open oval. |
static void |
drawPixel(java.awt.Graphics g,
int x,
int y)
Draws a single pixel at the specified x,y location. |
static void |
drawPoint(java.awt.Graphics g,
int x,
int y)
Draws a 3 pixel X 3 pixel "point" whose center is at the specified x,y location. |
static void |
drawQuad(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
int x4,
int y4)
Draws an open irregular quadrilateral using the four sets of provided coordinates. |
static void |
drawRandomBurst(java.awt.Graphics g,
int centerX,
int centerY,
int radius,
int numLines)
Draws a certain number of random lines in a burst like pattern. |
static void |
drawRectangle(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2)
Draws an open rectangle. |
static void |
drawRegularPolygon(java.awt.Graphics g,
int centerX,
int centerY,
int radius,
int sides)
Draws a regular polygon with a specified number of sides. |
static void |
drawRoundedRectangle(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2,
int radius)
Draws an open rectangle with rounded corners. |
static void |
drawSpiral(java.awt.Graphics g,
int centerX,
int centerY,
int radius)
Draws a spiral. |
static void |
drawStar(java.awt.Graphics g,
int centerX,
int centerY,
int radius,
int points)
Draws a star with a specified number of points. |
static void |
drawThickArc(java.awt.Graphics g,
int centerX,
int centerY,
int xRadius,
int yRadius,
int start,
int finish,
int thickness)
Draws a "thick" arc which will look like a thick curve. |
static void |
drawThickBurst(java.awt.Graphics g,
int centerX,
int centerY,
int radius,
int numLines,
int thickness)
Draws a certain number of "thick" lines in a burst like pattern. |
static void |
drawThickCircle(java.awt.Graphics g,
int centerX,
int centerY,
int radius,
int thickness)
Draws a "thick" circle; The user specifies the x,y coordinate of the center of the circle as well as the radius value; The thickness is specified in the last parameter. |
static void |
drawThickLine(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2,
int thickness)
Draws a "thick" line segment connecting coordinates x1,y2 and x2,y2. |
static void |
drawThickOval(java.awt.Graphics g,
int centerX,
int centerY,
int hRadius,
int vRadius,
int thickness)
Draws a "thick" oval. |
static void |
drawThickRandomBurst(java.awt.Graphics g,
int centerX,
int centerY,
int radius,
int numLines,
int thickness)
Draws a certain number of random "thick" lines in a burst like pattern. |
static void |
drawThickRectangle(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2,
int thickness)
Draws a "thick" open rectangle. |
static void |
drawThickRegularPolygon(java.awt.Graphics g,
int centerX,
int centerY,
int radius,
int sides,
int thickness)
Draws a "thick" regular polygon with a specified number of sides. |
static void |
drawThickRoundedRectangle(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2,
int radius,
int thickness)
Draws an "thick" open rectangle with rounded corners. |
static void |
drawThickSpiral(java.awt.Graphics g,
int centerX,
int centerY,
int radius,
int thickness)
Draws a "thick" spiral. |
static void |
drawThickStar(java.awt.Graphics g,
int centerX,
int centerY,
int radius,
int points,
int thickness)
Draws a "thick" star with a specified number of points. |
static void |
drawTriangle(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2,
int x3,
int y3)
Draws an open irregular triangle using the three sets of provided coordinates. |
static boolean |
enterBoolean()
Allows input of a boolean (true or false) from the keyboard in a text window. |
static boolean |
enterBooleanGUI(java.lang.String prompt)
Allows input of a boolean (true or false) from the keyboard using a GUI window. |
static char |
enterChar()
Allows input of a char from the keyboard in a text window. |
static char |
enterCharGUI(java.lang.String prompt)
Allows input of a char from the keyboard using a GUI window. |
static double |
enterDouble()
Allows input of a double (real number) from the keyboard in a text window. |
static double |
enterDoubleGUI(java.lang.String prompt)
Allows input of a double (real number) from the keyboard using a GUI window. |
static int |
enterInt()
Allows input of an int (integer) from the keyboard in a text window. |
static int |
enterIntGUI(java.lang.String prompt)
Allows GUI input of an int (integer) from the keyboard. |
static java.lang.String |
enterString()
Allows input of a String from the keyboard in a text window. |
static java.lang.String |
enterStringGUI(java.lang.String prompt)
Allows input of a String from the keyboard using a GUI window. |
static void |
fillArc(java.awt.Graphics g,
int centerX,
int centerY,
int xRadius,
int yRadius,
int start,
int finish)
Draws a "solid" arc which will look either like a pie wedge or Pac-man. |
static void |
fillCircle(java.awt.Graphics g,
int centerX,
int centerY,
int radius)
Draws a solid "filled in" circle. |
static void |
fillOval(java.awt.Graphics g,
int centerX,
int centerY,
int hRadius,
int vRadius)
Draws a solid "filled in" oval. |
static void |
fillQuad(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
int x4,
int y4)
Draws an solid "filled-in" irregular quadrilateral using the four sets of provided coordinates. |
static void |
fillRectangle(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2)
Draws a solid "filled in" rectangle. |
static void |
fillRegularPolygon(java.awt.Graphics g,
int centerX,
int centerY,
int radius,
int sides)
Draws a solid "filled in" polygon with a specified number of sides. |
static void |
fillRoundedRectangle(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2,
int radius)
Draws a solid "filled in" rectangle with rounded corners. |
static void |
fillStar(java.awt.Graphics g,
int centerX,
int centerY,
int radius,
int points)
Draws a solid "filled in" star with a specified number of points. |
static void |
fillTriangle(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2,
int x3,
int y3)
Draws an solid "filled-in" irregular triangle using the three sets of provided coordinates. |
static java.awt.Color |
getRandomColor()
Returns a random Color object which can be any of the 16,000,000+ possible colors. |
static void |
graphLine(java.awt.Graphics g,
double mathX1,
double mathY1,
double mathX2,
double mathY2)
Draws a line across the Cartesian grid. |
static void |
graphPoint(java.awt.Graphics g,
double mathX,
double mathY)
Plots a point on the Cartesian grid. |
static void |
graphQuadratic(java.awt.Graphics g,
double a,
double b,
double c)
Draws a parabala on the Cartesian grid. |
static void |
pause()
Pauses the output and waits for the user to press the [enter] key. |
static int |
random(int min,
int max)
Returns a "true" random integer in the [min..max] range, inclusive. |
static void |
rightJustify(java.lang.String str)
Displays right-justified text on an 80 column text screen. |
static double |
root(double number,
double x)
Returns the xth root of number. |
static int |
seedRandom(int min,
int max)
Returns a "seeded" random integer in the [min..max] range, inclusive. |
static void |
setBackground(java.awt.Graphics g,
java.awt.Color bgColor)
Sets the entire background to a single color. |
static void |
setColor(java.awt.Graphics g,
java.awt.Color bgColor)
Allows the user to change the color, using a Color object. |
static void |
setColor(java.awt.Graphics g,
int colorNum)
Allows the user to change to one of 15 predefined colors using a single integer. |
static void |
setColor(java.awt.Graphics g,
int red,
int green,
int blue)
Allows the user to change the color, using 3 int values representing the amount of red, green and blue. |
static void |
setRandomColor(java.awt.Graphics g)
Sets the current color to a random color value which can be any of the 16,000,000+ possible colors. |
static void |
skip(int n)
Utility method that will skip a certain number of blank lines on a text output screen. |
static java.lang.String |
spaces(int n)
Returns a certain number of spaces. |
static double |
square(double number)
Returns the "square" number, which is the number multiplied times itself. Example: System.out.println(Expo.square(5)); This will display 25.0 |
static void |
startSeed(double s)
Provides the initial value of the "seeded" random integers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Expo()
Method Detail |
---|
public static double square(double number)
public static double cube(double number)
public static double cubeRoot(double number)
public static double root(double number, double x)
public static int random(int min, int max)
public static void startSeed(double s)
public static int seedRandom(int min, int max)
public static void drawGrid(java.awt.Graphics g, int w, int h, int s)
public static void graphPoint(java.awt.Graphics g, double mathX, double mathY)
public static void graphLine(java.awt.Graphics g, double mathX1, double mathY1, double mathX2, double mathY2)
public static void graphQuadratic(java.awt.Graphics g, double a, double b, double c)
public static void skip(int n)
public static void center(java.lang.String str)
public static void rightJustify(java.lang.String str)
public static java.lang.String spaces(int n)
public static void pause()
public static void delay(int n)
public static int enterInt()
public static double enterDouble()
public static java.lang.String enterString()
public static char enterChar()
public static boolean enterBoolean()
public static int enterIntGUI(java.lang.String prompt)
public static double enterDoubleGUI(java.lang.String prompt)
public static java.lang.String enterStringGUI(java.lang.String prompt)
public static char enterCharGUI(java.lang.String prompt)
public static boolean enterBooleanGUI(java.lang.String prompt)
public static void displayGUI(java.lang.String text)
public static void displayGUI(int temp)
public static void displayGUI(double temp)
public static void displayGUI(char temp)
public static void displayGUI(boolean temp)
public static void setColor(java.awt.Graphics g, java.awt.Color bgColor)
public static void setColor(java.awt.Graphics g, int colorNum)
public static void setColor(java.awt.Graphics g, int red, int green, int blue)
public static java.awt.Color getRandomColor()
public static void setRandomColor(java.awt.Graphics g)
public static void setBackground(java.awt.Graphics g, java.awt.Color bgColor)
public static void drawPixel(java.awt.Graphics g, int x, int y)
public static void drawPoint(java.awt.Graphics g, int x, int y)
public static void drawLine(java.awt.Graphics g, int x1, int y1, int x2, int y2)
public static void drawCircle(java.awt.Graphics g, int centerX, int centerY, int radius)
public static void drawOval(java.awt.Graphics g, int centerX, int centerY, int hRadius, int vRadius)
public static void drawArc(java.awt.Graphics g, int centerX, int centerY, int xRadius, int yRadius, int start, int finish)
public static void drawTriangle(java.awt.Graphics g, int x1, int y1, int x2, int y2, int x3, int y3)
public static void drawQuad(java.awt.Graphics g, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
public static void drawRectangle(java.awt.Graphics g, int x1, int y1, int x2, int y2)
public static void drawRoundedRectangle(java.awt.Graphics g, int x1, int y1, int x2, int y2, int radius)
public static void drawSpiral(java.awt.Graphics g, int centerX, int centerY, int radius)
public static void drawBurst(java.awt.Graphics g, int centerX, int centerY, int radius, int numLines)
public static void drawRandomBurst(java.awt.Graphics g, int centerX, int centerY, int radius, int numLines)
public static void drawRegularPolygon(java.awt.Graphics g, int centerX, int centerY, int radius, int sides)
public static void drawStar(java.awt.Graphics g, int centerX, int centerY, int radius, int points)
public static void drawThickLine(java.awt.Graphics g, int x1, int y1, int x2, int y2, int thickness)
public static void drawThickCircle(java.awt.Graphics g, int centerX, int centerY, int radius, int thickness)
public static void drawThickOval(java.awt.Graphics g, int centerX, int centerY, int hRadius, int vRadius, int thickness)
public static void drawThickArc(java.awt.Graphics g, int centerX, int centerY, int xRadius, int yRadius, int start, int finish, int thickness)
public static void drawThickRectangle(java.awt.Graphics g, int x1, int y1, int x2, int y2, int thickness)
public static void drawThickRoundedRectangle(java.awt.Graphics g, int x1, int y1, int x2, int y2, int radius, int thickness)
public static void drawThickSpiral(java.awt.Graphics g, int centerX, int centerY, int radius, int thickness)
public static void drawThickBurst(java.awt.Graphics g, int centerX, int centerY, int radius, int numLines, int thickness)
public static void drawThickRandomBurst(java.awt.Graphics g, int centerX, int centerY, int radius, int numLines, int thickness)
public static void drawThickRegularPolygon(java.awt.Graphics g, int centerX, int centerY, int radius, int sides, int thickness)
public static void drawThickStar(java.awt.Graphics g, int centerX, int centerY, int radius, int points, int thickness)
public static void fillCircle(java.awt.Graphics g, int centerX, int centerY, int radius)
public static void fillOval(java.awt.Graphics g, int centerX, int centerY, int hRadius, int vRadius)
public static void fillArc(java.awt.Graphics g, int centerX, int centerY, int xRadius, int yRadius, int start, int finish)
public static void fillTriangle(java.awt.Graphics g, int x1, int y1, int x2, int y2, int x3, int y3)
public static void fillQuad(java.awt.Graphics g, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
public static void fillRectangle(java.awt.Graphics g, int x1, int y1, int x2, int y2)
public static void fillRoundedRectangle(java.awt.Graphics g, int x1, int y1, int x2, int y2, int radius)
public static void fillRegularPolygon(java.awt.Graphics g, int centerX, int centerY, int radius, int sides)
public static void fillStar(java.awt.Graphics g, int centerX, int centerY, int radius, int points)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |