import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class MandelbrotUI extends Applet implements ActionListener, MouseListener, MouseMotionListener, ItemListener, WindowListener {
private Button ivjButtonGenerate = null;
private Label ivjLabelIterations = null;
private Label ivjLabelIterationsValue = null;
private Label ivjLabelXMax = null;
private Label ivjLabelXMin = null;
private Label ivjLabelYMax = null;
private Label ivjLabelYMin = null;
private Panel ivjPanelBody = null;
private Panel ivjPanelMenu = null;
private TextField ivjTextFieldXMax = null;
private TextField ivjTextFieldXMin = null;
private TextField ivjTextFieldYMax = null;
private TextField ivjTextFieldYMin = null;
private Button ivjButtonHelp = null;
private Choice ivjChoiceColorScheme = null;
private Choice ivjChoiceSampleRegions = null;
private Label ivjLabelColorScheme = null;
private Label ivjLabelSampleRegions = null;
private static final int maxSize = 4;
private int colorScheme;
private int maxCol;
private int maxRow;
private int maxIterations = 512;
private double P;
private double Q[];
private double XMax = 1.2d;
private double XMin = -2.0d;
private double YMax = 1.2d;
private double YMin = -1.2d;
private double[] arrXMin = { -2.0d, -0.702973d, -0.691594d, -0.691060d, -0.793114d, -0.749337d, -0.745465d, -0.745464d };
private double[] arrXMax = { 1.2d, -0.642879d, -0.690089d, -0.690906d, -0.723005d, -0.744948d, -0.745387d, -0.745388d };
private double[] arrYMin = { -1.2d, 0.374785d, 0.386608d, 0.387103d, 0.037822d, 0.109349d, 0.112896d, 0.112967d };
private double[] arrYMax = { 1.2d, 0.395415d, 0.387494d, 0.387228d, 0.140974d, 0.115851d, 0.113034d, 0.113030d };
private double deltaP;
private double deltaQ;
public final static String colors[] = { "FFFFFF", "0066CC", "0099CC", "66CCCC", "3333CC", "99CCFF", "00CCCC", "6699FF", "336699" };
public final static String colors2[] =
{
"006600",
"009900",
"00CC00",
"0099CF",
"000000",
"000066",
"000099",
"006600",
"CC0000",
"999900",
"99CC33",
"990033",
"A1DFF8",
"FF9900",
"669933",
"DDDEEE",
"ADF3FF",
"DFFFEE",
"FFFFFF",
"FFFF00",
"AD00FF",
"AFFF00",
"660066",
"CCFF99" };
public final static String colors3[] = { "000000", "000066", "000099", "006600" };
public final static String colors4[] = { "000000", "FFFFFF" };
public final static String colors5[] = { "FF9900", "FFCC00", "FF6600" };
private Graphics myGraphics;
private Image image;
public void buttonGenerate_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
Graphics g = getPanelBody().getGraphics();
colorScheme = getChoiceColorScheme().getSelectedIndex();
g.clearRect(0, 0, maxCol, maxRow);
XMin = Double.parseDouble(getTextFieldXMin().getText());
XMax = Double.parseDouble(getTextFieldXMax().getText());
YMin = Double.parseDouble(getTextFieldYMin().getText());
YMax = Double.parseDouble(getTextFieldYMax().getText());
generateImage(g);
}
public void buttonHelp_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
helpOn(getPanelBody().getGraphics());
}
private void connEtoC1(java.awt.event.ActionEvent arg1) {
try {
this.buttonGenerate_ActionPerformed(arg1);
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
private void connEtoC2(java.awt.event.ActionEvent arg1) {
try {
this.buttonHelp_ActionPerformed(arg1);
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
public void destroy() {
super.destroy();
}
private void generateImage(Graphics g) {
double X = 0.0d;
double Y = 0.0d;
double Xsquare = 0.0d;
double Ysquare = 0.0d;
int color = 0;
int maxColor = maxIterations;
resetPQ();
for (int col = 0; col < maxCol; col++) {
for (int row = 0; row < maxRow; row++) {
X = 0.0d;
Y = 0.0d;
Xsquare = 0.0d;
Ysquare = 0.0d;
color = 0;
while ((color < maxIterations) && ((Xsquare + Ysquare) < maxSize)) {
Xsquare = X * X;
Ysquare = Y * Y;
Y *= X;
Y += Y + Q[row];
X = Xsquare - Ysquare + P;
color++;
}
if (0 == colorScheme) {
g.setColor(new java.awt.Color(Integer.parseInt(colors[color % colors.length], 16)));
} else if (1 == colorScheme) {
g.setColor(new java.awt.Color(Integer.parseInt(colors3[color % colors3.length], 16)));
} else if (2 == colorScheme) {
g.setColor(new java.awt.Color(Integer.parseInt(colors2[color % colors2.length], 16)));
} else if (3 == colorScheme) {
g.setColor(new java.awt.Color(Integer.parseInt(colors4[color % colors4.length], 16)));
} else if (4 == colorScheme) {
g.setColor(new java.awt.Color(Integer.parseInt(colors5[color % colors5.length], 16)));
}
g.fillOval(col, row, 1, 1);
}
P += deltaP;
}
}
public String getAppletInfo() {
return "MandelbrotUI\n" + "\n" + "Generates Mandelbrot sets.\n" + "Creation date: (09/10/2002 3:17:08 PM)\n" + "@author: Jose Sandoval\n" + "";
}
private java.awt.Button getButtonGenerate() {
if (ivjButtonGenerate == null) {
try {
ivjButtonGenerate = new java.awt.Button();
ivjButtonGenerate.setName("ButtonGenerate");
ivjButtonGenerate.setLabel("Generate");
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjButtonGenerate;
}
private java.awt.Button getButtonHelp() {
if (ivjButtonHelp == null) {
try {
ivjButtonHelp = new java.awt.Button();
ivjButtonHelp.setName("ButtonHelp");
ivjButtonHelp.setLabel("Help");
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjButtonHelp;
}
private java.awt.Choice getChoiceColorScheme() {
if (ivjChoiceColorScheme == null) {
try {
ivjChoiceColorScheme = new java.awt.Choice();
ivjChoiceColorScheme.setName("ChoiceColorScheme");
ivjChoiceColorScheme.setFont(new java.awt.Font("dialog", 0, 10));
ivjChoiceColorScheme.add("Original");
ivjChoiceColorScheme.add("16 colors");
ivjChoiceColorScheme.add("24 Colors");
ivjChoiceColorScheme.add("Black and White");
ivjChoiceColorScheme.add("Orange Hue");
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjChoiceColorScheme;
}
private java.awt.Choice getChoiceSampleRegions() {
if (ivjChoiceSampleRegions == null) {
try {
ivjChoiceSampleRegions = new java.awt.Choice();
ivjChoiceSampleRegions.setName("ChoiceSampleRegions");
ivjChoiceSampleRegions.setFont(new java.awt.Font("dialog", 0, 10));
ivjChoiceSampleRegions.add("Default");
ivjChoiceSampleRegions.add("Zoom 1");
ivjChoiceSampleRegions.add("Zoom 2");
ivjChoiceSampleRegions.add("Zoom 3");
ivjChoiceSampleRegions.add("Zoom 4");
ivjChoiceSampleRegions.add("Zoom 5");
ivjChoiceSampleRegions.add("Zoom 6");
ivjChoiceSampleRegions.add("Zoom 7");
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjChoiceSampleRegions;
}
private java.awt.Label getLabelColorScheme() {
if (ivjLabelColorScheme == null) {
try {
ivjLabelColorScheme = new java.awt.Label();
ivjLabelColorScheme.setName("LabelColorScheme");
ivjLabelColorScheme.setAlignment(java.awt.Label.RIGHT);
ivjLabelColorScheme.setFont(new java.awt.Font("dialog", 0, 10));
ivjLabelColorScheme.setText("Color Scheme:");
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjLabelColorScheme;
}
private java.awt.Label getLabelIterations() {
if (ivjLabelIterations == null) {
try {
ivjLabelIterations = new java.awt.Label();
ivjLabelIterations.setName("LabelIterations");
ivjLabelIterations.setFont(new java.awt.Font("dialog", 0, 10));
ivjLabelIterations.setText("No. of Iterations:");
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjLabelIterations;
}
private java.awt.Label getLabelIterationsValue() {
if (ivjLabelIterationsValue == null) {
try {
ivjLabelIterationsValue = new java.awt.Label();
ivjLabelIterationsValue.setName("LabelIterationsValue");
ivjLabelIterationsValue.setFont(new java.awt.Font("dialog", 0, 10));
ivjLabelIterationsValue.setText("512");
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjLabelIterationsValue;
}
private java.awt.Label getLabelSampleRegions() {
if (ivjLabelSampleRegions == null) {
try {
ivjLabelSampleRegions = new java.awt.Label();
ivjLabelSampleRegions.setName("LabelSampleRegions");
ivjLabelSampleRegions.setAlignment(java.awt.Label.RIGHT);
ivjLabelSampleRegions.setFont(new java.awt.Font("dialog", 0, 10));
ivjLabelSampleRegions.setText("Sample Regions:");
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjLabelSampleRegions;
}
private java.awt.Label getLabelXMax() {
if (ivjLabelXMax == null) {
try {
ivjLabelXMax = new java.awt.Label();
ivjLabelXMax.setName("LabelXMax");
ivjLabelXMax.setAlignment(java.awt.Label.RIGHT);
ivjLabelXMax.setFont(new java.awt.Font("dialog", 0, 10));
ivjLabelXMax.setText("X Max:");
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjLabelXMax;
}
private java.awt.Label getLabelXMin() {
if (ivjLabelXMin == null) {
try {
ivjLabelXMin = new java.awt.Label();
ivjLabelXMin.setName("LabelXMin");
ivjLabelXMin.setAlignment(java.awt.Label.RIGHT);
ivjLabelXMin.setFont(new java.awt.Font("dialog", 0, 10));
ivjLabelXMin.setText("X Min:");
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjLabelXMin;
}
private java.awt.Label getLabelYMax() {
if (ivjLabelYMax == null) {
try {
ivjLabelYMax = new java.awt.Label();
ivjLabelYMax.setName("LabelYMax");
ivjLabelYMax.setAlignment(java.awt.Label.RIGHT);
ivjLabelYMax.setFont(new java.awt.Font("dialog", 0, 10));
ivjLabelYMax.setText("Y Max:");
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjLabelYMax;
}
private java.awt.Label getLabelYMin() {
if (ivjLabelYMin == null) {
try {
ivjLabelYMin = new java.awt.Label();
ivjLabelYMin.setName("LabelYMin");
ivjLabelYMin.setAlignment(java.awt.Label.RIGHT);
ivjLabelYMin.setFont(new java.awt.Font("dialog", 0, 10));
ivjLabelYMin.setText("Y Min:");
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjLabelYMin;
}
private java.awt.Panel getPanelBody() {
if (ivjPanelBody == null) {
try {
ivjPanelBody = new java.awt.Panel();
ivjPanelBody.setName("PanelBody");
ivjPanelBody.setLayout(new java.awt.CardLayout());
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjPanelBody;
}
private java.awt.Panel getPanelMenu() {
if (ivjPanelMenu == null) {
try {
ivjPanelMenu = new java.awt.Panel();
ivjPanelMenu.setName("PanelMenu");
ivjPanelMenu.setLayout(new java.awt.GridBagLayout());
java.awt.GridBagConstraints constraintsTextFieldXMin = new java.awt.GridBagConstraints();
constraintsTextFieldXMin.gridx = 1;
constraintsTextFieldXMin.gridy = 1;
constraintsTextFieldXMin.fill = java.awt.GridBagConstraints.HORIZONTAL;
constraintsTextFieldXMin.anchor = java.awt.GridBagConstraints.WEST;
constraintsTextFieldXMin.weightx = 1.0;
constraintsTextFieldXMin.insets = new java.awt.Insets(4, 4, 4, 4);
getPanelMenu().add(getTextFieldXMin(), constraintsTextFieldXMin);
java.awt.GridBagConstraints constraintsTextFieldXMax = new java.awt.GridBagConstraints();
constraintsTextFieldXMax.gridx = 1;
constraintsTextFieldXMax.gridy = 2;
constraintsTextFieldXMax.fill = java.awt.GridBagConstraints.HORIZONTAL;
constraintsTextFieldXMax.anchor = java.awt.GridBagConstraints.WEST;
constraintsTextFieldXMax.weightx = 1.0;
constraintsTextFieldXMax.insets = new java.awt.Insets(4, 4, 4, 4);
getPanelMenu().add(getTextFieldXMax(), constraintsTextFieldXMax);
java.awt.GridBagConstraints constraintsTextFieldYMin = new java.awt.GridBagConstraints();
constraintsTextFieldYMin.gridx = 3;
constraintsTextFieldYMin.gridy = 1;
constraintsTextFieldYMin.fill = java.awt.GridBagConstraints.HORIZONTAL;
constraintsTextFieldYMin.anchor = java.awt.GridBagConstraints.WEST;
constraintsTextFieldYMin.weightx = 1.0;
constraintsTextFieldYMin.insets = new java.awt.Insets(4, 4, 4, 4);
getPanelMenu().add(getTextFieldYMin(), constraintsTextFieldYMin);
java.awt.GridBagConstraints constraintsTextFieldYMax = new java.awt.GridBagConstraints();
constraintsTextFieldYMax.gridx = 3;
constraintsTextFieldYMax.gridy = 2;
constraintsTextFieldYMax.fill = java.awt.GridBagConstraints.HORIZONTAL;
constraintsTextFieldYMax.anchor = java.awt.GridBagConstraints.WEST;
constraintsTextFieldYMax.weightx = 1.0;
constraintsTextFieldYMax.insets = new java.awt.Insets(4, 4, 4, 4);
getPanelMenu().add(getTextFieldYMax(), constraintsTextFieldYMax);
java.awt.GridBagConstraints constraintsLabelXMin = new java.awt.GridBagConstraints();
constraintsLabelXMin.gridx = 0;
constraintsLabelXMin.gridy = 1;
constraintsLabelXMin.anchor = java.awt.GridBagConstraints.EAST;
constraintsLabelXMin.insets = new java.awt.Insets(4, 4, 4, 4);
getPanelMenu().add(getLabelXMin(), constraintsLabelXMin);
java.awt.GridBagConstraints constraintsLabelXMax = new java.awt.GridBagConstraints();
constraintsLabelXMax.gridx = 0;
constraintsLabelXMax.gridy = 2;
constraintsLabelXMax.anchor = java.awt.GridBagConstraints.EAST;
constraintsLabelXMax.insets = new java.awt.Insets(4, 4, 4, 4);
getPanelMenu().add(getLabelXMax(), constraintsLabelXMax);
java.awt.GridBagConstraints constraintsLabelYMin = new java.awt.GridBagConstraints();
constraintsLabelYMin.gridx = 2;
constraintsLabelYMin.gridy = 1;
constraintsLabelYMin.anchor = java.awt.GridBagConstraints.EAST;
constraintsLabelYMin.insets = new java.awt.Insets(8, 4, 8, 4);
getPanelMenu().add(getLabelYMin(), constraintsLabelYMin);
java.awt.GridBagConstraints constraintsLabelYMax = new java.awt.GridBagConstraints();
constraintsLabelYMax.gridx = 2;
constraintsLabelYMax.gridy = 2;
constraintsLabelYMax.anchor = java.awt.GridBagConstraints.EAST;
constraintsLabelYMax.insets = new java.awt.Insets(8, 4, 8, 4);
getPanelMenu().add(getLabelYMax(), constraintsLabelYMax);
java.awt.GridBagConstraints constraintsLabelIterations = new java.awt.GridBagConstraints();
constraintsLabelIterations.gridx = 4;
constraintsLabelIterations.gridy = 0;
constraintsLabelIterations.insets = new java.awt.Insets(4, 4, 4, 4);
getPanelMenu().add(getLabelIterations(), constraintsLabelIterations);
java.awt.GridBagConstraints constraintsLabelIterationsValue = new java.awt.GridBagConstraints();
constraintsLabelIterationsValue.gridx = 5;
constraintsLabelIterationsValue.gridy = 0;
constraintsLabelIterationsValue.insets = new java.awt.Insets(4, 4, 4, 4);
getPanelMenu().add(getLabelIterationsValue(), constraintsLabelIterationsValue);
java.awt.GridBagConstraints constraintsButtonGenerate = new java.awt.GridBagConstraints();
constraintsButtonGenerate.gridx = 4;
constraintsButtonGenerate.gridy = 2;
constraintsButtonGenerate.gridwidth = 2;
constraintsButtonGenerate.fill = java.awt.GridBagConstraints.HORIZONTAL;
constraintsButtonGenerate.insets = new java.awt.Insets(4, 4, 4, 4);
getPanelMenu().add(getButtonGenerate(), constraintsButtonGenerate);
java.awt.GridBagConstraints constraintsChoiceColorScheme = new java.awt.GridBagConstraints();
constraintsChoiceColorScheme.gridx = 1;
constraintsChoiceColorScheme.gridy = 0;
constraintsChoiceColorScheme.fill = java.awt.GridBagConstraints.HORIZONTAL;
constraintsChoiceColorScheme.insets = new java.awt.Insets(4, 4, 4, 4);
getPanelMenu().add(getChoiceColorScheme(), constraintsChoiceColorScheme);
java.awt.GridBagConstraints constraintsLabelColorScheme = new java.awt.GridBagConstraints();
constraintsLabelColorScheme.gridx = 0;
constraintsLabelColorScheme.gridy = 0;
constraintsLabelColorScheme.insets = new java.awt.Insets(4, 4, 4, 4);
getPanelMenu().add(getLabelColorScheme(), constraintsLabelColorScheme);
java.awt.GridBagConstraints constraintsLabelSampleRegions = new java.awt.GridBagConstraints();
constraintsLabelSampleRegions.gridx = 2;
constraintsLabelSampleRegions.gridy = 0;
constraintsLabelSampleRegions.anchor = java.awt.GridBagConstraints.EAST;
constraintsLabelSampleRegions.insets = new java.awt.Insets(4, 4, 4, 4);
getPanelMenu().add(getLabelSampleRegions(), constraintsLabelSampleRegions);
java.awt.GridBagConstraints constraintsChoiceSampleRegions = new java.awt.GridBagConstraints();
constraintsChoiceSampleRegions.gridx = 3;
constraintsChoiceSampleRegions.gridy = 0;
constraintsChoiceSampleRegions.fill = java.awt.GridBagConstraints.HORIZONTAL;
constraintsChoiceSampleRegions.insets = new java.awt.Insets(4, 4, 4, 4);
getPanelMenu().add(getChoiceSampleRegions(), constraintsChoiceSampleRegions);
java.awt.GridBagConstraints constraintsButtonHelp = new java.awt.GridBagConstraints();
constraintsButtonHelp.gridx = 4;
constraintsButtonHelp.gridy = 1;
constraintsButtonHelp.gridwidth = 2;
constraintsButtonHelp.fill = java.awt.GridBagConstraints.HORIZONTAL;
constraintsButtonHelp.insets = new java.awt.Insets(4, 4, 4, 4);
getPanelMenu().add(getButtonHelp(), constraintsButtonHelp);
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjPanelMenu;
}
private java.awt.TextField getTextFieldXMax() {
if (ivjTextFieldXMax == null) {
try {
ivjTextFieldXMax = new java.awt.TextField();
ivjTextFieldXMax.setName("TextFieldXMax");
ivjTextFieldXMax.setFont(new java.awt.Font("dialog", 0, 10));
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjTextFieldXMax;
}
private java.awt.TextField getTextFieldXMin() {
if (ivjTextFieldXMin == null) {
try {
ivjTextFieldXMin = new java.awt.TextField();
ivjTextFieldXMin.setName("TextFieldXMin");
ivjTextFieldXMin.setFont(new java.awt.Font("dialog", 0, 10));
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjTextFieldXMin;
}
private java.awt.TextField getTextFieldYMax() {
if (ivjTextFieldYMax == null) {
try {
ivjTextFieldYMax = new java.awt.TextField();
ivjTextFieldYMax.setName("TextFieldYMax");
ivjTextFieldYMax.setFont(new java.awt.Font("dialog", 0, 10));
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjTextFieldYMax;
}
private java.awt.TextField getTextFieldYMin() {
if (ivjTextFieldYMin == null) {
try {
ivjTextFieldYMin = new java.awt.TextField();
ivjTextFieldYMin.setName("TextFieldYMin");
ivjTextFieldYMin.setFont(new java.awt.Font("dialog", 0, 10));
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjTextFieldYMin;
}
private void handleException(java.lang.Throwable exception) {
}
public void helpOn(Graphics g) {
int x = 40;
int y = 20;
g.clearRect(0, 0, maxCol, maxRow);
g.setColor(Color.gray);
g.drawRect(10, 10, 620, 460);
g.setColor(Color.black);
g.drawString("MandelbrotUI v1.0 - Jose Sandoval - (c) October 2002", x, 60);
g.drawString("The applet generates the Mandelbrot set.", x, 80);
g.setColor(Color.red);
g.drawString("Instructions:", x, y + 100);
g.setColor(Color.black);
g.drawString("Color Scheme - Holds values for predefined color schemes", x, y + 120);
g.drawString("Sample Regions - Holds values for predefined interesting (I think) regions of the set", x, y + 140);
g.drawString("Rectangle co-ordinates: (XMin, YMin), (XMax, YMax)", x, y + 160);
g.drawString("Help - Displays this help", x, y + 180);
g.drawString("Generate - Generates the Mandelbrot set with parameters entered", x, y + 200);
}
public void init() {
try {
super.init();
setName("MandelbrotUI");
setLayout(new java.awt.BorderLayout());
setSize(640, 600);
add(getPanelMenu(), "North");
add(getPanelBody(), "Center");
initConnections();
maxCol = 640;
maxRow = 480;
image = createImage(maxCol, maxRow);
myGraphics = image.getGraphics();
getLabelIterationsValue().setText("" + maxIterations);
getTextFieldXMin().setText("" + XMin);
getTextFieldXMax().setText("" + XMax);
getTextFieldYMin().setText("" + YMin);
getTextFieldYMax().setText("" + YMax);
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
private void initConnections() throws java.lang.Exception {
getChoiceSampleRegions().addItemListener(this);
getButtonGenerate().addActionListener(this);
getButtonHelp().addActionListener(this);
}
public void itemStateChanged(java.awt.event.ItemEvent e) {
int whichRegion = getChoiceSampleRegions().getSelectedIndex();
getTextFieldXMin().setText("" + arrXMin[whichRegion]);
getTextFieldXMax().setText("" + arrXMax[whichRegion]);
getTextFieldYMin().setText("" + arrYMin[whichRegion]);
getTextFieldYMax().setText("" + arrYMax[whichRegion]);
}
public static void main(java.lang.String[] args) {
MandelbrotUI applet = new MandelbrotUI();
java.awt.Frame frame = new java.awt.Frame("Applet");
frame.addWindowListener(applet);
frame.add("Center", applet);
frame.setSize(350, 250);
frame.show();
applet.init();
applet.start();
}
public void mouseClicked(MouseEvent e) {
System.out.println("mouseClicked");
}
public void mouseDragged(MouseEvent e) {
System.out.println("mouseDragged");
}
public void mouseEntered(MouseEvent e) {
System.out.println("mouseEntered");
}
public void mouseExited(MouseEvent e) {
System.out.println("mouseExited");
}
public void mouseMoved(MouseEvent e) {
System.out.println("mouseMoved");
}
public void mousePressed(MouseEvent e) {
System.out.println("mousePressed");
}
public void mouseReleased(MouseEvent e) {
System.out.println("mouseReleased");
}
public void paint(Graphics g) {
super.paint(g);
}
public void resetPQ() {
Q = new double[maxRow];
deltaP = (double) ((XMax - XMin) / maxCol);
deltaQ = (double) ((YMax - YMin) / maxRow);
P = XMin;
Q[0] = YMax;
for (int row = 1; row < maxRow; row++) {
Q[row] = Q[row - 1] - deltaQ;
}
}
public void windowActivated(WindowEvent e) {
}
public void windowClosed(WindowEvent e) {
}
public void windowClosing(WindowEvent e) {
System.exit(0);
}
public void windowDeactivated(WindowEvent e) {
}
public void windowDeiconified(WindowEvent e) {
}
public void windowIconified(WindowEvent e) {
}
public void windowOpened(WindowEvent e) {
}
public void actionPerformed(java.awt.event.ActionEvent e) {
if (e.getSource() == MandelbrotUI.this.getButtonGenerate())
connEtoC1(e);
if (e.getSource() == MandelbrotUI.this.getButtonHelp())
connEtoC2(e);
}
}