public class MandelbrotGUI
extends java.lang.Object
May 09, PH: added proportional zooming, removed double buffering, removed some interface options, added "Extra" text field, added constructor for variable image width, simplified layouts, cleaned up a lot.
Modifier and Type | Field and Description |
---|---|
static int |
MODE_BW
Black and White mode.
|
static int |
MODE_COLOR
Color mode.
|
static int |
QUIT
Quit command.
|
static int |
RENDER
Render command.
|
static int |
RESET
Reset command.
|
static int |
RESOLUTION_HIGH
High resolution.
|
static int |
RESOLUTION_LOW
Low resolution.
|
static int |
RESOLUTION_MEDIUM
Medium resolution.
|
static int |
RESOLUTION_VERY_HIGH
Very high resolution.
|
static int |
RESOLUTION_VERY_LOW
Very low resolution.
|
static int |
ZOOM
Zoom command.
|
Constructor and Description |
---|
MandelbrotGUI()
Creates a graphical user interface with the default width.
|
MandelbrotGUI(int width)
Creates a graphical user interface with the specified width.
|
Modifier and Type | Method and Description |
---|---|
void |
clearPlane()
Clears the image plane.
|
void |
disableInput()
Disables user input.
|
void |
enableInput()
Enables user input.
|
int |
getCommand()
Returns a command triggered by the user.
|
java.lang.String |
getExtraText()
Returns the string that the user has typed in the "Extra" field.
|
int |
getHeight()
Returns the image height.
|
double |
getMaximumImag()
Returns the maximum imaginary value.
|
double |
getMaximumReal()
Returns the maximum real value.
|
double |
getMinimumImag()
Returns the minimum imaginary value.
|
double |
getMinimumReal()
Returns the minimum real value.
|
int |
getMode()
Returns the image mode.
|
int |
getResolution()
Returns the image resolution.
|
int |
getWidth()
Returns the image width.
|
void |
putData(java.awt.Color[][] image,
int pixelWidth,
int pixelHeight)
Draws an image on the complex plane.
|
void |
resetPlane()
Resets the axis limits to their default values.
|
public static final int RENDER
This constant is returned by getCommand()
when the user
presses the RENDER button.
getCommand()
,
Constant Field Valuespublic static final int ZOOM
This constant is returned by getCommand()
when the user
zooms in the picture.
getCommand()
,
Constant Field Valuespublic static final int RESET
This constant is returned by getCommand()
when the user
presses the RESET button.
getCommand()
,
Constant Field Valuespublic static final int QUIT
This constant is returned by getCommand()
when the user
presses the QUIT button or chooses Quit in the File menu.
getCommand()
,
Constant Field Valuespublic static final int MODE_BW
This is the value returned by getMode()
when the user has
requested a black and white image.
public static final int MODE_COLOR
This is the value returned by getMode()
when the user has
requested a color image.
public static final int RESOLUTION_VERY_LOW
This is the value returned by getResolution()
when the user
has requested very low resolution of the image.
getResolution()
,
Constant Field Valuespublic static final int RESOLUTION_LOW
This is the value returned by getResolution()
when the user
has requested low resolution of the image.
getResolution()
,
Constant Field Valuespublic static final int RESOLUTION_MEDIUM
This is the value returned by getResolution()
when the user
has requested medium resolution of the image.
getResolution()
,
Constant Field Valuespublic static final int RESOLUTION_HIGH
This is the value returned by getResolution()
when the user
has requested high resolution of the image.
getResolution()
,
Constant Field Valuespublic static final int RESOLUTION_VERY_HIGH
This is the value returned by getResolution()
when the user
has requested very high resolution of the image.
getResolution()
,
Constant Field Valuespublic MandelbrotGUI()
public MandelbrotGUI(int width)
width
- The width in pixels.public void disableInput()
enableInput()
public void enableInput()
disableInput()
public double getMinimumReal()
getMaximumReal()
,
getMinimumImag()
,
getMaximumImag()
public double getMaximumReal()
getMinimumReal()
,
getMinimumImag()
,
getMaximumImag()
public double getMinimumImag()
getMinimumReal()
,
getMaximumReal()
,
getMinimumImag()
public double getMaximumImag()
getMinimumReal()
,
getMaximumReal()
,
getMinimumImag()
public int getMode()
The mode is chosen among the two alternatives MODE_BW
and
MODE_COLOR
, given as constants by the class.
MODE_BW
,
MODE_COLOR
public int getResolution()
The resolution is chosen among five alternatives given as constants in the class.
RESOLUTION_VERY_LOW
,
RESOLUTION_LOW
,
RESOLUTION_MEDIUM
,
RESOLUTION_HIGH
,
RESOLUTION_VERY_HIGH
public java.lang.String getExtraText()
public int getWidth()
getHeight()
public int getHeight()
getWidth()
public int getCommand()
The possible return values are defined as constants in the class.
public void clearPlane()
public void resetPlane()
public void putData(java.awt.Color[][] image, int pixelWidth, int pixelHeight)
An image represented as a matrix of colors is drawn on the complex plane
of the interface. Matrix element [0][0]
is drawn at image
position (0,0)
.
image
- A matrix of color objects, each of whose elements is
interpreted as a picture element of the image to draw.pixelWidth
- The width of a picture element.pixelHeight
- The height of a picture element.