Project SAIL:  Student Authored Interactive Lessons
Java code


Application.java
-------------------------------------------------------------------
/*
* Created on
Mar 22, 2005
*/

/**
* @author Andrew Owens
*/

import javax.swing.JFrame;
import java.awt.BorderLayout;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.util.*;
/**
* Application Creates and initializes each component of the system.
*/
public class Application extends JFrame {

public static void main( String[] args ) {
new Application( null );
}


public Application( SailApplet sailApplet ) {
applet = sailApplet;
//initApp();
initGUI();
initHQ();
isInitialized = true;

updateAll();
repaint();
}

private boolean isInitialized;

private JApplet applet;

private Container cp;

/////////////////////////////////////////////
// Mode Management
/////////////////////////////////////////////

public void initInstructionMode( ) {
exitCurrentMode();
mode = new InstructionMode( this, cp );
refreshMode();
}


public void initTestMode() {
exitCurrentMode();
mode = new TestMode( this );
refreshMode();
}


public void initExplorationMode() {
exitCurrentMode();
mode = new ExplorationMode( this, cp );
refreshMode();
}


public void initHQ() {
exitCurrentMode();
mode = new SelectionMode( this, cp );
refreshMode();
}


private void exitCurrentMode() {
cp.removeAll();

//cp.add( new JLabel("asdf"));

}


// fixes that repainting bug somehow...
private void refreshMode() {
if ( applet == null ) {
setVisible( true );
}
else {
}

}
/**
* Initialize the application's GUI/frame
*/
private Container initGUI() {
if ( applet != null ) {
cp = applet.getContentPane();
}
else {
setDefaultLookAndFeelDecorated( true );
setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
setTitle( APP_TITLE );
setSize( APP_WIDTH, APP_HEIGHT );
setResizable( IS_RESIZABLE );
cp = getContentPane();
}

if ( applet == null ) {
setVisible( true );
}

return cp;
}


/*
* private void onTimer() { updateAll(); }
*/

public void updateAll() {
if ( isInitialized ) {
mode.updateAll();
}
}


public class TestMode implements Mode {
public TestMode( Application app ) {
testPanel = new TestPanel( app );
cp.add( testPanel );
}


public void updateAll() {
}

TestPanel testPanel;
}

public class ExplorationMode implements Mode {
public ExplorationMode( Application app, Container cp ) {
add( new ExplorationScreen( app, cp ) );
}
public void updateAll() {

}
}
public class InstructionMode implements Mode, GraphCoordinator {
public InstructionMode( Application app, Container cp ) {
Point bottomLeft = new Point( -100, -100 );
Point upperRight = new Point( getWidth() + bottomLeft.getX() - 205, getHeight() );

configManager = new ConfigManager( this );
pointTable = new PointTable( this );
statManager = new StatManager( this, pointTable );
grapher = new Grapher( configManager, statManager, pointTable, bottomLeft, upperRight );
panelSeparator = new PanelSeparator( app, configManager, statManager, pointTable );

cp.add( panelSeparator, BorderLayout.EAST );
cp.add( grapher.getGraph() );
cp.addComponentListener( new ResizeListener() );

isInitialized = true;
}


public void updateAll() {
updateGraph();
}

public void updateGraph() {
if ( isInitialized ) {
grapher.updateGraph( true );
panelSeparator.updatePanels();
pointTable.updateState();
}
}

private boolean isInitialized;

private ConfigManager configManager;

private StatManager statManager;

private Grapher grapher;

private PanelSeparator panelSeparator;

private PointTable pointTable;

public class ResizeListener implements ComponentListener {
public void componentShown( ComponentEvent e ) {
updateAll();
}


public void componentMoved( ComponentEvent e ) {

}


public void componentResized( ComponentEvent e ) {
grapher.resizeGraph( new Point( getWidth() - PANEL_WIDTH, getHeight() ) );
}


public void componentHidden( ComponentEvent e ) {

}
}
}

public class SelectionMode implements Mode {
public SelectionMode( Application app, Container cp ) {
cp.add( new SelectionScreen( app, cp ) );
}


public void updateAll() {

}
}

// mode enumerations
private static final int MODE_INVALID_FIRST = 0;

private static final int MODE_EXPLORATION = 1;

private static final int MODE_TEST = 2;

private static final int MODE_HOMEWORK = 3;

private static final int MODE_INSTRUCTION = 4;

private static final int MODE_LAST = 4;

private Mode mode;

// are we selecting a mode?
private static final String APP_TITLE = "Linear Regression";

private static final int APP_WIDTH = 780;

private static final int APP_HEIGHT = 500;

private static final boolean IS_RESIZABLE = true;

private static final int TIMER_DELAY = 100;

private static final int PANEL_WIDTH = 250;

}


ColorSchemeManager.java
-------------------------------------------------------------------
/*
* Created on Apr 5, 2005
*/

/**
* @author Andrew Owens
*/


/**
* ColorSchemeManager
* Provides centralized, static access for
* color scheme
*/

import java.awt.Color;

public class ColorSchemeManager {
public static final Color REGRESSION_LINE = Color.BLUE;

public static final Color CUSTOM_REGRESSION = Color.RED;

public static final Color GHOST_REGRESSION_LINE = new Color( 0, 0, 200, 100 );

public static final Color AXIS = new Color( 50, 50, 50, 100 );

public static final Color GRID = new Color( 200, 200, 200, 100 );

public static final Color DEVATION = new Color( 0, 128, 0 );

public static final Color RESIDUAL = new Color( 0, 128, 0 );

public static final Color GRAPH_TEXT = new Color( 0, 0, 0 );
//public static final Color DEVATION_SQUARE =

//public static final Color RESIDUAL_SQUARE =



}


ConfigEditor.java
-------------------------------------------------------------------
/*
* Created on Mar 23, 2005
*/

/**
* @author Andrew Owens
*/

import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.JCheckBox;
import javax.swing.BoxLayout;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Iterator;

public class ConfigEditor extends Panel implements ItemListener {
public ConfigEditor( ConfigManager newConfigManager ) {
settingConversions = new HashMap();
configManager = newConfigManager;
checkBoxes = new ArrayList();

initGUI();
loadDefaultSettings();
}


public String getName() {
return PANEL_NAME;
}


private void initGUI() {
setLayout( new BoxLayout( this, BoxLayout.Y_AXIS ) );

// the user will probably never change these
/*
for ( int i = 0; i < STATPANEL_SETTINGS.length; i++ ) {
// get the text of the checkbox
String checkBoxText = STATPANEL_SETTINGS[ i ][ 0 ];

// get the text of the corresponding setting-key
String settingKey = STATPANEL_SETTINGS[ i ][ 1 ];

// make the CheckBox
JCheckBox checkBox = new JCheckBox( checkBoxText );

checkBox.addItemListener( this );

// add the checkBoxTest (as the key) and the settingKey (as the
// value)
// in a hash map so we can convert them later
settingConversions.put( checkBoxText, settingKey );

configManager.setSetting( settingKey, new Boolean( false ) );

checkBoxes.add( checkBox );

// add the checkbox to the panel
add( checkBox );
}

add( new JSeparator() );
*/
for ( int i = 0; i < GRAPHER_SETTINGS.length; i++ ) {
// get the text of the checkbox
String checkBoxText = GRAPHER_SETTINGS[ i ][ 0 ];

// get the text of the corresponding setting-key
String settingKey = GRAPHER_SETTINGS[ i ][ 1 ];

// make the CheckBox
JCheckBox checkBox = new JCheckBox( checkBoxText );

checkBox.addItemListener( this );

// add the checkBoxTest (as the key) and the settingKey (as the
// value)
// in a hash map so we can convert them later
settingConversions.put( checkBoxText, settingKey );

configManager.setSetting( settingKey, new Boolean( false ) );

checkBoxes.add( checkBox );

// add the checkbox to the panel
add( checkBox );
}
}


public void updateContents() {
// there haven't been any modifications in the ConfigManager, so we'll update its
// state to reflect its un-updated status
configManager.updateState();

}


public void itemStateChanged( ItemEvent e ) {
// get the item that was changed
JCheckBox checkBoxSrc = (JCheckBox) e.getItemSelectable();

// find the check box's text
String selectedText = checkBoxSrc.getText();

// using this text, find the setting that the box corresponds to
String keyConversion = (String) settingConversions.get( selectedText );

// checkboxes can only change boolean values so we'll
// change this setting in the ConfigManager to the value in
// the box
configManager.setSetting( keyConversion, new Boolean( checkBoxSrc.isSelected() ) );
}


private void loadDefaultSettings() {
for ( int i = 0; i < DEFAULT_CHECKED_SETTINGS.length; i++ ) {
String settingKey = DEFAULT_CHECKED_SETTINGS[ i ];
configManager.setSetting( settingKey, new Boolean( true ) );

// go through each check box, if it matches this
// one, then check it
Iterator checkBoxIt = checkBoxes.iterator();

while ( checkBoxIt.hasNext() ) {
JCheckBox checkBox = (JCheckBox) checkBoxIt.next();

// get the text of the box
// so that we can convert it to
// its corresponding setting
String checkBoxText = checkBox.getText();

// convert the check box text to
// its corresponding setting
String settingKeyCheckBox = (String)settingConversions.get( checkBoxText );

if ( settingKey.equals( settingKeyCheckBox ) ) {
checkBox.setSelected( true );
}
}
}
}

private ConfigManager configManager;

private HashMap settingConversions;
/*
private static final String[][] STATPANEL_SETTINGS = {
// StatPanel options
{ "
Show Equation", "ShowEquation" },
{ "
Show SSres", "ShowSSres" },
{ "
Show SSdev", "ShowSSdev" },
{ "
Show r", "ShowR" },
{ "
Show r2", "ShowRSquared" },
{ "
Show x and y", "ShowXYBars" }};
*/
// Graph options
private static final String[][] GRAPHER_SETTINGS = {
{ "
Plot ŷ", "PlotYHat" },
{ "
Plot Residuals", "PlotResiduals" },
{ "
Plot x and y", "PlotXYBars" },
{ "
Plot Deviation Lines", "PlotDevLines" },
{ "
Plot Squares of Residuals", "PlotResSquares" },
{ "
Plot Squares of Deviations", "PlotDevSquares" }};
// TODO:
// Load the defaults from a file or something instead of relying on this
// hackish way of setting them
private static final String[] DEFAULT_CHECKED_SETTINGS = {
"ShowEquation",
"ShowSSres",
"ShowSSdev",
"ShowR",
"ShowRSquared",
"ShowXYBars",
"PlotYHat",
"PlotXYBars"};


private ArrayList checkBoxes;

private boolean isUpdated;

private static final String PANEL_NAME = "Settings";
}


ConfigManager.java
-------------------------------------------------------------------
/*
* Created on Mar 24, 2005
*/

/**
* @author Andrew Owens
*/

import java.util.HashMap;

public class ConfigManager {
ConfigManager(GraphCoordinator newCoordinator ) {
settings = new HashMap();
coordinator = newCoordinator;
}
public Setting querySetting( String key ) {
if ( settings.containsKey( key ) ) {
return new Setting( settings.get( key ) );
}
else {
//return new Setting();
// @hack
return new Setting( new Boolean( false ) );
}
}


public void setSetting( String key, Object value ) {
settings.put( key, value );
makeUpdated();
}


public boolean isUpdated() {
return isUpdated;
}


public void updateState() {
isUpdated = false;
}


private void makeUpdated() {
isUpdated = true;
coordinator.updateGraph();
}


private HashMap settings;

private boolean isUpdated;

private GraphCoordinator coordinator;
}


EmbeddedGraph.java
-------------------------------------------------------------------
/*
* Created on Apr 14, 2005
*/

/*
* @author Andrew Owens
*/

import javax.swing.*;

public class EmbeddedGraph extends JPanel implements GraphCoordinator {
public EmbeddedGraph( Point newBottomLeft, Point newUpperRight, Point[] points, String[] settings ) {
pointTable = new PointTable( this );
statManager = new StatManager( this, pointTable );
configManager = new ConfigManager( this );
grapher = new Grapher( configManager, statManager, pointTable, newBottomLeft, newUpperRight );

for ( int i = 0; i < points.length; i++ ) {
pointTable.addPoint( points[ i ] );
}

Boolean boolTrue = new Boolean( true );
for ( int i = 0; i < settings.length; i++ ) {
configManager.setSetting( settings[ i ], boolTrue );
}

add( grapher.getGraph() );

isInitialized = true;
}


public void updateGraph() {
if ( isInitialized ) {
grapher.updateGraph( false );
}
}


//
public Graph getGraph() {
return grapher.getGraph();
}


private boolean isInitialized;

private Grapher grapher;

private Graph graph;

private PointTable pointTable;

private StatManager statManager;

private ConfigManager configManager;
}


ExplorationScreen.java
-------------------------------------------------------------------
/*
* Created on Apr 11, 2005
*/

/**
* @author Andrew Owens
*/

import java.awt.*;
import javax.swing.*;
import java.util.*;

public class ExplorationScreen extends JPanel {
public ExplorationScreen( Application app, Container cp ) {
contentPane = cp;
application = app;

initGUI();
}


private void initGUI() {
String[] settings = { "PlotSSres" };
Point[] points = { new Point(50, 50 ), new Point(20, 40 ) };

EmbeddedGraph embeddedGraph = new EmbeddedGraph( new Point(-10, -10), new Point(500, 500), points, settings );

add( embeddedGraph.getGraph() );
}

private void loadStep( ExplorationStep step ) {

}


private ArrayList steps;

private Container contentPane;

private Application application;
}


ExplorationStep.java
-------------------------------------------------------------------
/*
* Created on Apr 11, 2005
*/

/*
* @author Andrew Owens
*/

public class ExplorationStep {
public ExplorationStep( String newDescription, int newEditableRow, int newEditableCol, int newLastsShowCol ) {

}

private String description;

private int editableRow;

private int editableCol;

private int lastShowCol;


}


Graph.java
-------------------------------------------------------------------
/*
* Created on Mar 23, 2005
*/

/**
* @author Andrew Owens
*/

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.awt.Dimension;
import java.awt.Color;
import javax.swing.ImageIcon;
import javax.swing.JPanel;

public class Graph extends JPanel {

public Graph( Grapher newGrapher, Point newLowerLeft, Point newUpperRight ) {
lowerLeft = newLowerLeft;
upperRight = newUpperRight;
grapher = newGrapher;
initGUI();
loadImages();
firstPaint = true;
}


public void resizeGraph( Point newBottomLeft, Point newUpperRight ) {
lowerLeft = newBottomLeft;
upperRight = newUpperRight;
firstPaint = true;
}


public void paintComponent( Graphics g ) {
// TODO: I can only seem to create this backbuffer
// during the paint method and this seems
// to result in an occasional NullPointerException
// when it gets updated too fast

// if this is the first paint, then
// we need to create the back buffer
if ( !canDraw() ) {
setSize( (int) upperRight.getX(), (int) upperRight.getY() );
Dimension dim = getSize();
backBufferImage = (BufferedImage) createImage( (int) dim.getWidth(), (int) dim.getHeight() );
backBuffer = backBufferImage.getGraphics();
firstPaint = false;

// @hack
clear();
grapher.updateGraph();
}
g.drawImage( backBufferImage, 0, 0, null, null );

}


/*
* public void paint( Graphics g ) { /* // TODO: I can only seem to create
* this backbuffer // during the paint method and this seems // to result in
* an occasional NullPointerException // when it gets updated too fast
* // if this is the first paint, then // we need to create the back buffer
* if ( !canDraw() ) { setSize( (int)upperRight.getX(),
* (int)upperRight.getY() ); Dimension dim = getSize(); backBufferImage =
* (BufferedImage) createImage( (int) dim.getWidth(), (int) dim.getHeight() );
* backBuffer = backBufferImage.getGraphics(); clear(); firstPaint = false; } //
* if it isn't the first painting, then copy the // back buffer to the
* screen //else {
* // g.drawImage( backBufferImage, 0, 0, this ); //} g.drawImage(
* backBufferImage, 0, 0, 100, 100, 100, 100, 100, 100, null );
*
* paintComponent( g ); statDisplay.paintComponents( g ); }
*/

public void initGUI() {
addMouseListener( grapher.getMouseHandler() );
addMouseMotionListener( grapher.getMouseHandler() );
}


/**
* Clear the graph
*/
public void clear() {
if ( canDraw() ) {
setClearColor();
backBuffer.setColor( Color.WHITE );
// TODO: fix this to be
backBuffer.fillRect( 0, 0, getWidth(), getHeight() ); //(int)upperRight.getX(),
// (int)upperRight.getY()
// );
}
}


public void drawMessage( Point point, String message ) {
Point realCoords = toGraphCoords( point );
if ( canDraw() ) {
setColor( ColorSchemeManager.GRAPH_TEXT );
backBuffer.drawString( message, (int)realCoords.getX(), (int)realCoords.getY() );
}
}
/**
* Draws a line segment on the graph, converting its coordinates
*
* @param segment
* The line segment to render
*/
public void drawLineSegment( LineSegment segment, int lineWidth, Color color ) {
if ( canDraw() ) {
setColor( color );
Point start = new Point( segment.getP1() );
Point end = new Point( segment.getP2() );

start = toGraphCoords( start );
end = toGraphCoords( end );

if ( lineWidth == 1 ) {
backBuffer.drawLine( (int) start.getX(), (int) start.getY(), (int) end.getX(), (int) end.getY() );
}
else {
for ( int lineOffset = (int) ( -lineWidth * 0.5 ); lineOffset <= (int) ( lineWidth * 0.5 ); lineOffset++ ) {
backBuffer.drawLine( (int) start.getX() + lineOffset, (int) start.getY(), (int) end.getX()
+ lineOffset, (int) end.getY() );
}
}
}
}


public void drawLineSegment( LineSegment segment ) {
drawLineSegment( segment, 1, DEFAULT_LINESEGMENT_COLOR );
}


public void drawRect( Rectangle rect, Color color ) {
if ( canDraw() ) {
setColor( color );

Point coords = toGraphCoords( new Point( rect.getX(), rect.getY() ) );
Point dims = new Point( rect.getWidth(), rect.getHeight() );

backBuffer.fillRect( (int) coords.getX(), (int) coords.getY(), (int) dims.getX(), (int) dims.getY() );
}
}


/**
* Draws a point on the graph; converts the point's dimensions
*
* @param point
* The point to be rendered TODO: render an image of a point
* rather than a single pixel
*/
public void drawPoint( Point point, double scale ) {
if ( canDraw() ) {
setPointColor();
Point transformedPoint = toGraphCoords( point );

backBuffer.drawImage( pointImg.getImage(), (int) ( transformedPoint.getX() - POINT_RADIUS * scale ),
(int) ( transformedPoint.getY() - POINT_RADIUS * scale ),
(int) ( pointImg.getIconWidth() * scale ), (int) ( pointImg.getIconHeight() * scale ), null, null );
}
}


public void drawPoint( Point point ) {
drawPoint( point, 1 );
}


/**
* Converts the given point from its position on the plane to the
* corresponding location on the graph
*
* @param point
* The point to be converted
* @return The converted point
*/
public Point toGraphCoords( Point point ) {
double x = point.getX();
double y = point.getY();

// since (0, 0) refers to the upper-left corner
// we subtract the point's y from the graph's height
y = upperRight.getY() - y;

y = y + lowerLeft.getY();
x = x - lowerLeft.getX();

// find the scale factors by getting the coordinates' ratios
final double scaleX = ( upperRight.getX() - lowerLeft.getX() ) / upperRight.getX();
final double scaleY = ( upperRight.getY() - lowerLeft.getY() ) / upperRight.getY();

// mulitply both coordinates by the scale factors
//x = x * scaleX;
//y = y * scaleY;

return new Point( x, y );
}


/**
* Converts a point from swing's coordinate system to the corresponding
* point on a 2D plane
*
* @param point
* The point to be converted
* @return The converted point
*/
public Point toPlaneCoords( Point point ) {
double x = point.getX();
double y = point.getY();

y = upperRight.getY() - y + lowerLeft.getY();
;

x = x + lowerLeft.getX();

//y = -y;

final double scaleX = ( upperRight.getX() - lowerLeft.getX() ) / upperRight.getX();
final double scaleY = ( upperRight.getY() - lowerLeft.getY() ) / upperRight.getY();

// x = x / scaleX;
// y = y / scaleY;

return new Point( x, y );
}


public Point getBottomLeft() {
return lowerLeft;
}


public Point getTopRight() {
return upperRight;
}


public void addStatDisplay( JPanel panel ) {
statDisplay = panel;
}


private void loadImages() {
//pointImg = new ImageIcon( POINT_IMAGE_PATH );
pointImg = JavaPic_pointpng.getImageIcon();
}


private boolean canDraw() {
return !firstPaint;
}


// TODO: replace this with an image drawing routine
private void setPointColor() {
backBuffer.setColor( Color.RED );
}


private void setClearColor() {
backBuffer.setColor( Color.WHITE );
}


private void setLineSegmentColor() {
backBuffer.setColor( Color.BLUE );
}


private void setColor( Color color ) {
backBuffer.setColor( color );
}

private JPanel statDisplay;

private ImageIcon pointImg;

private Grapher grapher;

private boolean firstPaint;

private Graphics backBuffer;

private BufferedImage backBufferImage;

private Graphics graphics;

private Point lowerLeft;

private Point upperRight;

private static final Color DEFAULT_LINESEGMENT_COLOR = Color.BLUE;

//private static final String POINT_IMAGE_PATH = "Point.jpg";

private static final int POINT_RADIUS = 4;
}


GraphBars.java
-------------------------------------------------------------------
/*
* Created on Apr 1, 2005
*/

/**
* @author Steve Bradley
*
* Added description code - AO
*/
import java.awt.Color;

public class GraphBars extends GraphShape {
public GraphBars( double newXBar, double newYBar, Point lowerLeft, Point upperRight ) {
center = new Point( newXBar, newYBar );
xBar = new LineSegment( newXBar, lowerLeft.getY(), newXBar, upperRight.getX());
yBar = new LineSegment( lowerLeft.getX(), newYBar, upperRight.getX(), newYBar );
}

protected void onDraw(Grapher.GraphWriter graph) {
graph.drawLineSegment(xBar, barColor);
graph.drawLineSegment(yBar, barColor);
graph.drawPoint( center, .5 );
}


public boolean isMouseOver( Point mousePoint ) {
// return ( xBar.ptLineDist( mousePoint) <= MOUSEOVER_DISTANCE
// || yBar.ptLineDist( mousePoint ) <= MOUSEOVER_DISTANCE );
return false;
}


public double getDistance( Point point ) {
return Math.min( xBar.ptLineDist( point ), yBar.ptLineDist( point ) );
}

public String getDescription( StatManager statManager ) {
return "x = " + StatManager.roundStat( statManager.calcXBar(), 3 )
+ "
y = " + StatManager.roundStat( statManager.calcYBar(), 3 ) + "";
}

private Point center;

private static final Color barColor = new Color( 255, 128, 0, 128 );

private LineSegment xBar;

private LineSegment yBar;

private static final int MOUSEOVER_DISTANCE = 20;

}


GraphCoordinator.java
-------------------------------------------------------------------
/*
* Created on Apr 14, 2005
*/

/*
* @author Andrew Owens
*/

public interface GraphCoordinator {
public void updateGraph();
}


GraphDeviation.java
-------------------------------------------------------------------
/*
* Created on Mar 31, 2005
*/

/**
* @author Andrew Owens
*/

import java.awt.Color;

public class GraphDeviation extends GraphShape {
public GraphDeviation( Point point, double yBar ) {
initLine( point, yBar );
}


public String getDescription( StatManager statManager ) {
return "Length = "
+ StatManager.roundStat( deviationLine.getP1().distance( deviationLine.getP2() ), 3 )
+ "
}


private void initLine( Point point, double yBar ) {
deviationLine = new LineSegment( point, new Point( point.getX(), yBar ) );
}


protected void onDraw( Grapher.GraphWriter graph ) {
if ( isHighlighted ) {
graph.drawLineSegmentHighlighted( deviationLine, Color.RED );
}
else {
graph.drawLineSegment( deviationLine, Color.RED );
}
}


protected void onMouseOver( Point mousePoint ) {
isHighlighted = true;
}


protected void onMouseAway( Point mousePoint ) {
isHighlighted = false;
}

public boolean isMouseOver( Point mousePoint ) {
return ( deviationLine.ptLineDistSq( mousePoint ) <= HIGHLIGHT_DISTANCE );
}


public double getDistance( Point point ) {
return deviationLine.ptSegDist( point );
}


private boolean isHighlighted;

private static final int HIGHLIGHT_DISTANCE = 15;

private LineSegment deviationLine;


}


GraphDeviationSquare.java
-------------------------------------------------------------------
/*
* Created on Apr 3, 2005
*/

/**
* @author Andrew Owens
*/

public class GraphDeviationSquare extends GraphShape {

public GraphDeviationSquare( Point point, double yBar, int pointNum ) {
double sideLength = Math.abs( point.getY() - yBar );
Point upperLeft = new Point();

if ( point.getY() > yBar ) {
upperLeft.setLocation( point.getX(), point.getY() );
}
else {
upperLeft.setLocation( point.getX(), yBar );
}

devSquare = new Rectangle( upperLeft.getX(), upperLeft.getY(),
sideLength, sideLength );
pointNumber = pointNum;

center = new Point( devSquare.getCenterX(), devSquare.getCenterY() );
}


protected void onDraw( Grapher.GraphWriter graph ) {
if ( isHighlighted ) {
graph.drawDevSquareHighlighted( devSquare, pointNumber );
}
else {
graph.drawDevSquare( devSquare, pointNumber );
}
}


public boolean mouseOver( Point point ) {
isHighlighted = true;

return true;
}

public void mouseAway( Point point ) {
isHighlighted = false;
}

public boolean isMouseOver( Point mousePoint ) {
return ( mousePoint.getX() >= devSquare.getX()
&& mousePoint.getX() <= devSquare.getX() + devSquare.getWidth()
&& mousePoint.getY() >= devSquare.getY() - devSquare.getHeight()
&& mousePoint.getY() <= devSquare.getY() );
}

public double getDistance( Point mousePoint ) {
return center.distance( mousePoint.getX(), mousePoint.getY() );
}

public String getDescription( StatManager statManager ) {
return "Deviation Squared = "
+ StatManager.roundStat( devSquare.getWidth() * devSquare.getHeight(), 3 )
+ "";
}

private Rectangle devSquare;

private int pointNumber;

private Point center;

private boolean isHighlighted;
}


Grapher.java
-------------------------------------------------------------------
/*
* Created on Mar 24, 2005
*/

/**
* @author Andrew Owens
*
*/

import java.util.AbstractCollection;
import java.util.Iterator;
import java.awt.Color;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.ArrayList;

public class Grapher {
public Grapher( ConfigManager newConfigManager, StatManager newStatManager, PointTable newPointTable,
Point newBottomLeft, Point newUpperRight) {
bottomLeft = newBottomLeft;
upperRight = newUpperRight;
mouseHandler = new MouseHandler();
pointTable = newPointTable;
configManager = newConfigManager;
graphWriter = new GraphWriter();
graphShapes = new ArrayList();
graph = new Graph( this, bottomLeft, upperRight );
statManager = newStatManager;

useBestFitLine = true;
graph.clear();
updateGraph( false );

}


public void updateGraph() {
// @hack, just tell it to reload
updateGraph( true );
}
public void updateGraph( boolean reload ) {
graph.clear();

if ( useBestFitLine ) {
statManager.useBestFitRegressionLine();
}

if ( reload ) {
if ( statManager.tableChanged()
|| configManager.isUpdated() ) {
clearGraphShapes();
loadGraphShapes();
}
}

drawGraphShapes();

if ( statManager.getPointList().size() == 0 ) {
graphWriter.writeMessage( INIT_MESSAGE_POSITION,
INIT_MESSAGE );
graphWriter.writeMessage( INIT_MESSAGE_DRAG_POSITION,
INIT_MESSAGE_DRAG );
}
graph.repaint();
}


public Graph getGraph() {
return graph;
}


public MouseHandler getMouseHandler() {
return mouseHandler;
}


public void resizeGraph( Point newUpperRight ) {
upperRight.setLocation( newUpperRight.getX(), newUpperRight.getY() );
graph.resizeGraph( bottomLeft, upperRight );
updateGraph( true );
}


public void useCustomLine() {
useBestFitLine = false;
}


public void useBestFitLine() {
useBestFitLine = true;
}



public Point getBottomLeft() {
return bottomLeft;
}


public Point getUpperRight() {
return upperRight;
}

private void loadGraphShapes() {
AbstractCollection collection = statManager.getPointList();
Iterator it = collection.iterator();

Line regressionLine = statManager.calcRegressionLine();

boolean showResiduals = configManager.querySetting( "PlotResiduals" ).booleanValue();
boolean showDeviations = configManager.querySetting( "PlotDevLines" ).booleanValue();
boolean showResSquares = configManager.querySetting( "PlotResSquares" ).booleanValue();
boolean showXYBars = configManager.querySetting( "PlotXYBars" ).booleanValue();
boolean showYBar = configManager.querySetting( "PlotYHat" ).booleanValue();
boolean showDevSquares = configManager.querySetting( "PlotDevSquares" ).booleanValue();;

addGraphShape( new GraphGrid( bottomLeft, upperRight) );
if ( showYBar ) {
addGraphShape( new GraphRegressionLine( regressionLine, bottomLeft, upperRight, statManager, this ) );
}

if ( showXYBars && collection.size() > 0 ) {
addGraphShape( new GraphBars( statManager.calcXBar(), statManager.calcYBar(), bottomLeft, upperRight) );
}

int pointCount = 0;

while ( it.hasNext() ) {
Point point = (Point)it.next();
GraphShape graphPoint = new GraphPoint( point );
addGraphShape( graphPoint );

pointCount++;

if ( showResiduals ) {
GraphShape resLine = new GraphResidual( regressionLine, point );
addGraphShape( resLine );
}
if ( showDeviations ) {
GraphShape devLine = new GraphDeviation( point, statManager.calcYBar() );
addGraphShape( devLine );
}
if ( showResSquares ) {
GraphShape resSquare = new GraphResidualSquare( regressionLine, point, pointCount );
addGraphShape( resSquare );
}
if ( showDevSquares ) {
GraphShape devSquare = new GraphDeviationSquare( point, statManager.calcYBar(), pointCount );
addGraphShape( devSquare );
}
}

// add the stat display
addGraphShape( new GraphStatDisplay( graph, statManager) );
}

private void drawGraphShapes() {
AbstractCollection collection = getShapeList();
Iterator it = collection.iterator();

while ( it.hasNext() ) {
GraphShape shape = (GraphShape)it.next();
shape.draw( graphWriter );
}
}


// adding and general management for shapes:
private void addGraphShape( GraphShape shape ) {
graphShapes.add( shape );
}


private void clearGraphShapes() {
graphShapes.clear();
}


private AbstractCollection getShapeList() {
return graphShapes;
}


private boolean isDragging() {
return isDragging;
}


private void drag( Point mousePoint ) {
if ( draggedShape != null ) {
draggedShape.drag( mousePoint );
}

statManager.refreshTable();
}


private boolean beginDrag( Point mousePoint ) {
AbstractCollection collection = getShapeList();
Iterator it = collection.iterator();

while ( it.hasNext() ) {
GraphShape shape = (GraphShape)it.next();

if ( shape.canDrag( mousePoint ) ) {
setDraggedShape( shape );
isDragging = true;
return true;
}
}

return false;
}


private void mouseOver( Point mousePoint ) {
AbstractCollection collection = getShapeList();
Iterator itShapes = collection.iterator();

boolean found = false;
GraphShape foundShape = null;

double shortestDistance = 0.0;
GraphShape nearestShape = null;
boolean firstPass = true;

itShapes = collection.iterator();

while ( itShapes.hasNext() ) {
GraphShape shape = (GraphShape)itShapes.next();
double distanceFromMouse = shape.getDistance( mousePoint );
if ( distanceFromMouse >= 0
&& shape.isMouseOver( mousePoint) && ( distanceFromMouse < shortestDistance
|| firstPass ) ) {
nearestShape = shape;
shortestDistance = distanceFromMouse;
firstPass = false;
}
}

if ( nearestShape != null && shortestDistance >= 0 ) {
nearestShape.mouseOver( mousePoint );
showDescription( nearestShape.getDescription( statManager ) );
}
else {
showDescription( null );
}

itShapes = collection.iterator();
while ( itShapes.hasNext() ) {
GraphShape shape = (GraphShape)itShapes.next();

if ( shape != nearestShape ) {
shape.mouseAway( mousePoint);
}
}
}


private void endDrag() {
isDragging = false;
draggedShape = null;
}


private void setDraggedShape( GraphShape shape ) {
draggedShape = shape;
}


private void showDescription( String description ) {
/*
* HACK - The functionality of Swing's tool-tips seems rather
* limited (as far as I can tell). So in order to display a tip over
* the mouse cursor, next to the nearest point, I'm "pushing" the
* tool-tips as far as they'll go.
*
* Swing leaves the tool-tips where the mouse originally stayed for
* the delay, but we want them to follow the mouse. In order to
* achieve this effect, I subtly modify the tool-tip's text each
* pass. I couldn't find a way to turn an individual tool-tip on and
* off, so I cleverly send in a null pointer to the setToolTipText
* method. - AO
*/
// HACK - we alternate between the text the
// tool tip displays so that the tip stays "refreshed"
if ( toolTipState ) {
graph.setToolTipText( description );
}
else if ( description == null ) {
graph.setToolTipText( null );
}
else {
graph.setToolTipText( description + " " );
}

toolTipState = !toolTipState;
}


private Color getResSquareColor( int num, int numSquares ) {
int r = 96;
int g = 154;

if ( numSquares == 0 ) {
numSquares = 1;
}

int b = 128 + ( (int) ( 0.5 *( 255 / numSquares * num ) ) );

return new Color( r, g, b, 128 );
}


private Color getDevSquareColor( int num, int numSquares ) {
int r = 128;// + ( (int) ( 0.5 *( 255 / numSquares * num ) ) );
int g = 128 + ( (int) ( 0.5 *( 255 / numSquares * num ) ) );
int b = 0;

return new Color( r, g, b, 128 );
}


private int getGraphWidth() {
return (int)( upperRight.getX() - bottomLeft.getX() );
}


private int getGraphHeight() {
return (int)( upperRight.getY() - bottomLeft.getY() );
}
// the interface that the GraphShapes use
public class GraphWriter {
public void writeMessage( Point point, String message ) {
graph.drawMessage( point, message );
}
public void drawDevSquare( Rectangle rectangle, int num ) {
graph.drawRect( rectangle, getDevSquareColor( num, statManager.countPoints() ) );
}

public void drawDevSquareHighlighted( Rectangle rectangle, int num ) {
graph.drawRect( rectangle, new Color( 0, 128, 0 ) );
}

public void drawPoint( Point point ) {
drawPoint( point, 1, false );
}

public void drawPoint( Point point, double scale ) {
graph.drawPoint( point, scale );
}

public void drawPointHighlighted( Point point ) {
drawPoint( point, 1.5, true );
}


public void drawLine( Line line, Color color ) {
drawLine( line, color, false );
}


public void drawLineHighlighted( Line line, Color color ) {
drawLine( line, color, true );
}


public void drawLineSegment( LineSegment lineSegment, Color color ) {
graph.drawLineSegment( lineSegment, 1, color );
}


public void drawLineSegmentHighlighted( LineSegment lineSegment, Color color ) {
graph.drawLineSegment( lineSegment, 3, color );
}


public void drawResidualSquareHighlighted( Rectangle rectangle, int squareNum ) {
graph.drawRect( rectangle, new Color(0, 0, 200, 255) );
}

public void drawResidualSquare( Rectangle rectangle, int squareNum ) {
graph.drawRect( rectangle, getResSquareColor( squareNum, statManager.countPoints() ) );
}
/*------------------------------------------------------------
* These methods directly write to the graph
*-----------------------------------------------------------*/
private void drawPoint( Point point, double scale, boolean highlight ) {
if ( !highlight ) {
graph.drawPoint( point );
}
else {
graph.drawPoint( point, 2 );
}
}


private void drawLine( Line line, Color color, boolean highlight ) {
// TODO: it's discomforting dynamically allocating one of these each pass...
// maybe cache one
LineSegment lineAsSegment = new LineSegment( bottomLeft.getX(), line.f( bottomLeft.getX() ),
upperRight.getX(), line.f( upperRight.getX() ) );

if ( highlight ) {
graph.drawLineSegment( lineAsSegment, 10, color );
}
else {
graph.drawLineSegment( lineAsSegment, 4, color );
}
}


private void drawLineSegment( LineSegment lineSegment, Color color, boolean highlight ) {

}


}

private class MouseHandler implements MouseListener, MouseMotionListener {
public void mouseClicked( MouseEvent event ) {
Point point = new Point( event.getPoint() );
point = graph.toPlaneCoords( point );
pointTable.addPoint( point );
updateGraph();
}


public void mouseReleased( MouseEvent event ) {

}


public void mouseExited( MouseEvent event ) {

}


public void mouseEntered( MouseEvent event ) {

}


public void mousePressed( MouseEvent event ) {

}


public void mouseDragged( MouseEvent event ) {
Point mousePoint = new Point( event.getPoint() );
mousePoint = graph.toPlaneCoords( mousePoint );

if ( isDragging() ) {
drag( mousePoint );
}
else {
if ( !beginDrag( mousePoint ) ) {
Point newPoint = new Point( mousePoint );
pointTable.addPoint( newPoint );
setDraggedShape( new GraphPoint( newPoint ) );
isDragging = true;
}
}
updateGraph();
}


/**
* If the mouse cursor is near a point, then select it and display
* relevant information about it in a tool tip
*/
public void mouseMoved( MouseEvent event ) {
// get the cursor's position
Point mousePoint = graph.toPlaneCoords( new Point( event.getPoint() ) );

mouseOver( mousePoint );

// set the dragged point to null
if ( isDragging() ) {
endDrag();
}

updateGraph( false );
}
}

// custom regression line stuff:
private boolean useBestFitLine;

private Line customRegressionLine;

private int resSquareCount;

private static final Point INIT_MESSAGE_POSITION = new Point( 100, 230 );

private static final Point INIT_MESSAGE_DRAG_POSITION = new Point( 100, 217 );
private static final String INIT_MESSAGE = "- Click on the graph to plot a point.";

private static final String INIT_MESSAGE_DRAG = "- Drag points and observe the effects";
// the maximum distance from the cursor a point
// must be to be dragged
private static final int CURSOR_DRAG_DISTANCE = 30;

// this member describes whether or not we should
// draw the tool tip as usual or with
// a slight modification that will force
// swing to display it again
// TODO: Fix this hack if possible - AO
private boolean toolTipState;

private Point selectedPoint;

private boolean isDragging;

private PointTable pointTable;

private MouseHandler mouseHandler;

private ConfigManager configManager;

private StatManager statManager;

private Graph graph;

// list of graph objects
private ArrayList graphShapes;

private GraphWriter graphWriter;

// dragged object
private GraphShape draggedShape;

private Point bottomLeft;

private Point upperRight;

}


GraphGrid.java
-------------------------------------------------------------------
/*
* Created on Apr 2, 2005
*/

/**
* @author Andrew Owens
*/

public class GraphGrid extends GraphShape {
public GraphGrid( Point newBottomLeft, Point newUpperRight ) {
bottomLeft = newBottomLeft;
upperRight = newUpperRight;
axisX = new LineSegment( bottomLeft.getX(), 0, upperRight.getX(), 0 );
axisY = new LineSegment( 0, bottomLeft.getY(), 0, upperRight.getY() );
}

protected void onDraw( Grapher.GraphWriter graph ) {
// draw the axis
graph.drawLineSegment( axisX, ColorSchemeManager.AXIS );
graph.drawLineSegment( axisY, ColorSchemeManager.AXIS );

// add lines that represent a set distance along the axes

// x axis
final int deltaX = (int) ( ( upperRight.getX() ) / NUM_AXIS_TICKS );
final int AXIS_TICK_LENGTH = (int)upperRight.getX();
final int PARA_TEXT_OFFSET = 1;
final int PER_TEXT_OFFSET = -10;

LineSegment tickSegment = new LineSegment();
Point txtPoint = new Point( 0, 0 );

boolean draw = true;

for ( int x = 0; x <= upperRight.getX(); x = x + deltaX) {
tickSegment.setLine( x, -AXIS_TICK_LENGTH, x, AXIS_TICK_LENGTH );
graph.drawLineSegment( tickSegment, ColorSchemeManager.GRID );

if ( draw ) {
txtPoint.setLocation( x + PARA_TEXT_OFFSET, PER_TEXT_OFFSET );
graph.writeMessage( txtPoint, Integer.toString( x ) );
}

draw = !draw;
}

draw = true;
for ( int x = 0; bottomLeft.getX() <= x; x = x - deltaX ) {
tickSegment.setLine( x, -AXIS_TICK_LENGTH, x, AXIS_TICK_LENGTH );
graph.drawLineSegment( tickSegment, ColorSchemeManager.GRID );

if ( draw ) {
txtPoint.setLocation( x + PARA_TEXT_OFFSET, PER_TEXT_OFFSET );
graph.writeMessage( txtPoint, Integer.toString( x ) );
}

draw = !draw;
}


// y axis
final int deltaY = (int) ( upperRight.getY() / NUM_AXIS_TICKS );

for ( int y = 0; y <= upperRight.getY(); y = y + deltaY ) {
tickSegment.setLine( -AXIS_TICK_LENGTH, y, AXIS_TICK_LENGTH, y );
graph.drawLineSegment( tickSegment, ColorSchemeManager.GRID );

if ( draw ) {
String asStrY = Integer.toString( y );
txtPoint.setLocation( -asStrY.length() * 8, y + PARA_TEXT_OFFSET );
graph.writeMessage( txtPoint, asStrY );
}

draw = !draw;
}

for ( int y = 0; bottomLeft.getY() <= y; y = y - deltaY ) {
tickSegment.setLine( -AXIS_TICK_LENGTH, y, AXIS_TICK_LENGTH, y );
graph.drawLineSegment( tickSegment, ColorSchemeManager.GRID );

if ( draw ) {
String asStrY = Integer.toString( y );
txtPoint.setLocation( -asStrY.length() * 8, y + PARA_TEXT_OFFSET );
graph.writeMessage( txtPoint, asStrY );
}

draw = !draw;
}

}

private LineSegment axisX;

private LineSegment axisY;

private Point upperRight;

private Point bottomLeft;

private static final int NUM_AXIS_TICKS = 10;

}


GraphPoint.java
-------------------------------------------------------------------
/*
* Created on Mar 30, 2005
*/

/**
* @author Andrew Owens
*/

public class GraphPoint extends GraphShape {

public GraphPoint( Point newPoint ) {
setPoint( newPoint );
}


public void setPoint( Point newPoint ) {
point = newPoint;
}


public boolean canDrag( Point mousePoint ) {
return ( mousePoint.distance( point ) <= DRAG_DISTANCE );
}


public String getDescription( StatManager statManager ) {
Line regressionLine = statManager.calcRegressionLine();

return "(" + point.getX() + ", " + point.getY() + ")
" + "Residual = "
+ StatManager.roundStat( regressionLine.findResidual( point ), 3 ) + "
" + "Dev x = "
+ ( StatManager.roundStat( statManager.calcXBar() - point.getX(), 3 ) )
+ "
" + "Dev y = " + StatManager.roundStat( statManager.calcYBar() - point.getY(), 3 ) + "
";

}


public double getDistance( Point comparePoint ) {
return point.distance( comparePoint );
}


protected void onDraw( Grapher.GraphWriter graph ) {
if ( isHighlighted ) {
graph.drawPointHighlighted( point );
}
else {
graph.drawPoint( point );
}
}


protected void onClick( Point mousePoint ) {

}


protected void onDrag( Point mousePoint ) {
point.setLocation( mousePoint.getX(), mousePoint.getY() );
}


protected void onMouseOver( Point point ) {
isHighlighted = true;
}


protected void onMouseAway( Point mousePoint ) {
isHighlighted = false;
}


public boolean isMouseOver( Point mousePoint ) {
return ( point.distance( mousePoint ) <= MOUSEOVER_DISTANCE );
}


private Point point;

private boolean isHighlighted;

private static final int MOUSEOVER_DISTANCE = 12;

private static final int DRAG_DISTANCE = 20;
}


GraphRegressionLine.java
-------------------------------------------------------------------
/*
* Created on Mar 31, 2005
*/

/**
* @author Andrew Owens
*/

import java.awt.Color;

// rather hacky because of the custom best-fit line
public class GraphRegressionLine extends GraphShape {
public GraphRegressionLine( Line newRegressionLine, Point newBottomLeft, Point newUpperRight, StatManager newStatManager, Grapher newGrapher ) {
pointToCompare = new Point();
initLine( newRegressionLine );
grapher = newGrapher;
bottomLeft = newBottomLeft;
upperRight = newUpperRight;
statManager = newStatManager;
}


public String getDescription( StatManager statManager ) {
return "y = "
+ StatManager.roundStat( regressionLine.getSlope(), 3 ) + "x + "
+ StatManager.roundStat( regressionLine.getYIntercept(), 3 ) + "";
}


private void initLine( Line newRegressionLine ) {
regressionLine = newRegressionLine;
}


protected void onDraw( Grapher.GraphWriter graph ) {
Color color = ( isCustomLine ) ? ColorSchemeManager.CUSTOM_REGRESSION : ColorSchemeManager.REGRESSION_LINE ;
if ( isHighlighted ) {
graph.drawLineHighlighted( regressionLine, color );
}
else {
graph.drawLine( regressionLine, color );
}

if ( isCustomLine ) {
graph.drawLine( statManager.calcBestFit(), ColorSchemeManager.GHOST_REGRESSION_LINE );
graph.drawPoint( new Point( getCloseMiddle() , regressionLine.f( getCloseMiddle() ) ) );
}
}


protected void onMouseOver( Point mousePoint ) {
isHighlighted = true;
}


protected void onMouseAway( Point mousePoint ) {
isHighlighted = false;
isDragging = false;
}


protected boolean canDrag( Point mousePoint ) {
//return isMouseOver( mousePoint );
//@hack for initial release
return false;
}


protected void onDrag( Point mousePoint ) {
isCustomLine = true;

if ( !isDragging ) {
if ( mousePoint.getX() < getCloseMiddle() ) {
pivot = new Point( upperRight.getX(), regressionLine.f( upperRight.getX() ) );
}
else {
pivot = new Point( bottomLeft.getX(), regressionLine.f( bottomLeft.getX() ) );
}
}


isDragging = true;
if ( pivot != null ) {
regressionLine.setLine( mousePoint, pivot );
}
grapher.useCustomLine();
}

private double getCloseMiddle() {
return ( upperRight.getX() - bottomLeft.getX() - 200 ) / 2 ;
}
public boolean isMouseOver( Point mousePoint ) {
return ( getDistance( mousePoint ) < HIGHLIGHT_DISTANCE );
}


public double getDistance( Point point ) {
pointToCompare.setLocation( point.getX(), regressionLine.f( point.getX() ) );
return pointToCompare.distance( point );
}

// instead of allocating a new point at runtime, just modify this one
private Point pointToCompare;

private boolean isHighlighted;

private Line regressionLine;

private static final int HIGHLIGHT_DISTANCE = 7;

private Grapher grapher;

private Point bottomLeft;

private Point upperRight;

private StatManager statManager;

private static Point pivot;

private static boolean isDragging;

private static boolean isCustomLine;




}


GraphResidual.java
-------------------------------------------------------------------
/*
* Created on Mar 31, 2005
*/

/**
* @author Andrew Owens
*/

public class GraphResidual extends GraphShape {
public GraphResidual( Line regressionLine, Point point ) {
initLine( regressionLine, point );
}


private void initLine( Line regressionLine, Point point ) {
residualLineSegment = regressionLine.findResidualLine( point );
}


protected void onDraw( Grapher.GraphWriter graph ) {
if ( isHighlighted ) {
graph.drawLineSegmentHighlighted( residualLineSegment, ColorSchemeManager.RESIDUAL );
}
else {
graph.drawLineSegment( residualLineSegment, ColorSchemeManager.RESIDUAL );
}
}



public String getDescription( StatManager statManager ) {
return "Length = "
+ ( residualLineSegment.getP1().distance( residualLineSegment.getP2() ) )
+ "";
}


public double getDistance( Point point ) {
return residualLineSegment.ptSegDist( point );
}


public boolean isMouseOver( Point mousePoint ) {
return ( residualLineSegment.ptLineDistSq( mousePoint ) <HIGHLIGHT_DISTANCE );
}


protected void onMouseOver( Point mousePoint ) {
isHighlighted = true;
}


protected void onMouseAway( Point mousePoint ) {
isHighlighted = false;
}


private static final int HIGHLIGHT_DISTANCE = 5;

private boolean isHighlighted;

private LineSegment residualLineSegment;
}


GraphResidualSquare.java
-------------------------------------------------------------------
/*
* Created on Apr 1, 2005
*/

/**
* @author Andrew Owens
* @author Doug Tremblay
* @author Steven Rowe Bradley
*/

public class GraphResidualSquare extends GraphShape {

public GraphResidualSquare( Line regression, Point point, int newSquareNum ) {
square = regression.findResSquare( point );
center = new Point( square.getCenterX(), square.getCenterY() );
squareNum = newSquareNum;
}

public String getDescription(StatManager stats) {
return "Residual Squared = " + StatManager.roundStat( (square.getWidth() * square.getHeight() ), 3) + "";
}


protected void onDraw( Grapher.GraphWriter graph ) {
if ( isHighlighted ) {
graph.drawResidualSquareHighlighted( square, squareNum );
}
graph.drawResidualSquare( square, squareNum );
}


public boolean isMouseOver( Point mousePoint ) {
return ( mousePoint.getX() >= square.getX()
&& mousePoint.getX() <= square.getX() + square.getWidth()
&& mousePoint.getY() >= square.getY() - square.getHeight()
&& mousePoint.getY() <= square.getY() );
}


public double getDistance( Point point ) {
return center.distance( point );
}


protected void onMouseOver( Point mousePoint ) {
isHighlighted = true;
}


protected void onMouseAway( Point mousePoint ) {
isHighlighted = false;
}

// so we don't have to allocate a center each pass
private Point center;

private int squareNum;

private boolean isHighlighted;

private Rectangle square;
}


GraphShape.java
-------------------------------------------------------------------
/*
* Created on Mar 30, 2005
*/

/**
* @author Andrew Owens
*/

public abstract class GraphShape {

public boolean clicked( Point point ) {
if ( isClicked( point ) ) {
onClick( point );
return true;
}
else {
return false;
}
}


public void drag( Point point ) {
onDrag( point );
}

public boolean mouseOver( Point point ) {
if ( isMouseOver( point ) ) {
onMouseOver( point );
return true;
}
else {
onMouseAway( point );
return false;
}
}


public String getDescription( StatManager statManager ) {
return "";
}


public void draw( Grapher.GraphWriter graph ) {
onDraw( graph );
}


public void mouseAway( Point mousePoint ) {
onMouseAway( mousePoint );
}


public double getDistance( Point point ) {
return -1.0;
}
/*----------------------------------------
* Protected interface
*--------------------------------------*/

protected boolean isClicked( Point point ) {
return false;
}


protected boolean canDrag( Point point ) {
return false;
}


public boolean isMouseOver( Point point ) {
return false;
}


protected void onClick( Point point ) {

}


protected void onDrag( Point mousePoint ) {

}


protected void onMouseOver( Point point ) {

}


protected void onDraw( Grapher.GraphWriter graph ) {

}


protected void onUpdateState() {

}

protected void onMouseAway( Point mousePoint ) {

}

}


GraphStatDisplay.java
-------------------------------------------------------------------
/*
* Created on Apr 6, 2005
*/

/**
* @author Andrew Owens
*/

import javax.swing.JPanel;
import javax.swing.JLabel;

public class GraphStatDisplay extends GraphShape {
GraphStatDisplay( Graph graph, StatManager newStatManager ) {
statManager = newStatManager;
statDisplay = new JPanel();
initDisplay();
graph.addStatDisplay( statDisplay );
}


public void onDraw( Grapher.GraphWriter graphWriter ) {
statDisplay.setVisible( true );
}

private void initDisplay() {
Line regressionLine = statManager.calcRegressionLine();

StringBuffer display = new StringBuffer();

display.append( "
" );

display.append( "  ŷ = " + StatManager.roundStat( regressionLine.getSlope(), 3 )
+ "x + "
+ StatManager.roundStat( regressionLine.getYIntercept(), 3 )
+ "

" );
//}
//if ( configManager.querySetting( "ShowXYBars").isValid()
// && configManager.querySetting( "ShowXYBars" ).booleanValue() ) {
display.append( "  x = "
+ StatManager.roundStat( statManager.calcXBar(), 3 )
+ "

" );
display.append( "  y = "
+ StatManager.roundStat( statManager.calcYBar(), 3 )
+ "

" );
//}
//if ( configManager.querySetting( "ShowR" ).isValid()
// && configManager.querySetting( "ShowR" ).booleanValue() ) {
display.append( "  r = "
+ StatManager.roundStat( statManager.calcR(), 4 )
+ "

" );
//}
//if ( configManager.querySetting( "ShowRSquared" ).isValid()
// && configManager.querySetting( "ShowRSquared" ).booleanValue() ) {
display.append( "  r2 = "
+ StatManager.roundStat( statManager.calcRSquare(), 4 )
+ "

" );
//}
//if ( configManager.querySetting( "ShowSSres").isValid()
// && configManager.querySetting( "ShowSSres").booleanValue() ) {

display.append( "  SSres = "
+ StatManager.roundStat( statManager.calcSSres(), 3 )
+ "

" );
//}
//if ( configManager.querySetting( "ShowSSdev").isValid()
// && configManager.querySetting( "ShowSSdev").booleanValue() ) {

display.append( "  SSdev = "
+ StatManager.roundStat( statManager.calcSSdev(), 3 )
+ "

" );
//}


display.append( "" );

setText( display.toString() );
statDisplay.setSize( 300, 300 );
statDisplay.setLocation( 30, 30 );
}


private void setText( String display ) {
statDisplay.add( new JLabel( display ) );
}

private StatManager statManager;

private JPanel statDisplay;
}


JavaPic_emblemjpg.java
-------------------------------------------------------------------
// JavaPic_emblemjpg.java

import javax.swing.*;
import java.awt.*;

//Raw image data:

public class JavaPic_emblemjpg{
public static ImageIcon getImageIcon() {
if (imageIcon == null) { imageIcon = new ImageIcon(bytes); }
return imageIcon;
}
public static Image getImage() { return getImageIcon().getImage(); }
private static ImageIcon imageIcon;
private static byte[] bytes = {
-1,-40,-1,-32,0,16,74,70,73,70,0,1,1,1,0,96,0,96,0,0,-1,-31,0,22,69,120,105,102,0,0,73,73
,42,0,8,0,0,0,0,0,0,0,0,0,-1,-37,0,67,0,8,6,6,7,6,5,8,7,7,7,9,9,8,10,12
,20,13,12,11,11,12,25,18,19,15,20,29,26,31,30,29,26,28,28,32,36,46,39,32,34,44,35,28,28,40,55,41
,44,48,49,52,52,52,31,39,57,61,56,50,60,46,51,52,50,-1,-37,0,67,1,9,9,9,12,11,12,24,13,13,24
,50,33,28,33,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50
,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,-1,-64,0,17,8,0,105,0,-99,3
,1,34,0,2,17,1,3,17,1,-1,-60,0,31,0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1
,2,3,4,5,6,7,8,9,10,11,-1,-60,0,-75,16,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125,1
,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,-127,-111,-95,8,35,66,-79,-63,21,82,-47,-16,36
,51,98,114,-126,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74
,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,-125,-124,-123,-122,-121,-120,-119,-118
,-110,-109,-108,-107,-106,-105,-104,-103,-102,-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,-72,-71,-70,-62,-61,-60,-59,-58
,-57,-56,-55,-54,-46,-45,-44,-43,-42,-41,-40,-39,-38,-31,-30,-29,-28,-27,-26,-25,-24,-23,-22,-15,-14,-13,-12,-11,-10,-9,-8,-7
,-6,-1,-60,0,31,1,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9
,10,11,-1,-60,0,-75,17,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119,0,1,2,3,17,4,5,33,49
,6,18,65,81,7,97,113,19,34,50,-127,8,20,66,-111,-95,-79,-63,9,35,51,82,-16,21,98,114,-47,10,22,36,52,-31
,37,-15,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89
,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,-126,-125,-124,-123,-122,-121,-120,-119,-118,-110,-109,-108,-107,-106,-105
,-104,-103,-102,-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,-72,-71,-70,-62,-61,-60,-59,-58,-57,-56,-55,-54,-46,-45
,-44,-43,-42,-41,-40,-39,-38,-30,-29,-28,-27,-26,-25,-24,-23,-22,-14,-13,-12,-11,-10,-9,-8,-7,-6,-1,-38,0,12,3,1,0
,2,17,3,17,0,63,0,-9,-6,40,-96,-100,12,-48,1,72,78,5,25,4,-32,26,-27,124,111,-30,-88,60,63,-31,-5,-45
,5,-36,75,-87,-19,88,-96,-113,120,-36,-113,33,-38,-84,71,-96,-28,-13,-23,69,-63,43,-24,-123,-15,87,-113,116,79,9,75,29
,-74,-93,36,-122,-22,120,94,72,33,-115,9,50,16,56,92,-114,-123,-113,3,61,-21,-56,47,-4,121,-30,-67,117,-89,73,-11,88
,-12,116,-78,-107,64,-101,78,112,-47,23,44,14,-42,-22,-46,17,-99,-127,84,16,78,73,-30,-71,-85,-39,53,63,22,94,91,-55
,-88,92,46,-91,127,113,114,-112,-7,118,-14,-123,121,21,126,84,96,-72,37,83,-110,-60,-29,-71,61,43,-39,-4,23,-16,-62,-49
,65,-43,31,85,-44,45,52,-13,117,-128,97,-126,4,102,-114,-39,-14,114,-54,-51,-36,-28,116,3,24,-87,-69,123,27,90,48,-8
,-119,-2,23,67,-83,-3,-113,84,-68,-42,-92,-44,100,107,-117,-123,-14,30,-15,-37,14,-127,126,-14,35,114,-128,-110,120,-64,-19,-127
,93,-8,-92,10,0,-93,32,-100,3,-56,-22,42,-116,-101,-69,29,69,114,122,-41,-60,63,13,104,108,-15,-36,106,-48,-55,52,106
,-52,-16,-37,-2,-11,-108,47,39,59,115,-114,-121,-83,114,-41,31,26,-83,-29,-104,11,127,15,-33,77,19,-128,-47,72,-45,-58,-91
,-44,-9,-37,-110,69,15,77,89,80,-91,58,-114,-48,87,61,86,-118,-15,-21,-65,-115,-41,22,-10,114,92,15,12,-80,-14,-66,102
,70,-66,92,-19,-17,-97,-105,-125,-125,87,19,-29,42,-62,-88,-9,-34,25,-43,33,64,-37,101,100,120,-28,10,120,-23,-45,61,69
,84,33,42,-97,2,-72,85,-89,42,78,-43,21,-113,85,-88,-16,27,13,-73,56,-24,72,-28,87,41,-94,124,69,-16,-34,-72,-62
,56,117,120,96,-100,-14,45,-18,-121,-109,38,62,-115,-41,-16,-82,-73,35,-90,123,102,-109,-117,78,-51,16,41,25,92,114,62,-107
,-97,-85,92,75,105,103,36,-48,90,-75,-44,-22,-92,-91,-70,50,-87,-107,-121,69,5,-80,1,39,-34,-81,22,24,4,28,-113,110
,105,10,-84,-125,-112,121,31,74,64,120,-68,-33,21,-11,-24,117,-85,-88,98,-45,-84,-16,-82,-55,-10,107,-119,54,-55,104,35,-27
,-52,-69,115,-110,-64,-31,113,-58,107,-47,-4,33,-29,61,39,-58,26,100,-73,-102,89,-97,108,50,8,-28,89,-48,-85,2,64,32
,-5,-126,15,6,-72,95,-119,127,11,-92,-44,-28,-72,-41,-76,70,86,-66,-112,-121,-66,-118,-18,66,-47,-68,106,51,-14,-128,9,7
,32,28,3,94,81,-31,-83,94,-1,0,66,-44,108,-75,13,53,110,79,-101,113,24,-78,-126,75,-111,-79,-120,-7,29,92,14,-103
,28,2,-61,56,7,-72,-92,-35,-115,20,84,-74,62,-74,-90,52,-79,-95,-61,58,-87,-12,36,10,-59,-16,-106,-71,47,-120,-68,47
,97,-86,79,18,69,60,-24,-34,100,104,78,3,43,21,56,-49,56,-56,-83,-109,28,114,0,-52,-128,-97,113,76,-52,-110,-87,106
,-73,-90,-61,76,-71,-71,85,12,-15,-89,-56,-89,-95,99,-62,-113,-52,-118,-69,88,30,38,-107,90,-38,11,117,42,93,-18,-30,5
,114,51,-128,115,-3,42,100,-20,-101,26,87,101,-9,-69,-113,77,-46,-92,-70,-68,-101,-9,118,-74,-26,73,-92,-58,120,85,-53,31
,-48,-102,-7,-89,91,-44,23,-58,126,35,109,64,68,45,111,100,-72,37,-19,110,3,74,-14,5,33,99,-128,70,-68,-79,-56,110
,-125,3,-100,-111,-102,-10,31,-117,122,-36,-38,95,-126,-34,-58,11,101,-109,-5,70,25,98,118,39,104,-114,53,66,-52,64,-18,112
,14,7,74,-29,62,20,89,77,125,-29,-115,67,94,-66,66,-109,8,30,-32,73,110,114,8,-112,-113,-35,-52,79,112,-69,72,3
,-45,52,94,-5,-105,31,117,92,-18,62,29,-8,57,60,63,4,-105,-105,-57,-2,39,-41,-79,35,93,-60,-95,66,-60,7,69,1
,120,-21,-98,115,-4,-85,-77,-80,-44,97,-44,98,105,-83,-114,-8,55,16,-110,15,-70,-8,-32,-107,-11,25,-17,-48,-41,46,-6,-115
,-43,-20,-45,-64,-110,-107,-105,82,-71,54,-48,-107,39,-9,118,-15,-116,72,-8,-20,73,44,63,35,87,-68,81,-30,27,31,5,-8
,119,-49,17,-87,-105,111,-109,103,108,56,-13,28,3,-75,125,-108,119,61,-123,17,-110,123,108,75,78,82,-13,38,-15,63,-117,-76
,-1,0,11,-37,-59,-10,-84,-53,117,112,-37,45,-83,34,57,-106,118,-1,0,100,122,14,-28,-16,43,-55,-68,65,-30,63,18,120
,-114,-38,85,-97,80,-117,78,-76,-107,78,-37,59,70,43,-100,-116,98,73,7,-52,71,7,32,99,-83,115,62,83,120,-117,82,-102
,109,114,105,110,-82,-89,5,-102,-28,3,-70,50,57,80,-125,-8,85,123,14,43,87,72,-67,-42,127,-75,87,73,-106,-46,77,67
,80,101,-1,0,71,-103,-104,42,42,-111,-115,-49,-49,-56,23,-116,-111,-100,-29,-118,-21,-63,85,-96,-27,121,-1,0,-64,58,49,-71
,118,34,-124,20,-69,-2,2,-23,16,71,-89,66,-28,71,104,-80,8,-40,-78,35,32,64,-71,-63,124,-6,99,-116,30,8,99,-37
,53,-50,90,121,9,-89,-91,-75,-72,-102,-30,-26,-39,-34,41,22,-34,38,-109,24,63,47,42,48,114,-72,-17,-38,-67,47,-2,17
,-21,43,123,99,117,-81,-35,-38,-35,-61,108,-53,41,-117,96,-118,-50,39,-50,55,109,63,121,-71,-2,42,-77,99,-83,-23,23,-47
,-101,11,77,107,78,-123,-28,5,33,-73,45,-79,65,-19,-123,32,112,77,116,99,61,-98,33,109,99,28,-65,19,87,7,62,120
,59,-36,-14,91,-109,60,-70,45,-4,81,105,-38,-124,102,72,-118,18,-42,114,125,-17,78,-99,78,0,-49,-67,107,-63,-83,88,67
,106,17,-103,-30,84,69,49,-92,-48,-54,-84,91,24,45,-9,72,56,25,-3,42,-41,-122,124,123,-30,-53,99,36,122,-84,112,95
,34,78,-16,-126,-49,-27,51,50,-109,-71,82,76,108,-56,-25,1,-79,-111,-34,-67,7,76,-15,101,-66,-77,35,89,36,-45,-38,-33
,32,-52,-74,23,17,24,-27,80,59,5,60,48,-50,57,25,21,-106,14,95,87,-70,-121,94,-27,99,-15,19,-58,73,74,-94,-40
,-29,109,-84,116,-83,106,56,-41,-55,-114,-22,41,14,89,-1,0,-42,40,45,-112,49,-114,56,-55,56,31,-120,-30,-79,52,29,87
,89,-47,109,-26,-97,67,-42,46,-95,-78,89,-36,-63,111,112,-5,-19,-38,18,-40,7,105,-5,-71,-28,-28,17,94,-101,-86,120,91
,69,-44,100,-102,89,52,-13,111,116,-21,-78,75,-101,89,12,14,-37,-122,8,98,-68,55,94,-30,-72,-115,111,-62,-6,-49,-121,-57
,-38,-20,-90,23,-70,108,8,20,-107,80,37,-115,1,28,50,116,112,61,-70,-11,-91,-115,-85,42,-111,77,43,23,-107,-46,-96,-86
,53,85,-24,118,-34,25,-8,-81,5,-43,-62,-40,-21,-23,5,-116,-46,16,-112,-35,-58,-7,-122,70,-50,57,-49,40,122,125,-18,61
,-21,-45,-107,-114,9,-56,-6,87,-52,-19,62,-98,-10,112,94,-53,12,55,17,77,27,36,41,8,-1,0,94,-4,97,74,-98,-128
,28,-106,-49,64,107,-82,-16,55,-116,-92,-48,-96,-78,-45,117,27,-119,95,74,33,66,92,72,127,-29,-50,67,-64,86,61,-31,39
,-95,-22,-68,3,-57,53,-51,78,-99,73,-45,115,-74,-120,-68,-62,-107,26,53,20,105,-53,115,-37,27,-107,30,-75,-13,-65,-60,13
,2,45,39,-60,-9,26,-66,-97,26,-99,34,-10,66,47,-82,94,47,-98,-46,92,-13,-126,48,64,-56,7,-111,-63,-81,-95,-125,-87
,81,-125,-100,-12,62,-75,-29,127,19,-12,-15,116,-6,-68,48,64,-41,50,-95,-126,-6,21,-113,-97,41,-71,-114,71,32,125,-20,1
,-110,-66,-11,-115,71,100,-114,106,127,16,124,10,-42,116,-40,-84,117,13,41,117,35,53,-5,-53,-25,-104,101,114,73,1,6,-9
,94,-37,75,30,-43,-20,101,-91,42,-91,81,65,-18,9,-23,95,51,-8,63,86,-97,67,-15,-34,-108,108,45,-96,-44,126,-34,85
,28,-37,-30,37,87,-107,-126,-77,15,79,-107,115,-125,-33,53,-12,-72,101,84,92,-107,30,-100,-43,-89,117,112,-100,108,-55,-85,-110
,-41,-104,13,126,-43,25,78,124,-56,-35,88,40,-29,-17,-114,79,-91,117,-75,-60,-8,-98,67,23,-119,-83,-28,-63,-62,-84,25,-64
,-50,114,-18,63,-49,-42,-71,-15,110,-44,-101,10,106,-14,56,79,-114,-41,55,-79,93,104,112,-92,-89,-56,120,-91,-115,-93,69,36
,-79,124,41,35,-41,-27,-56,-6,19,91,-2,3,-72,77,47,-31,26,-50,-88,-62,101,121,76,-95,-93,43,35,56,98,0,97,-35
,-66,-24,-81,49,-15,-36,-61,79,-8,-123,116,-45,93,-22,104,98,-66,-110,97,117,-71,-56,12,-47,2,-87,24,63,40,116,-56,10
,71,-86,-12,-59,122,62,-100,-51,-91,124,53,-16,-43,-92,-84,-105,31,32,-67,118,-115,120,42,-128,-54,1,-2,-15,-36,84,18,122
,-97,122,117,-91,-53,77,-77,75,104,-111,-46,120,94,24,-43,-82,-11,11,-89,69,-114,-58,49,100,-82,-57,-123,8,55,74,-7,-19
,-13,49,7,-3,-38,-14,47,21,120,-102,111,17,120,-98,-29,82,-107,38,-117,71,65,-27,89,92,58,19,26,-57,-9,-73,31,-18
,-17,32,30,113,-58,43,-70,-15,-77,-66,-107,-16,-1,0,75,-16,-38,-110,-105,26,-117,3,115,-76,-19,59,63,-42,76,79,-79,99
,-73,-15,-82,93,34,-72,-75,-115,-25,-75,65,104,-63,73,87,66,80,-86,-88,-32,112,112,-87,-123,3,7,-116,123,87,-93,-125,-64
,123,90,45,73,-37,-4,-52,86,53,-31,106,-86,-111,87,-73,115,42,25,-9,-57,2,-23,-119,-66,91,-87,-124,112,-31,-63,18,16
,9,-63,61,118,-9,39,-4,107,-65,-48,-12,104,52,40,124,-85,124,-51,114,-8,123,-53,-128,-89,51,55,124,123,0,112,7,-73
,-42,-79,60,15,-89,-92,-45,-35,-21,-85,109,12,43,35,-117,88,76,112,-124,84,-38,127,123,38,-48,48,11,17,-115,-64,15,-69
,93,102,-95,99,13,-3,-123,-59,-108,-9,18,-63,107,113,-124,118,-73,-112,68,-50,-121,-106,27,-79,-48,-87,-25,-44,102,-86,-106,29
,80,111,-85,58,113,-72,-7,-30,-38,-70,-78,56,95,21,-21,-34,15,-43,53,-40,44,-75,25,100,-65,-102,-44,58,37,-91,-76,-63
,45,-107,-49,-15,52,-103,0,-80,-58,58,-32,84,-109,13,62,-42,21,-123,-17,-81,-76,-69,118,93,-53,6,-71,104,-73,-106,-78,15
,-10,25,-78,71,-47,95,-46,-69,107,43,77,39,-5,58,43,91,61,62,-51,-76,-49,40,108,72,-95,71,-123,-15,-127,-40,21,108
,-9,60,-9,-55,-28,-42,83,-8,112,104,8,-9,26,86,-85,123,-95,90,36,111,53,-59,-68,68,73,110,0,-55,103,88,-33,33
,127,-32,56,-19,68,-109,-14,56,-44,-111,-127,-32,-88,35,-72,-80,-41,-20,-73,91,-34,-23,-15,-22,44,-64,27,79,45,25,89,3
,124,-79,-1,0,8,-12,7,-46,-91,-97,79,-75,75,-31,-94,106,-87,-10,-85,22,83,45,-101,-56,-33,-67,-73,41,-61,34,-55,-41
,32,29,-64,-25,-116,30,-72,-83,47,9,-38,-35,31,13,-37,92,-35,-69,-36,106,55,-20,-41,83,-68,-28,111,44,-7,41,-72,-5
,32,92,122,0,58,96,86,-115,-35,-89,-99,61,-103,114,-74,-41,86,-78,121,-79,-85,-61,-111,-128,-91,72,57,-21,-107,99,-6,26
,-25,78,-9,45,-103,113,-22,90,-121,-122,25,36,-68,-68,125,75,66,36,71,-10,-55,127,-29,-30,-45,-80,-13,113,-61,-96,63,-59
,-116,-118,-22,124,-47,-79,-117,-108,-14,-101,4,49,96,-54,-64,-29,24,-10,-23,-49,-91,100,-75,-88,120,-100,-71,73,99,-107,10,-70
,-56,-95,-107,-57,112,125,-70,-15,-17,89,-38,28,-105,62,31,-44,-29,-16,-5,76,27,78,-72,-118,73,116,-55,11,100,-60,23,-26
,123,114,79,96,50,-61,-40,28,-12,-83,97,62,-116,-106,-70,-94,-89,-119,124,35,17,-67,-113,95,-46,109,-95,-110,-18,-35,28,92
,89,-127,-75,110,16,-113,-103,-45,-78,-56,0,30,-69,-72,-84,107,115,111,-88,-39,71,119,9,-111,-32,48,-82,-20,-29,46,-104,59
,-108,-29,-128,7,-52,8,-29,-111,-38,-67,58,54,104,-2,111,49,-128,89,48,54,12,96,125,63,-62,-68,-109,-58,80,93,105,62
,35,-110,-45,79,72,-19,-20,-11,41,62,-40,-110,-55,24,-52,89,-7,101,65,-58,112,91,13,-114,7,53,-43,70,-70,-93,117,47
,-124,-121,70,85,-28,-108,85,-28,122,95,-62,-3,113,-116,119,30,24,-98,95,49,-84,35,18,-39,-56,91,113,123,86,-5,-71,61
,-54,-97,-105,-23,-118,-73,-83,20,-125,-57,-74,15,30,12,119,86,-20,-84,-35,-117,117,-19,-20,-115,94,99,-32,-19,84,105,-98,51
,-46,111,-18,117,41,100,9,59,88,72,9,17,-89,-111,46,66,-74,6,56,18,-124,39,57,-22,15,97,93,-42,-76,-28,107,-106
,78,-64,102,34,-104,-29,-97,-102,71,83,-1,0,-95,-30,-68,-100,76,-29,43,-72,109,-2,71,100,-80,-11,40,79,-110,-90,-116,-14
,-65,29,-23,-74,-2,18,-8,-119,45,-78,-93,-38,-38,-17,-106,-18,11,-117,119,49,-69,-119,87,-18,22,29,54,-74,70,71,65,95
,64,-24,107,-10,-33,11,105,12,47,-19,-18,-103,45,-111,94,-25,2,69,-107,-128,0,-112,79,-72,53,-13,-81,-115,47,-101,88,-15
,109,-59,-46,-35,73,115,121,111,127,60,33,38,112,99,-126,53,0,43,5,35,10,6,50,120,-28,-114,-11,-36,-83,-68,94,35
,-46,-76,-53,72,-29,-102,-58,-41,78,-76,-115,4,81,18,15,-104,-29,47,-72,-88,25,-32,39,95,122,83,-86,-95,30,102,76,-94
,-20,-113,118,-82,35,-58,-96,-91,-45,75,-125,-111,106,38,76,14,-66,84,-95,-104,126,77,93,-67,115,62,52,-113,102,-116,117,0
,-69,-123,-109,-7,-78,-88,25,38,18,54,-54,61,-58,-46,78,63,-39,-94,-68,121,-23,-72,-103,-63,-38,72,-16,-65,-120,-109,-22,95
,-16,-106,75,45,-11,-70,89,90,36,-23,-101,-101,118,46,76,108,-123,99,-105,105,-32,49,67,-73,62,-85,-19,93,46,-117,28,122
,-67,-73,-121,52,-44,-66,-110,-13,-19,113,15,-103,-50,-29,20,70,79,49,-93,-32,12,21,72,85,56,-57,83,-58,13,113,-2,32
,-16,-6,91,-23,-14,106,-30,-26,99,109,-2,-91,-101,113,120,-98,120,-56,56,-53,19,-127,34,0,-21,-40,-106,-59,104,-8,10,-1
,0,78,-48,124,77,30,-91,111,5,-29,105,-46,91,63,-39,-59,-83,-85,-74,27,112,80,24,-12,44,87,-109,-55,-28,-118,-51,-5
,-16,95,35,118,-84,116,-97,18,53,59,81,-15,38,4,-66,18,-57,111,103,103,30,31,-53,102,92,-69,51,54,112,14,9,-38
,-93,-100,116,53,-51,-35,120,-81,71,-69,87,45,127,36,36,72,93,115,11,-97,-104,-74,75,18,7,32,123,117,-64,-26,-89,-15
,-42,-85,14,-89,-30,-25,-65,-114,29,74,-39,46,45,-93,-120,37,-36,77,17,102,66,65,56,-6,48,-3,107,17,-117,-55,5,-52
,113,-122,-34,-42,-14,-86,1,-63,83,-79,-80,125,73,39,-7,-41,124,51,41,81,-76,18,71,109,12,-115,98,104,123,119,43,121
,91,-79,-67,-94,-40,104,-42,-6,77,-89,-10,-121,-127,-11,121,46,60,-76,51,-53,-126,-21,33,97,-110,64,15,-56,33,-127,-58,42
,-30,-23,126,17,-67,-43,32,-79,95,10,93,65,36,-49,-27,-26,107,70,9,25,35,-85,28,-16,63,-6,-43,-95,-96,-22,62,41
,-72,-46,44,-34,45,23,79,49,-55,107,25,-119,-115,-42,120,11,-128,72,-57,29,-66,-107,-85,99,117,-30,127,-19,27,56,-17,116
,107,40,-19,-124,-128,78,-21,122,-52,85,51,-106,96,-92,96,-98,-11,-43,23,-91,-49,30,90,54,-117,-102,-123,-117,-39,-8,87,82
,-75,-48,18,59,25,35,-77,120,-19,17,50,48,-40,36,109,62,-66,-98,-25,53,-26,-98,2,-67,-45,-75,43,-111,96,78,-83,22
,-77,34,-104,-81,96,-72,-70,50,69,44,127,-14,-46,95,-101,-93,-127,-112,23,-3,-82,-11,-24,-66,34,-72,-41,109,-124,87,-6,84
,-106,-58,59,55,-51,-43,-100,-72,84,-72,70,-32,13,-8,-54,-74,72,35,29,73,-17,-48,-15,-106,94,30,-41,53,79,31,105,-38
,-27,-42,-117,30,-100,45,29,-91,-98,113,48,119,-71,39,60,100,0,56,28,14,58,3,-100,-41,53,105,45,-70,-79,-59,92,-25
,-75,107,-7,111,117,-113,17,-34,13,123,-54,-68,-46,-82,71,-10,92,66,127,41,84,33,-28,42,127,22,71,-53,91,-65,16,-75
,-101,-117,-1,0,1,-23,90,-91,-99,-36,-111,69,113,125,27,-94,-62,-28,109,-54,55,-53,-57,60,115,83,-8,75,-63,-10,-42,54
,-6,-84,-6,-3,-75,-83,-35,-59,-59,-55,104,-92,-115,86,70,100,96,121,4,-14,57,108,-15,-125,89,-16,-4,61,-41,47,124,31
,62,-115,44,-10,-111,24,111,-68,-5,121,29,-8,100,10,65,4,99,-126,115,-69,-13,-51,99,23,-83,-117,52,-58,-95,127,105,-15
,23,71,6,-22,-32,-39,-33,88,13,-15,-109,-14,-79,80,73,59,121,-7,-121,31,-107,105,-8,-30,-44,106,94,27,-70,-40,-109,25
,45,29,111,-93,8,118,-97,-35,-97,-99,65,28,-126,80,-79,4,30,-96,123,-42,71,-120,52,-67,110,-37,-60,26,94,-85,-91,-3
,-106,111,-80,-38,-7,15,19,-56,80,-126,120,-18,56,-50,120,53,-67,-92,-22,122,-83,-36,37,117,29,55,-20,-60,-18,-113,-53,18
,-17,15,-14,-79,59,122,117,-38,70,15,-83,91,17,-50,67,115,-31,41,-32,23,80,106,-98,33,-58,-48,82,53,-110,-31,-104,103
,-95,-28,17,-127,-113,94,-43,-117,-30,8,-12,-39,-123,-75,-35,-107,-26,-79,60,-111,92,8,-27,109,67,118,-46,-82,-124,-4,-95,-128
,-25,35,21,-46,120,75,-60,55,-106,-2,29,-76,-74,-121,-61,-70,-84,-85,8,49,121,-88,23,24,86,96,0,-55,-19,-126,63,58
,103,-118,-75,75,-83,111,65,16,127,100,-36,88,-52,-9,-47,-7,77,119,-128,-81,-75,93,-114,48,78,6,20,-125,91,84,-125,-87
,11,23,-121,-88,-87,86,-116,-33,70,114,81,-85,75,29,-60,41,24,15,60,127,38,112,118,-111,-122,83,-11,-36,-93,21,-24,-102
,-66,-83,13,-52,26,86,-88,-61,111,-37,44,-73,-14,57,-30,72,28,-2,63,122,-68,-14,3,123,19,77,117,111,5,-118,126,-27
,-57,-107,-67,-97,28,117,-56,-63,4,103,32,-43,-115,67,90,-77,-66,-16,23,-121,-19,98,-66,-126,107,-104,-79,109,113,20,79,-13
,-94,-73,-73,108,109,28,-41,5,108,45,74,73,70,-94,-33,-4,-113,75,31,-116,-93,-117,-86,-89,75,-74,-89,59,127,117,-10,-3
,126,-32,92,42,89,-57,114,-19,60,36,54,-32,-126,70,-13,0,98,1,36,-16,6,61,78,58,87,-89,90,-66,-75,109,107,21
,-122,-102,82,107,-24,84,73,-88,-51,62,57,-107,-7,-57,29,-58,9,63,-17,10,-13,-99,10,1,46,-66,110,-30,115,121,21,-75
,-57,-109,109,27,46,67,-56,-92,-117,117,39,-65,76,-100,118,94,122,-41,-48,-34,21,-16,-110,90,104,-23,-10,-55,93,-25,-101,-9
,-78,56,56,46,-51,-43,-113,-8,118,21,-49,90,50,-88,-44,34,113,57,-37,83,-71,-51,84,-70,-68,-73,-126,38,121,-25,-118,8
,-71,83,36,-52,16,103,-15,-84,79,19,120,-74,45,21,-29,-78,-74,68,-72,-44,-26,25,88,-103,-80,-111,47,-9,-28,61,-105,-37
,-87,-19,-21,94,105,127,-91,79,-30,-117,-75,-98,-6,23,-43,-54,-74,126,-45,116,8,-126,62,57,17,-57,-100,1,-33,-65,-44,-41
,77,74,-79,-122,-30,-93,-122,-99,93,86,-57,61,-31,95,9,-66,-95,106,-46,-75,-84,23,38,57,-89,-115,-98,-31,-125,64,24,51
,3,-27,-57,-9,113,-116,125,62,-104,-81,65,93,14,-15,-74,44,-6,-108,-118,-128,5,17,-37,-90,-63,-113,78,7,-1,0,-86,-79
,-76,91,-85,127,11,-21,90,-90,-109,127,112,-66,68,-98,93,-20,44,19,63,51,124,-82,-96,118,-7,-108,113,-18,43,97,-4,85
,28,-84,5,-98,-97,123,119,-22,-63,118,-87,-4,77,121,-43,-28,-36,-76,-40,-12,-87,42,-119,90,-100,87,-81,-4,57,-56,-8,-13
,71,-74,-79,-76,-78,-70,-115,100,19,-119,-124,111,36,-110,23,-54,-80,35,7,57,-57,32,98,-71,-40,-18,33,-78,67,117,113,45
,-68,0,-19,36,-56,70,72,-17,-127,-44,-15,-109,-46,-67,27,83,-2,-43,-42,44,102,-76,-72,-16,-30,11,73,20,-121,-13,-28,-19
,-22,56,-22,58,-125,-22,43,-121,-48,60,63,111,5,-27,-59,-67,-19,-117,77,125,20,-32,73,36,-50,11,-68,76,-64,-93,-32,-6
,-95,-22,58,87,110,7,14,-79,46,-46,118,-79,-76,-13,26,-104,26,46,54,-26,111,-52,-20,-68,19,-88,65,54,-118,52,120,-60
,-62,75,44,-120,-52,-111,-104,-52,-79,51,22,-119,-16,70,64,-22,59,116,-85,-6,-1,0,-118,52,-97,10,66,-110,-22,13,116,-5
,-43,-4,-111,109,111,-69,-89,93,-57,-128,-67,122,-97,122,-27,30,107,-67,50,120,53,-59,-110,73,-68,-88,76,83,70,88,-106,-106
,28,-25,104,-12,101,39,114,-3,8,-17,90,-38,-57,-117,109,116,-19,62,-45,81,-98,-34,123,-85,91,-78,21,94,-33,1,88,48
,59,75,110,60,-125,-6,126,21,-19,-54,-116,-87,-82,86,-10,-22,124,-46,-97,-76,-105,50,91,-116,26,-59,-26,-87,113,101,123,33
,-74,101,89,3,90,-39,-37,-52,37,17,-74,-45,-13,-69,41,-38,-50,51,-61,127,14,78,57,-51,9,-84,68,-73,-118,35,-109,-53
,50,97,68,-119,31,-34,97,-56,83,-98,79,95,78,-43,-26,-6,-65,-120,52,75,-55,4,-70,54,-115,62,-105,112,126,-12,-15,78
,35,4,116,-1,0,86,-96,-125,-42,-101,109,-30,-19,65,20,-67,-3,-84,23,-40,59,-117,-125,-27,62,113,-114,61,-21,-52,-87,-20
,-7,-17,-51,115,-70,56,122,-83,124,45,30,-82,-105,81,-55,7,-106,-79,121,-122,64,-118,-14,68,0,4,22,-63,-63,94,-117,-113
,92,2,115,84,103,-43,27,85,-15,45,-100,82,37,-44,-33,98,99,113,46,16,12,79,-1,0,44,-44,-98,57,28,-66,15,70
,11,94,127,115,-30,-25,-101,78,81,-89,-39,-36,-38,75,35,19,52,-19,48,101,84,0,-28,42,-15,-110,51,-58,127,-83,77,99
,-29,54,-75,-75,75,123,11,9,68,67,-3,100,-110,-72,44,-18,79,-34,99,-45,57,-17,-12,-12,-90,-71,55,-71,62,-62,-90,-36
,-89,-91,27,-55,29,94,8,-9,55,-104,-59,-116,110,27,115,50,-11,-53,30,-36,-114,-98,-72,-84,29,119,-60,-74,122,60,-54,66
,-91,-27,-31,69,-14,-83,99,27,-91,99,-112,24,-111,-37,-116,-100,-98,-32,10,-27,-82,124,75,-84,75,-76,-62,-80,91,40,27,-119
,105,12,-82,49,-55,35,32,12,-2,-107,68,-20,-123,100,-71,102,-110,73,93,-43,-102,77,-5,-27,-103,-71,-38,-69,-79,-100,-106,11
,-128,56,28,-98,-43,60,-23,59,45,77,99,-124,-88,-43,-27,-94,61,35,-63,113,-127,-32,-21,57,-27,-71,-114,-27,89,-98,103,120
,-55,-38,-78,51,22,101,0,-11,60,-127,-45,-75,96,120,-41,82,107,-115,118,13,46,48,66,-39,-125,60,-92,19,-60,-114,48,-93
,-48,-99,-103,62,-65,53,110,-23,-46,-113,9,-8,58,-38,125,71,-28,91,100,-5,-128,115,36,-52,119,109,3,-69,18,79,-7,21
,-25,113,29,98,-18,107,-51,66,11,-3,-41,-105,50,-103,38,-74,-112,-2,-19,-40,-15,-14,-111,-48,-88,-64,-49,-75,122,48,-81,10
,51,-118,-88,115,-45,-62,86,-81,25,58,74,-10,58,29,97,69,-98,-121,-88,-57,27,-54,38,-112,-92,40,6,65,50,-54,-37,84
,-2,3,113,-19,-56,-87,-17,-68,54,-19,101,111,109,123,-94,-40,-33,-59,10,-124,-113,-54,59,100,85,-29,56,-24,123,14,-11,67
,64,-104,-21,62,36,-45,-83,46,-29,-106,24,108,-13,123,115,12,-116,-92,73,48,7,-54,-61,15,-68,50,75,126,-107,-24,114,72
,19,114,-69,24,-101,-18,-87,99,-61,31,-13,-4,-85,-49,-51,49,42,-91,101,-56,-51,-80,52,-35,40,53,56,-3,-25,59,-16,-49
,-62,-10,-111,-8,-42,-3,-30,-114,-11,-84,-20,-83,-125,36,87,32,3,12,-81,-43,1,-17,-14,40,30,-63,-85,-38,69,-51,-67,-100
,81,-85,-2,-20,21,-32,5,-1,0,10,-7,-34,-46,105,30,-22,-13,87,102,-44,45,-91,-5,108,-90,29,66,-38,70,-7,121,-38
,55,47,70,95,-108,112,71,78,43,-70,-46,-2,41,-49,-90,89,36,26,-2,-104,-9,-84,63,-44,94,-23,-56,26,57,-41,-44,-81
,-16,17,-57,21,-108,106,-59,-6,-123,92,60,-41,-67,109,25,-78,-1,0,10,52,-97,42,-31,95,89,-15,4,-97,104,-109,-51,-103
,-115,-9,50,54,49,-106,-7,125,56,-84,109,50,-62,127,-19,-8,-27,-46,-11,61,94,-29,64,-128,50,-107,-68,-72,18,37,-45,-28
,-116,-58,49,-60,99,7,-111,-41,-73,21,-47,-8,-29,95,123,109,-102,45,-100,114,-67,-59,-54,23,-103,-94,-28,-92,125,54,-25,-8
,75,114,51,-40,3,-114,113,92,-116,38,93,78,89,45,18,91,-83,66,104,-105,103,-10,126,-108,66,65,8,28,5,105,50,7
,-21,-59,77,105,105,-54,-107,-39,116,41,-73,30,121,-54,-47,49,126,39,-40,93,-104,-20,-11,77,34,-14,56,117,43,98,-54,-47
,68,-32,72,-56,-40,39,10,58,-13,-50,49,94,121,7,-116,-4,99,-86,-50,-10,-117,-83,-33,-119,34,-119,-27,-119,109,-118,-57,-54
,12,-100,-108,3,35,104,111,-57,21,-18,-74,94,16,-41,-95,40,-42,-102,39,-121,-20,21,88,16,-77,-52,-14,-55,-20,75,42,-11
,-1,0,57,-82,102,-13,-31,-84,-66,28,-15,118,-99,-30,107,-55,108,-38,-34,-18,-12,90,94,90,-38,66,86,53,19,-93,70,95
,-26,60,2,89,70,61,-24,-89,6,-95,-17,33,86,-100,27,-75,54,-20,67,-32,93,3,71,-15,4,-48,-61,-30,27,105,-17,69
,-44,78,-10,119,114,-22,83,-26,108,17,-66,54,80,-29,12,-69,-70,119,3,62,-11,-46,-8,-105,-31,-43,-105,-121,33,-117,-60,62
,20,-80,-14,-82,-84,-125,27,-101,112,-51,43,92,64,126,-8,1,-114,75,-88,-28,12,-13,-116,115,-102,-125,69,-47,90,-39,110,52
,107,-106,120,110,96,-67,84,75,-91,-31,-94,-71,85,6,41,-121,-88,-110,60,41,-25,4,-87,7,-83,122,102,-103,53,-35,-51,-102
,-67,-4,30,69,-46,-99,-110,-58,-89,43,-72,30,89,15,117,61,70,123,30,107,90,78,81,119,57,103,-87,-30,87,122,-59,-107
,-82,-122,-73,113,92,35,-58,-56,101,-13,-39,72,102,36,-116,-56,61,57,32,17,-63,-19,88,9,-88,-55,53,-67,-20,82,-40,22
,-46,111,85,31,-5,44,-56,18,96,-57,-109,44,45,-116,35,22,-7,-126,-29,25,53,-33,120,-33,-31,109,-52,-9,103,82,-48,18
,41,32,73,-66,-45,46,-110,-28,44,114,62,15,-52,-103,-32,28,-110,118,-98,9,-12,-51,121,-72,-75,54,-9,-46,66,-18,-55,113
,11,-125,36,82,-95,73,98,61,112,-63,-67,61,71,7,-75,116,-29,49,-78,-108,82,-118,-11,61,12,-89,47,-95,89,-53,-38,74
,-49,-94,57,56,109,124,-3,-50,-46,77,20,42,-27,29,49,-13,39,125,-84,72,-21,-57,92,82,110,107,80,-62,-22,50,-81,-128
,35,-103,62,-17,-44,-10,60,119,21,-47,106,-74,127,107,72,-107,66,73,36,-89,-53,-73,-111,-2,89,20,-9,-53,117,32,0,122
,-15,-7,-44,-29,-61,55,107,20,109,21,-3,-87,18,112,35,-107,74,110,62,-96,-82,66,-109,-111,-125,-118,-23,-61,-61,15,-117,-94
,-17,14,91,117,70,24,-41,95,1,-120,-27,-10,-100,-34,71,41,38,-5,-73,100,-73,-105,116,73,-115,-18,65,-38,-66,-72,-9,-9
,-85,-52,-16,-38,74,-16,-52,-40,96,71,-109,48,-120,4,56,57,37,-44,117,4,119,-85,90,-98,-109,-82,104,86,-116,-45,89,-50
,-80,-62,-22,-84,-15,-56,29,16,-109,-14,-116,-125,-98,73,28,-32,83,93,110,62,-46,-48,-55,97,41,120,84,-58,84,-89,-15,0
,71,-81,7,61,-3,-85,119,-124,-64,42,124,-82,90,-9,-22,97,28,94,58,117,57,-96,-81,-28,-74,43,92,-34,68,-95,-93,-76
,-102,55,119,33,-116,-127,119,42,-100,125,-44,-57,127,94,-61,-91,92,-45,124,71,121,-89,106,-10,-73,-77,76,53,4,-123,-103,82
,25,-105,10,-82,70,-46,-56,23,-8,-16,72,4,-114,11,122,-13,80,95,89,-55,-27,71,115,28,41,107,110,126,73,115,32,-110
,64,-103,1,-119,3,-116,115,-45,61,-85,-86,77,23,79,-46,-46,27,-27,-112,-51,121,110,65,18,51,18,64,4,115,-14,-3,-47
,-9,-128,-57,-88,62,-12,80,-95,-123,-108,28,105,106,-5,-111,-117,-83,-119,-116,-109,-83,117,-28,80,-44,-11,59,-33,16,-21,12,46
,33,-106,-36,-38,43,24,108,37,24,49,43,99,-9,-124,-1,0,19,55,25,61,-128,-91,-124,71,105,7,-104,-48,-76,-57,43,28
,81,-90,65,-72,-104,-16,16,122,-14,64,-4,-21,74,-10,43,11,-67,73,-92,-65,89,-30,-69,-107,66,-37,-57,2,-105,-72,-106,82
,14,25,115,-55,-55,-64,57,-7,113,-100,-10,-81,66,-16,7,-61,121,-20,13,-74,-79,-30,45,-110,-22,49,-125,-28,-37,0,60,-69
,108,-11,97,-114,11,-98,-25,-75,121,-104,-68,42,-123,95,-118,-25,-85,-125,-51,-107,60,27,-89,24,-38,71,15,-84,-8,122,111,1
,-39,91,92,107,54,122,125,-25,-37,36,85,114,38,-37,49,-99,-122,88,39,-94,32,-64,-84,120,60,97,-95,-38,94,-120,-38,109
,95,77,3,14,54,-53,-26,-87,4,103,-128,115,-41,-118,-18,60,119,-89,-36,-35,-75,-2,-71,50,-87,-68,-71,-1,0,66,-46,-29
,60,53,-67,-88,96,38,-104,3,-4,109,-99,-96,-15,-115,-21,92,-10,-97,-16,-57,82,-44,-75,59,-3,117,44,116,-19,66,-47,-28
,120,32,-73,-98,118,-127,-93,-40,-63,65,24,82,63,-121,28,-41,36,-95,78,83,-75,-75,57,97,-117,-86,-107,-71,-76,53,124,39
,28,-81,-31,-115,63,44,82,71,15,47,-52,49,-115,-50,88,112,122,-116,31,-42,-103,-96,-8,35,-60,-98,32,-75,-72,-69,-80,-42
,44,116,-87,18,-30,72,103,-73,-123,95,-17,41,-64,44,58,2,71,60,122,-43,123,-63,-85,104,-77,44,122,-113,-37,-12,-90,39
,24,-67,65,113,7,-90,86,85,-56,31,-114,41,-87,-29,-71,-68,45,-88,92,93,52,-74,-46,-115,66,56,-53,27,82,-78,-93,58
,100,22,-57,-16,-110,-91,7,-66,43,42,116,-3,-25,-50,-114,-119,57,70,55,-91,63,-21,-26,122,-108,-1,0,14,108,117,15,16
,94,-22,-102,-90,-91,-88,-34,69,116,-22,-58,-60,-51,-78,-36,5,24,80,85,112,88,15,115,-113,80,107,-86,-75,-79,-74,-79,-73
,75,123,88,35,-126,20,-5,-79,-60,-127,84,126,2,-84,81,93,-121,-105,113,49,84,53,-83,46,13,103,71,-71,-45,-82,55,8
,-89,93,-91,-109,-122,66,14,67,15,112,64,35,-36,86,-123,7,-91,0,101,-39,-23,-86,46,-115,-11,-58,26,-11,-95,88,37,117
,24,89,2,-100,-126,71,-82,73,-6,102,-76,-64,-59,32,-19,-11,-89,82,64,53,-105,112,32,-102,-62,-15,7,-125,-76,111,18,-60
,-93,81,-74,-52,-15,-116,69,117,17,-39,52,95,-18,-80,-2,-71,21,-65,69,48,78,-50,-24,-16,-3,75,-31,-114,-69,-90,-22,102
,-10,39,-113,92,-74,88,-116,41,25,43,4,-54,27,-85,30,54,-77,99,-72,-57,65,89,63,108,-80,-46,100,104,53,75,75,-69
,55,60,23,-66,-120,-62,55,-29,-125,-100,20,56,-58,115,-98,125,-79,95,65,-98,-1,0,81,84,-11,-81,-7,4,92,-1,0,-69
,93,84,113,83,-92,-71,86,-60,-42,-113,-75,124,-45,119,103,-50,94,37,-70,-78,-44,124,54,30,45,66,22,-99,111,33,119,101
,-71,86,-32,-66,-34,70,73,56,-56,38,-88,60,118,75,112,-22,53,27,52,37,-56,-53,78,-93,25,36,19,-58,126,-65,-123,117
,-38,-73,-6,-5,95,-6,-7,63,-42,-70,-99,15,-92,31,-113,-14,-84,-15,113,85,-26,-91,35,-47,-53,-79,-109,-63,70,74,-98,-73
,60,-59,108,31,81,13,105,103,12,-6,-128,40,-64,-101,27,86,101,97,-126,0,-50,0,-4,115,-40,87,87,-96,124,61,-15,102
,-95,105,109,111,121,105,6,-110,-85,8,-118,91,-71,-28,-13,-91,32,114,-90,56,-57,-54,-83,-116,12,-100,-30,-67,-97,73,-1,0
,80,127,10,-67,-34,-77,-92,-27,70,-22,12,-49,25,-116,-98,49,-87,84,75,67,-100,-16,-57,-126,52,-81,11,-60,-17,111,-26,92
,-33,77,-52,-41,-41,36,60,-78,123,103,-80,-28,-16,43,-94,72,-62,12,12,1,-40,1,-46,-98,58,81,73,-74,-11,103,33,-119
,63,-121,-83,47,117,59,-101,-53,-64,39,105,17,35,-115,88,113,26,-85,110,24,-1,0,-127,0,-33,80,61,42,-18,-99,-90,-59
,-90,105,-47,-38,68,-52,-54,-123,-114,-25,3,36,-110,78,78,62,-75,115,-65,-29,78,-19,83,101,123,-127,4,-111,-93,13,-82,55
,43,12,50,-80,-56,63,-123,114,-70,-57,-62,-1,0,7,-21,-41,43,115,123,-93,66,37,-25,45,8,-14,-73,103,-71,-37,-116,-102
,-23,-41,-18,67,-1,0,93,15,-11,-85,67,-91,48,63,-1,-39 };
}


JavaPic_homeworkjpg.java
-------------------------------------------------------------------
// JavaPic_homeworkjpg.java

import javax.swing.*;
import java.awt.*;

//Raw image data:

public class JavaPic_homeworkjpg{
public static ImageIcon getImageIcon() {
if (imageIcon == null) { imageIcon = new ImageIcon(bytes); }
return imageIcon;
}
public static Image getImage() { return getImageIcon().getImage(); }
private static ImageIcon imageIcon;
private static byte[] bytes = {
-1,-40,-1,-32,0,16,74,70,73,70,0,1,1,1,0,96,0,96,0,0,-1,-31,0,22,69,120,105,102,0,0,73,73
,42,0,8,0,0,0,0,0,0,0,0,0,-1,-37,0,67,0,8,6,6,7,6,5,8,7,7,7,9,9,8,10,12
,20,13,12,11,11,12,25,18,19,15,20,29,26,31,30,29,26,28,28,32,36,46,39,32,34,44,35,28,28,40,55,41
,44,48,49,52,52,52,31,39,57,61,56,50,60,46,51,52,50,-1,-37,0,67,1,9,9,9,12,11,12,24,13,13,24
,50,33,28,33,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50
,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,-1,-64,0,17,8,0,64,0,67,3
,1,34,0,2,17,1,3,17,1,-1,-60,0,31,0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1
,2,3,4,5,6,7,8,9,10,11,-1,-60,0,-75,16,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125,1
,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,-127,-111,-95,8,35,66,-79,-63,21,82,-47,-16,36
,51,98,114,-126,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74
,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,-125,-124,-123,-122,-121,-120,-119,-118
,-110,-109,-108,-107,-106,-105,-104,-103,-102,-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,-72,-71,-70,-62,-61,-60,-59,-58
,-57,-56,-55,-54,-46,-45,-44,-43,-42,-41,-40,-39,-38,-31,-30,-29,-28,-27,-26,-25,-24,-23,-22,-15,-14,-13,-12,-11,-10,-9,-8,-7
,-6,-1,-60,0,31,1,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9
,10,11,-1,-60,0,-75,17,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119,0,1,2,3,17,4,5,33,49
,6,18,65,81,7,97,113,19,34,50,-127,8,20,66,-111,-95,-79,-63,9,35,51,82,-16,21,98,114,-47,10,22,36,52,-31
,37,-15,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89
,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,-126,-125,-124,-123,-122,-121,-120,-119,-118,-110,-109,-108,-107,-106,-105
,-104,-103,-102,-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,-72,-71,-70,-62,-61,-60,-59,-58,-57,-56,-55,-54,-46,-45
,-44,-43,-42,-41,-40,-39,-38,-30,-29,-28,-27,-26,-25,-24,-23,-22,-14,-13,-12,-11,-10,-9,-8,-7,-6,-1,-38,0,12,3,1,0
,2,17,3,17,0,63,0,-9,-50,-12,98,-108,-45,104,0,38,-72,-33,16,124,65,-77,-46,110,90,-42,-54,21,-65,-72,-115,-39
,102,-3,-17,-105,26,21,7,43,-72,6,44,-7,-62,-31,65,0,-109,-72,-82,43,79,-58,111,-87,-81,-123,111,83,69,55,3,82
,-104,36,54,-19,2,110,101,103,112,-69,-71,-31,84,100,-110,-33,-62,1,61,-85,-64,-84,45,31,79,-15,21,-74,-119,117,101,36
,55,-111,-52,22,-26,43,114,-83,-28,-110,-84,-22,-101,-57,-53,-67,-62,12,117,-5,-60,-110,8,-59,101,86,82,-118,-9,81,-67,8
,66,78,-13,127,-16,78,-33,84,-8,-125,-81,-22,-14,-51,103,111,105,-10,59,99,41,-64,-115,-56,-97,-53,-57,8,-18,14,16,-100
,22,37,78,112,64,24,-63,99,6,-101,30,-87,111,42,106,22,-105,54,-47,-53,110,94,88,82,-19,37,-107,85,-103,25,71,59
,-63,11,-55,-54,-14,62,96,112,72,-84,-81,9,90,-58,-2,41,-105,75,-44,-12,-72,26,96,30,-31,-31,-106,-35,-39,-19,87,119
,82,-27,-74,-116,-110,-39,43,-72,54,-31,-126,0,-64,-126,117,-44,99,-44,53,123,-85,52,72,-84,-84,46,-28,-73,82,-58,104,97
,105,-125,-120,-43,113,-110,28,22,104,-55,7,0,-115,-8,0,-14,49,78,110,127,23,-7,29,92,-44,84,57,121,79,112,-16,-41
,-120,45,-4,75,-93,-82,-93,111,13,-60,8,100,120,-103,39,77,-84,-82,-89,12,49,-41,-82,71,56,60,116,21,-82,64,-82,123
,-63,81,-68,94,13,-46,-52,-111,-92,114,-51,0,-99,-43,35,-40,3,72,119,-111,-114,-71,-7,-71,39,-110,121,60,-102,-33,-49,60
,-118,-21,60,-10,33,28,-1,0,-11,-24,-93,-118,40,2,90,78,104,39,-109,73,-69,-42,-127,13,111,78,-75,-29,-66,47,-76,-121
,79,-44,53,-83,77,-31,-34,-6,30,-93,109,-85,-59,34,-29,115,69,50,-86,-51,9,61,-114,81,-100,15,116,-11,-81,84,-42,53
,72,116,-115,42,-30,-2,117,119,88,87,43,26,125,-23,24,-100,42,47,-5,76,-60,40,-9,34,-68,-93,-59,-45,-34,-23,126,31
,-73,-117,-19,49,127,106,-33,-33,-117,-21,-71,4,98,69,38,60,57,-64,36,110,85,113,4,107,-98,-37,115,-34,-77,-87,36,-76
,125,77,-24,-46,-107,73,90,43,95,-44,-22,-75,57,-92,107,43,123,-8,46,-31,-74,-120,-94,-113,48,-39,60,-18,-22,-40,-37,-79
,84,-125,-97,-88,110,-93,-114,43,42,75,83,-82,92,-8,123,66,-99,-82,103,19,-36,29,70,-15,47,-93,93,-51,109,19,-77,13
,-24,48,0,105,12,96,46,58,112,70,65,21,-58,120,127,95,-97,72,-73,48,-59,119,126,-111,3,-71,34,-123,-83,-103,48,88
,-110,-126,57,112,99,-58,64,27,11,41,-21,-127,-9,107,58,61,67,83,-2,-47,-97,86,-68,-69,-71,107,-7,-39,119,-51,107,117
,37,-71,42,-65,117,21,83,106,-32,14,-103,7,-87,36,115,92,-47,-28,-117,-69,103,-87,28,-69,23,85,-72,40,-37,-41,99,-23
,81,-17,75,-118,-29,62,29,120,-79,-4,71,-94,-67,-75,-12,-30,77,94,-60,-124,-71,33,118,-17,86,-55,-114,76,14,62,101,28
,-29,-72,60,14,-107,-39,-125,-17,93,-87,-36,-15,-25,23,9,56,-53,116,24,-94,-116,-97,90,40,32,14,57,-26,-104,122,83,-40
,-11,-84,15,21,120,-110,-33,-62,-6,57,-44,39,67,51,-76,-117,12,16,41,-61,77,35,30,20,126,25,39,-48,3,64,-47,-119
,125,118,-102,-33,-120,-28,63,122,-45,73,-109,-53,-121,-114,30,-21,24,-111,-3,-10,6,-40,15,98,100,-12,24,-15,-67,127,-60,77
,-30,15,18,73,20,123,101,-120,-4,-79,54,-51,-37,34,-50,23,3,-79,115,-105,-9,12,-71,-5,-94,-89,-70,-15,92,-9,94,22
,-121,70,-79,-70,75,89,4,101,111,-82,-29,-111,101,121,75,103,121,81,-58,55,-77,51,18,112,70,122,86,126,-117,-32,-5,-51
,65,30,-25,77,58,-123,-45,111,9,112,109,-116,113,0,-22,7,5,-92,56,-49,-15,112,78,51,-48,87,13,-100,-91,41,61,-10
,94,-121,-81,-124,-100,112,-13,-116,-28,-76,95,-103,118,52,73,25,-15,42,-7,104,6,54,-114,114,72,-5,-93,-87,60,-11,-84,-83
,126,77,70,9,109,-25,-73,-114,-18,70,69,118,-68,-118,56,-104,-94,71,-14,-19,36,-114,56,-36,-67,-1,0,-119,71,122,-34,-68
,-16,-74,-91,97,-90,-49,-88,-36,105,-9,-80,67,104,-122,70,-110,-22,-2,18,-127,123,-100,70,-24,-60,-14,48,7,36,-127,-41,56
,-88,-76,-120,-126,106,81,106,119,-58,-30,-33,72,-124,-85,-53,60,-113,35,36,-52,-83,-66,24,-45,127,-51,33,-35,-27,-110,20,31
,-11,96,30,-76,-108,121,29,-28,-113,75,23,-101,42,-80,80,-94,-20,-12,-44,-20,124,47,-31,-37,-33,15,120,-109,64,-44,-30,-72
,-111,-82,-17,101,123,43,-53,71,-38,17,32,49,-68,-72,-56,25,-36,-122,60,-109,-100,19,-64,-64,53,-20,106,79,-95,-81,24,-45
,-68,94,-65,-16,-108,89,-22,-110,35,-37,-39,64,-51,9,-118,64,55,36,18,1,-66,71,-21,-122,12,34,56,7,-27,84,110,-91
,-115,123,42,-80,-38,8,57,7,-111,-125,-42,-70,48,-14,-68,53,103,-127,-117,-25,117,92,-89,-69,36,-51,20,-51,-33,95,-54,-118
,-34,-25,40,-53,-85,-120,-19,96,-106,-30,105,22,40,98,66,-14,72,-57,1,20,2,73,62,-64,3,95,49,120,-57,-60,-73,-34
,52,-41,30,-24,-93,-83,-124,121,-118,24,-55,33,109,-30,108,-32,-74,-48,126,103,-40,11,17,-2,-17,96,107,-46,-66,33,-22,90
,-9,-120,-82,37,-48,-12,93,43,84,107,24,-92,41,113,48,-75,-111,22,119,4,112,24,-82,10,3,-17,-13,17,-98,-128,110,-31
,-26,-8,127,-30,89,21,-118,-8,110,102,11,-14,-18,-107,-48,-71,25,60,-113,-104,96,28,-98,49,89,78,78,-10,72,-23,-93,8
,-14,-13,54,-109,48,52,109,42,-17,90,-43,-83,-20,32,46,-62,38,49,-57,-104,-56,69,36,16,-57,-100,18,-95,23,39,-90,71
,24,-56,-25,-43,-18,110,-20,44,-76,-37,125,54,-58,-29,74,123,24,-45,-54,70,-105,84,16,-74,-27,32,-97,-103,65,57,57,-55
,57,-50,79,35,-109,92,-50,-109,-94,-8,-69,-61,115,79,113,103,-31,-7,33,-114,72,-60,106,-65,101,89,-39,64,98,-60,15,45
,-78,-71,36,103,-125,-9,69,88,-5,119,-60,65,43,60,58,93,-6,59,14,90,45,38,53,44,57,32,18,-15,-109,-128,79,-83
,84,101,103,-51,37,-88,-89,11,-5,-79,106,-53,-52,-45,-44,111,109,-83,-4,35,117,-87,-38,-101,105,-1,0,-77,-82,97,-70,-103
,33,-44,100,-69,73,22,55,86,10,29,-122,87,57,56,56,61,6,123,-29,27,-60,19,-22,-70,-28,-70,45,-35,-43,-70,-38,-59
,60,38,-26,-46,-40,57,118,46,-61,25,-107,-56,1,72,70,-56,80,15,-34,110,114,42,-19,-2,-99,-15,67,90,-46,-90,-77,-98
,-50,115,111,113,19,69,34,-56,-42,81,-110,-84,8,110,48,8,-32,-6,-126,42,107,-113,6,-4,72,-42,-31,-73,-113,80,-67,-80
,-115,33,-108,76,-119,33,-119,10,48,82,-93,-104,-93,60,96,-111,-128,113,-51,103,90,-100,106,-85,-37,82,-88,-73,74,90,-75,99
,-128,-75,-42,117,43,-69,-108,-77,-76,-118,28,-110,70,-62,119,-106,27,-16,-49,-112,-40,83,-24,24,1,-114,-28,-29,62,-55,-16,-9
,94,104,-57,-4,35,-105,-52,-62,104,-108,-67,-96,117,35,17,-113,-7,100,15,125,-93,5,121,-50,-45,-113,-32,38,-79,-83,126,20
,106,-2,104,123,-99,75,79,79,-108,3,-75,36,-112,-25,-65,-9,115,-41,-118,-38,-46,-2,27,-33,88,95,-38,93,63,-120,-125,52
,23,17,77,-124,-78,-37,-72,33,-5,-71,46,112,10,-27,78,59,26,-58,-107,42,-112,-102,105,36,-67,77,106,-43,-89,56,52,-28
,-37,-23,-95,-24,31,-115,20,-17,-62,-118,-20,56,15,-1,-39 };
}


JavaPic_hqjpg.java
-------------------------------------------------------------------
// JavaPic_hqjpg.java

import javax.swing.*;
import java.awt.*;

//Raw image data:

public class JavaPic_hqjpg{
public static ImageIcon getImageIcon() {
if (imageIcon == null) { imageIcon = new ImageIcon(bytes); }
return imageIcon;
}
public static Image getImage() { return getImageIcon().getImage(); }
private static ImageIcon imageIcon;
private static byte[] bytes = {
-1,-40,-1,-32,0,16,74,70,73,70,0,1,1,1,0,96,0,96,0,0,-1,-31,0,22,69,120,105,102,0,0,73,73
,42,0,8,0,0,0,0,0,0,0,0,0,-1,-37,0,67,0,8,6,6,7,6,5,8,7,7,7,9,9,8,10,12
,20,13,12,11,11,12,25,18,19,15,20,29,26,31,30,29,26,28,28,32,36,46,39,32,34,44,35,28,28,40,55,41
,44,48,49,52,52,52,31,39,57,61,56,50,60,46,51,52,50,-1,-37,0,67,1,9,9,9,12,11,12,24,13,13,24
,50,33,28,33,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50
,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,-1,-64,0,17,8,0,78,0,85,3
,1,34,0,2,17,1,3,17,1,-1,-60,0,31,0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1
,2,3,4,5,6,7,8,9,10,11,-1,-60,0,-75,16,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125,1
,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,-127,-111,-95,8,35,66,-79,-63,21,82,-47,-16,36
,51,98,114,-126,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74
,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,-125,-124,-123,-122,-121,-120,-119,-118
,-110,-109,-108,-107,-106,-105,-104,-103,-102,-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,-72,-71,-70,-62,-61,-60,-59,-58
,-57,-56,-55,-54,-46,-45,-44,-43,-42,-41,-40,-39,-38,-31,-30,-29,-28,-27,-26,-25,-24,-23,-22,-15,-14,-13,-12,-11,-10,-9,-8,-7
,-6,-1,-60,0,31,1,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9
,10,11,-1,-60,0,-75,17,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119,0,1,2,3,17,4,5,33,49
,6,18,65,81,7,97,113,19,34,50,-127,8,20,66,-111,-95,-79,-63,9,35,51,82,-16,21,98,114,-47,10,22,36,52,-31
,37,-15,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89
,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,-126,-125,-124,-123,-122,-121,-120,-119,-118,-110,-109,-108,-107,-106,-105
,-104,-103,-102,-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,-72,-71,-70,-62,-61,-60,-59,-58,-57,-56,-55,-54,-46,-45
,-44,-43,-42,-41,-40,-39,-38,-30,-29,-28,-27,-26,-25,-24,-23,-22,-14,-13,-12,-11,-10,-9,-8,-7,-6,-1,-38,0,12,3,1,0
,2,17,3,17,0,63,0,-9,-82,-92,82,-30,-109,112,2,-108,26,0,118,63,10,58,83,115,-7,-45,75,-86,-87,102,32,1
,-55,39,-75,0,101,-8,-93,85,58,47,-122,-17,-75,5,-110,40,-98,24,-119,73,38,42,17,88,-112,-86,78,-9,64,70,72,-29
,112,-49,65,-109,-128,79,11,93,-36,106,30,22,-45,110,-18,-34,87,-71,-102,5,121,76,-79,24,-114,-13,-55,27,74,-87,0,28
,-127,-14,-116,-128,15,57,-55,-62,-41,-4,73,6,-69,-31,-51,83,79,-16,-11,-67,-50,-87,113,115,105,52,48,-51,110,-127,109,-9
,-78,16,8,-102,66,-88,-64,30,-69,25,-120,-63,-85,-97,-16,-108,95,6,40,-70,3,0,6,68,109,125,10,-72,25,-58,72,-50
,-36,113,-39,-113,74,10,81,111,-95,-44,-113,90,90,-57,-47,53,-49,-19,103,-68,-122,75,25,-84,-82,45,36,84,-110,25,89,31
,-17,40,96,-63,-112,-112,71,36,122,-16,107,95,52,18,41,-93,28,98,-110,-106,-128,10,40,-94,-128,33,32,-25,-6,-26,-116,55
,106,127,-67,33,20,12,110,72,-29,-87,-82,91,-58,-88,-105,77,-95,89,-53,16,-102,9,-11,3,-25,91,-77,97,38,85,-73,-103
,-107,92,116,101,18,8,-50,14,70,64,-30,-70,-110,9,25,28,14,-28,10,-30,60,111,116,45,-75,-83,53,-38,100,79,38,-42
,-30,64,100,-31,85,-53,-62,21,-104,-10,80,4,-103,-10,-49,124,81,-79,116,-29,-51,52,-114,107,-61,-9,54,-112,91,94,-22,-81
,-82,-35,-33,90,-82,-57,119,-67,73,-94,84,93,-69,-110,64,-82,-51,-115,-55,40,-27,70,8,0,-32,96,-42,116,26,103,-121,116
,-1,0,13,-49,109,-10,-37,-104,-83,110,111,32,-74,43,34,64,-60,-51,26,9,20,99,96,-119,-125,32,5,-104,-125,-65,36,22
,99,-127,87,-4,46,-34,87,-121,102,-121,118,-112,-53,34,74,96,123,115,9,-74,109,-79,-95,-60,-83,18,42,-111,-26,9,9,27
,119,5,28,-25,-125,73,-89,-74,-67,113,-93,-87,-78,-113,78,-110,38,-69,5,-28,-46,30,12,60,101,7,42,-58,54,-116,-71,-105
,0,-27,121,7,24,7,-102,87,58,44,-46,94,-121,75,-16,-18,59,59,121,-17,-93,-45,103,-110,123,6,-76,-78,-106,25,101,24
,103,12,-78,96,-3,-43,-29,96,-116,1,-76,96,12,96,98,-69,-51,-58,-68,-17,-61,-30,-3,96,-41,35,-69,127,34,-9,-5,34
,-37,-52,48,-31,76,114,15,-76,-95,35,111,0,-126,-125,-107,-29,35,-127,-128,43,-116,-47,124,49,-30,-37,-10,-122,-23,45,-82,45
,-123,-18,-104,-78,29,70,45,85,-128,-106,87,64,98,121,112,-37,-40,-58,75,48,-31,-7,32,116,57,-85,73,53,123,-100,-50,55
,-109,-71,-17,27,-71,-89,123,-44,40,-57,-65,-8,84,-99,-70,84,-112,46,77,20,113,-34,-118,0,110,125,43,-119,-15,-114,-77,-87
,-39,107,-74,22,86,-41,-46,88,65,53,-68,-114,-110,-58,-111,-79,-102,85,101,-7,78,-12,110,21,121,32,96,-99,-39,4,109,53
,-40,-53,63,-106,79,-53,-100,12,-98,107,-53,-68,95,115,-28,-8,-100,95,95,69,36,-106,-78,64,-90,-46,-32,-60,-59,45,118,-110
,30,50,84,16,-91,-114,27,113,-58,-20,-19,-49,-56,-75,-49,94,-81,44,31,46,-30,-70,51,-27,-113,125,-37,95,-34,91,-115,67
,86,-34,103,55,48,22,-73,-103,-119,86,-60,113,-54,-83,-66,53,-37,-14,5,-35,-116,114,114,114,74,120,-117,81,-114,-2,8,-115
,-27,-53,-33,-79,-46,45,5,-61,-60,-115,27,-49,38,-5,-124,-107,118,0,25,126,117,59,-122,1,24,35,2,-88,-63,-83,105,83
,77,17,58,-76,17,121,-32,-104,-104,-54,-111,-107,-52,121,13,-103,71,-56,112,-64,-126,-32,3,-58,51,-70,-79,-18,-81,-123,-75,-43
,-68,-34,116,81,-72,-114,-34,57,-89,121,-68,-77,41,36,-36,52,-69,-74,-79,79,51,-49,36,96,112,27,3,-89,24,-31,37,81
,-87,58,-121,69,37,-17,-93,-87,-75,-13,37,-78,-43,-46,-26,-58,-18,-18,89,97,-97,-49,-114,54,-97,-52,-66,5,35,-113,35,122
,-7,-128,109,-62,116,39,41,-111,-72,-98,106,-55,29,-100,-42,19,61,-50,-113,-84,109,107,-35,-50,-71,-106,-32,-76,-126,23,-116,-69
,-75,-62,110,-14,-52,121,95,-103,1,-56,-32,96,3,79,-73,-110,-23,116,70,121,111,35,75,-42,1,98,-102,89,-60,-125,105,-111
,0,10,-26,51,-66,79,40,50,-85,21,37,-119,-50,13,38,-93,46,-87,-3,-102,-42,87,26,-107,-123,-83,-7,-72,32,-77,-35,36
,70,104,-10,72,16,6,-14,121,101,15,25,56,64,112,-89,-91,117,-93,-82,80,-47,43,116,-19,-26,85,-102,-26,-35,100,-122,-31
,69,-4,86,118,-6,45,-69,52,17,-36,74,-110,4,81,43,114,21,-44,25,0,60,-28,-98,115,-109,91,86,-53,105,104,-111,-37
,65,103,-81,90,76,-105,11,99,29,-123,-66,-85,41,116,127,40,-56,21,64,-100,69,-76,34,-18,-21,-114,72,60,-116,14,115,81
,-102,104,53,-101,-59,-123,96,121,103,-77,-73,123,-111,112,-119,-79,-117,72,-62,82,85,-103,16,-126,-116,120,44,-96,-15,-45,60,107
,-35,11,-120,-76,8,-94,-1,0,-124,103,74,40,-90,121,-34,-50,45,36,92,-61,-67,11,121,67,-53,-115,-36,33,116,35,46,11
,-123,57,25,61,-38,108,85,98,-110,73,46,-97,-87,-33,-8,23,85,-109,85,-16,-32,-102,91,-103,-82,-68,-71,-28,-114,57,-25,80
,36,-110,44,-18,-120,-72,0,13,-34,91,-96,60,117,21,-44,-87,-56,-82,51,-63,111,28,26,117,-46,91,-58,99,-123,-75,9,-60
,113,-107,-39,-27,-86,-111,24,93,-67,-79,-77,-91,117,-112,51,-99,-39,61,-6,14,-108,115,-85,-39,30,123,-75,-20,89,-51,20,-34
,59,-15,69,80,-118,-14,15,-104,-28,-73,-1,0,91,-4,-26,-80,53,43,-72,-76,-53,75,-117,-85,-115,-62,27,120,-98,73,24,115
,-14,40,44,-33,94,22,-70,9,39,-124,6,47,42,-95,94,14,-10,3,31,-99,112,-65,17,-30,-43,110,116,115,101,-91,-39,75
,113,-10,-57,16,-36,73,25,83,-27,71,-43,-127,4,-127,-121,31,47,-96,5,-119,35,21,-55,94,-101,104,-105,27,-76,112,-34,9
,38,-57,-60,122,66,-54,-78,121,-115,97,45,-72,124,-110,85,-43,97,39,36,118,-60,108,49,-17,-19,89,-38,-35,-24,95,23,106
,87,-104,-36,-54,-49,58,-72,-71,-14,94,35,111,18,-58,-52,-92,48,-53,124,-124,5,-17,-97,-53,116,-8,127,90,-45,117,29,34
,-17,-5,38,105,77,-68,-7,-98,68,-71,-115,-28,17,-78,-104,-33,-128,114,114,31,118,1,32,108,60,-12,-51,-19,127,-63,79,-88
,92,125,-77,76,-106,37,-110,102,6,-30,9,-107,-116,109,38,-17,-103,-127,0,-108,39,-87,-64,108,-29,56,-55,36,-13,-58,-94,-116
,-105,51,-35,126,-89,125,74,-12,-93,-119,-26,79,70,-84,113,51,-22,-102,94,-100,-10,54,-9,-94,69,-122,21,2,-43,6,36,48
,12,20,37,-125,-122,82,-89,32,16,-53,-55,7,-114,43,106,-8,-38,-115,46,56,55,95,-38,-101,91,41,-19,-73,91,-58,37,49
,-37,42,68,-82,37,5,88,-88,-38,-79,-110,64,83,-110,72,-18,43,-114,-42,116,77,75,86,-44,39,-71,-126,-59,-52,82,34,-37
,68,-47,56,-102,57,14,118,33,87,-56,-56,121,115,-76,-100,3,-107,35,35,2,-67,9,-68,49,-85,-22,50,-123,-105,70,-74,-119
,8,36,79,-88,-54,-116,85,91,27,-80,35,103,102,36,40,-56,33,51,-114,72,-26,-70,-66,31,-119,-40,-24,-87,94,-109,-69,-45
,-95,-64,120,-10,121,45,110,46,-84,68,-5,75,-76,2,-30,35,40,-55,0,62,20,-81,4,-128,99,83,-36,2,6,78,113,90
,-38,84,-106,-73,-70,13,-67,-100,-70,-50,-99,30,-40,103,-73,-123,103,-99,-102,72,-128,-107,-126,-76,106,-84,9,109,-95,64,-56,57
,-64,-62,-98,-107,-41,27,25,97,-69,-71,121,-18,-66,-36,-34,112,-1,0,87,23,-110,-110,-50,-68,34,40,-36,112,21,-33,25,37
,-78,-46,-65,10,80,87,99,-92,91,-115,31,75,-74,-45,-95,99,-28,71,18,-87,42,49,-71,-128,25,118,3,-71,57,36,-9,39
,52,85,-81,26,105,75,-71,-59,60,82,-20,71,-31,116,-103,108,21,-18,45,-27,-126,73,-25,-71,-72,-14,-27,77,-82,-85,36,-14
,74,-95,-41,-77,5,112,8,-19,-46,-69,24,119,43,15,66,48,72,-10,-82,110,75,-53,91,22,-122,75,-55,-124,66,73,-106,24
,-9,103,47,33,-2,16,59,-15,-109,-12,82,122,2,107,66,-41,80,-70,-67,86,49,39,-39,-30,-24,25,-41,44,122,-4,-40,-19
,-37,-113,-15,21,24,105,57,-34,71,36,93,-18,-51,-33,-25,69,82,117,-66,-62,-120,-37,106,-127,-114,64,44,125,-55,61,-2,-108
,87,89,101,-119,96,-118,117,-37,34,-122,31,-111,-4,-59,121,102,-87,-31,-83,90,-58,-1,0,-19,87,90,89,-103,84,97,-75,29
,27,119,-100,80,103,104,49,-85,-84,-93,-99,-68,33,-109,-128,123,100,87,-84,17,-49,90,49,-7,98,-104,30,61,14,-89,126,-120
,69,-82,-76,46,-107,1,-13,-95,-72,-73,89,36,-123,-79,-9,90,53,49,-54,-99,63,-120,19,-21,-23,72,-6,-2,-93,127,-78,-50
,101,-78,-126,-38,108,9,-28,-73,-71,119,50,-90,51,-77,107,34,16,27,-27,4,-13,-14,-106,0,-126,65,30,-93,-86,120,127,72
,-42,-118,-99,75,77,-75,-70,101,24,73,36,-116,23,78,-1,0,43,125,-27,-4,8,-84,91,-65,0,-40,76,-123,97,-44,-75,104
,51,-39,-82,-66,-48,8,-2,-18,39,15,-14,-5,116,-84,-67,-123,46,110,107,106,46,88,-34,-25,31,105,51,-37,-22,55,-73,55
,118,55,-73,-96,73,-70,-42,-26,-43,82,72,-114,64,86,112,-95,-73,111,109,-60,12,-128,66,-28,47,5,-9,79,123,-30,83,6
,-99,36,-112,-23,-102,-125,-52,3,125,-100,-51,108,66,121,-99,-73,48,-29,102,-19,-71,57,-24,79,25,-21,-81,113,-32,77,80,74
,-46,90,107,54,44,67,22,-39,115,-89,-98,73,-29,-86,72,-96,116,31,-61,76,79,9,107,-78,-85,-50,98,-16,-4,-82,-21,-75
,-111,-42,112,24,-114,58,-106,96,7,25,-24,126,-107,53,48,-76,-22,75,-102,66,112,77,-35,-104,66,-18,61,54,59,41,-83,-19
,101,-44,86,3,36,-110,-55,20,-111,-122,45,-76,-123,-36,36,116,-55,98,-27,-114,-36,-28,-81,79,89,-65,-73,-75,43,-104,-28,-118
,40,108,44,20,31,44,52,-46,-76,-14,41,-20,118,-82,-44,30,-60,59,15,99,-72,103,-96,-113,-61,62,39,44,-69,-91,-16,-12
,42,-93,104,99,104,-13,-112,49,-116,117,67,-8,103,-81,62,-43,106,-33,-63,-109,-54,-56,-38,-114,-75,43,-124,24,88,-76,-5,100
,-76,64,51,-98,24,110,-112,28,-9,18,3,90,78,-115,57,73,57,43,-115,-59,61,-50,46,-19,26,29,82,-54,87,-98,105,-11
,60,31,40,-123,51,92,55,24,37,81,70,-32,-103,4,-4,-88,-111,-28,-28,-25,-125,94,-117,-31,-53,125,73,96,-110,77,74,-42
,11,100,-34,62,-51,0,-61,74,-118,6,51,35,41,41,-109,-98,21,114,20,15,-68,-39,-30,-2,-103,-94,-23,-38,66,72,-74,22
,-111,-62,101,109,-46,-56,57,121,91,-5,-50,-25,44,-25,-35,-119,53,127,-128,113,87,-90,-56,98,109,20,82,-32,81,64,31,-1
,-39 };
}


JavaPic_instructionjpg.java
-------------------------------------------------------------------
// JavaPic_instructionjpg.java

import javax.swing.*;
import java.awt.*;

// Raw image data:

public class JavaPic_instructionjpg{
public static ImageIcon getImageIcon() {
if (imageIcon == null) { imageIcon = new ImageIcon(bytes); }
return imageIcon;
}
public static Image getImage() { return getImageIcon().getImage(); }
private static ImageIcon imageIcon;
private static byte[] bytes = {
-1,-40,-1,-32,0,16,74,70,73,70,0,1,1,1,0,96,0,96,0,0,-1,-31,0,22,69,120,105,102,0,0,73,73
,42,0,8,0,0,0,0,0,0,0,0,0,-1,-37,0,67,0,8,6,6,7,6,5,8,7,7,7,9,9,8,10,12
,20,13,12,11,11,12,25,18,19,15,20,29,26,31,30,29,26,28,28,32,36,46,39,32,34,44,35,28,28,40,55,41
,44,48,49,52,52,52,31,39,57,61,56,50,60,46,51,52,50,-1,-37,0,67,1,9,9,9,12,11,12,24,13,13,24
,50,33,28,33,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50
,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,-1,-64,0,17,8,0,59,0,71,3
,1,34,0,2,17,1,3,17,1,-1,-60,0,31,0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1
,2,3,4,5,6,7,8,9,10,11,-1,-60,0,-75,16,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125,1
,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,-127,-111,-95,8,35,66,-79,-63,21,82,-47,-16,36
,51,98,114,-126,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74
,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,-125,-124,-123,-122,-121,-120,-119,-118
,-110,-109,-108,-107,-106,-105,-104,-103,-102,-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,-72,-71,-70,-62,-61,-60,-59,-58
,-57,-56,-55,-54,-46,-45,-44,-43,-42,-41,-40,-39,-38,-31,-30,-29,-28,-27,-26,-25,-24,-23,-22,-15,-14,-13,-12,-11,-10,-9,-8,-7
,-6,-1,-60,0,31,1,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9
,10,11,-1,-60,0,-75,17,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119,0,1,2,3,17,4,5,33,49
,6,18,65,81,7,97,113,19,34,50,-127,8,20,66,-111,-95,-79,-63,9,35,51,82,-16,21,98,114,-47,10,22,36,52,-31
,37,-15,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89
,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,-126,-125,-124,-123,-122,-121,-120,-119,-118,-110,-109,-108,-107,-106,-105
,-104,-103,-102,-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,-72,-71,-70,-62,-61,-60,-59,-58,-57,-56,-55,-54,-46,-45
,-44,-43,-42,-41,-40,-39,-38,-30,-29,-28,-27,-26,-25,-24,-23,-22,-14,-13,-12,-11,-10,-9,-8,-7,-6,-1,-38,0,12,3,1,0
,2,17,3,17,0,63,0,-9,-54,51,73,-113,122,-81,125,123,103,-89,91,53,-51,-11,-44,54,-42,-21,-9,-91,-98,64,-118,63
,19,-59,0,89,-56,-91,-51,113,26,-97,-60,-19,3,79,25,-127,47,47,-70,-13,4,65,23,-113,70,-112,-88,63,-122,105,-102,103
,-59,111,14,-33,-54,86,116,-66,-45,-109,32,9,-17,34,81,17,39,-79,116,102,85,-6,-79,3,-34,-89,-98,55,-75,-51,61,-108
,-19,123,59,29,-43,20,-118,-31,-108,50,-112,84,-116,-126,15,4,82,-116,-43,25,-120,125,43,-110,58,-99,-34,-77,117,60,-74,122
,-123,-51,-74,-97,12,-122,24,77,-78,71,-70,-27,-127,-61,-66,-23,21,-122,-52,-27,70,0,-50,-46,114,65,21,103,-58,26,-80,-76
,-79,26,116,83,-76,119,55,74,-59,-102,50,67,-57,2,-29,-51,96,123,28,16,-86,127,-68,-32,-13,-125,85,52,-21,59,125,39
,78,19,93,-55,13,-78,-122,15,57,46,2,-90,120,84,-6,40,-38,-96,123,10,105,105,112,36,-78,-66,-44,109,-68,67,-90,-40
,-66,-95,53,-28,119,107,59,74,-105,41,31,-18,-42,53,95,-103,25,17,114,119,58,12,16,114,9,60,99,-110,-105,-62,58,84
,-115,99,97,-86,-34,-35,95,77,120,-112,-53,22,46,79,31,51,0,-52,50,-95,-80,-34,90,-80,-49,24,35,0,81,73,-127,-109
,-29,-1,0,-120,50,120,105,-1,0,-77,-76,-40,-19,-97,80,100,73,26,75,-121,-7,34,86,36,112,-93,-106,111,-108,-15,-57,80
,121,-24,124,-128,-8,-126,-17,81,-44,126,-39,-83,93,92,92,-52,8,2,81,38,118,41,35,56,27,65,81,-45,-124,92,-98,-75
,-22,-66,35,-8,97,113,-30,111,21,-35,-22,115,-22,-55,107,105,46,-51,-117,12,27,-90,-64,-115,84,-115,-60,-32,114,9,-50,15
,90,-106,-49,-32,-25,-122,-83,-121,-17,-89,-44,-18,-119,-17,45,-64,94,126,-88,-86,127,90,-25,-87,10,-109,118,-24,119,-47,-85,66
,-108,111,-68,-114,67,78,-45,-76,-23,-47,110,96,75,89,19,27,-68,-59,96,115,-127,-3,-30,-63,-121,-45,-88,-85,-51,-89,90,-84
,50,43,-61,10,-73,-34,-56,95,-101,-45,3,119,92,-13,-4,60,3,91,-70,-25,-125,-76,-17,11,-23,-117,125,-91,71,52,118,49
,73,-70,-2,39,-107,-26,59,14,7,-100,-69,-55,33,-109,-126,113,-116,-90,-32,121,11,-118,-30,-37,109,-3,-51,-75,-53,-99,-79,68
,-77,35,-59,-99,-50,-92,16,64,3,-8,-125,47,65,-109,-122,90,-27,-87,71,-39,-67,13,-31,-119,-25,87,38,-16,62,-72,116,123
,-85,125,10,121,-53,-23,-105,14,-55,98,-14,41,83,111,39,-34,16,19,-35,10,-110,83,-72,-38,87,-5,-94,-67,47,38,-68,-82
,13,6,-50,-14,-37,82,-73,115,112,-81,114,-32,71,-79,0,-14,-80,20,44,-117,-112,8,101,43,-100,-28,-14,59,114,43,-88,-125
,-59,82,-97,6,93,106,18,66,-89,86,-77,6,-42,107,97,-45,-19,-128,-124,84,29,56,102,100,32,-1,0,117,-63,-82,-54,21
,57,-43,-70,-100,53,-32,-108,-82,-116,116,-109,-5,87,-59,51,-76,-125,38,75,-73,-36,87,-26,-60,54,-60,42,40,35,-79,-109,-26
,-6,-56,-62,-82,-22,-74,-41,122,-19,-39,-47,-96,-125,109,-86,24,-102,-12,-103,-4,-65,54,23,-36,-92,1,-126,-35,-119,4,99,44
,-96,116,36,-118,26,41,77,22,-58,-10,-3,-28,105,60,-94,-106,48,-86,62,-42,-71,-108,124,-60,32,-2,-13,-56,-5,113,-22,-98
,-107,-47,-23,112,-22,87,26,-9,-10,-115,-42,-98,-42,16,-91,-85,67,-74,75,-107,-110,73,73,117,43,-72,46,66,-19,-38,-8,-7
,-101,-119,58,-11,3,-91,-100,-25,71,69,32,-94,-96,4,2,-106,-116,81,64,17,-51,12,119,16,-55,12,-47,-84,-111,72,-91,93
,24,100,50,-111,-126,15,-79,21,-25,86,-74,-17,99,102,-113,38,-23,38,-48,-82,-98,-54,112,78,-26,107,110,54,-65,114,79,-108
,-48,-56,125,74,17,-34,-67,39,21,-59,120,-70,-62,59,109,86,13,73,-124,-126,-46,-8,37,-115,-17,-107,43,68,-63,-77,-104,95
,114,-112,64,44,76,103,-98,124,-59,-20,43,58,-79,78,62,-122,-108,-27,102,103,-38,106,86,-94,39,-114,-35,-114,-95,124,-14,-55
,-97,-78,109,-7,80,-56,-59,67,54,118,-81,7,-18,-106,-49,36,-127,-51,115,126,60,-121,95,-78,-48,-58,-73,-95,20,-120,70,-48
,-66,-89,106,-69,100,-34,33,112,-15,-56,78,58,-87,92,54,49,-58,51,-112,-75,-75,-91,-92,94,31,-46,45,-84,67,55,-111,24
,10,59,109,61,-64,-17,-115,-37,-114,57,-58,113,-100,1,84,53,31,18,75,109,115,0,-115,-91,55,19,-99,-80,-61,18,-126,-14
,17,-44,1,-100,28,2,121,-32,87,12,106,-72,-50,-15,59,125,-109,-108,117,60,-5,-62,94,50,-15,110,-95,-82,104,-38,108,87
,-102,112,2,-22,87,-122,91,-120,-66,69,-98,82,-39,119,-64,-55,57,118,80,7,-9,-15,-111,-112,71,-45,-24,8,80,9,4,-29
,-110,6,51,95,62,-39,120,32,-57,-30,17,-82,5,-76,-45,84,21,-106,59,69,38,64,-114,29,95,112,-27,66,-99,-54,62,95
,-103,122,-32,99,-89,87,115,-81,107,86,112,-36,-34,-89,-119,-82,-25,-110,-42,38,-104,64,-42,-16,24,-27,-38,55,16,112,-128,-123
,56,-37,-112,114,50,57,-11,-20,-6,-51,57,52,-109,57,-34,22,-91,-101,-20,122,-59,20,-76,86,-57,48,-33,-46,-106,-110,-118,0
,56,-86,-70,-123,-115,-74,-87,-89,-36,88,-35,-57,-26,91,-36,33,-114,69,-49,99,-24,123,30,-32,-10,53,100,-1,0,90,106,18
,104,25,-28,26,-52,-70,-98,-125,118,-74,122,-117,22,-71,99,-27,-59,112,80,42,-34,-116,-16,-5,-77,-115,-28,16,10,117,5,78
,6,-36,26,-30,117,-19,-73,55,-15,-22,58,-100,-49,111,-27,32,65,19,-71,93,-64,28,-19,29,-55,61,62,94,79,-14,-6,78
,-22,-42,-34,-10,-35,-19,-18,-83,-30,-98,7,-31,-29,-107,3,-85,125,65,-32,-42,102,-97,-31,79,15,-23,23,43,115,-89,-24,-106
,22,-41,0,28,77,29,-70,-121,0,-11,1,-79,-112,61,-85,-102,88,117,-51,116,-20,118,67,23,-53,27,56,-35,-98,81,-93,-23
,94,36,-42,52,-40,-94,-118,-50,-22,72,-10,-94,44,-82,4,104,54,-116,103,-52,-112,-122,97,-22,-54,-81,-100,-102,-20,52,111,-122
,-87,29,-59,-75,-50,-83,112,-124,66,-54,-26,-50,-37,113,-114,70,83,-72,121,-114,-36,-72,-50,14,2,-96,36,12,-125,93,-8,-25
,-83,47,106,-72,80,-124,93,-19,-87,-108,-15,85,36,-71,111,100,45,20,-76,86,-57,57,-1,-39 };
}


JavaPic_pointpng.java
-------------------------------------------------------------------
// JavaPic_pointpng.java

import javax.swing.*;
import java.awt.*;

//Raw image data:

public class JavaPic_pointpng{
public static ImageIcon getImageIcon() {
if (imageIcon == null) { imageIcon = new ImageIcon(bytes); }
return imageIcon;
}
public static Image getImage() { return getImageIcon().getImage(); }
private static ImageIcon imageIcon;
private static byte[] bytes = {
-119,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,10,0,0,0,10,8,6,0,0,0,-115,50,-49
,-67,0,0,0,6,98,75,71,68,0,-1,0,-1,0,-1,-96,-67,-89,-109,0,0,0,9,112,72,89,115,0,0,11,19,0
,0,11,19,1,0,-102,-100,24,0,0,0,7,116,73,77,69,7,-43,4,11,22,56,36,-97,-111,-127,21,0,0,0,-20,73
,68,65,84,8,-41,117,-112,-95,110,-61,48,0,68,-49,86,-91,77,109,-107,26,14,22,6,-122,-59,48,-48,112,-123,81,-55,-40
,74,-54,-57,2,75,-14,3,11,41,-36,39,44,-52,-122,-55,23,-28,19,2,29,-26,20,100,55,18,85,-111,-74,62,-23,-79,-45
,-23,116,-64,12,-55,-36,123,-17,-84,-75,-63,90,27,-68,-9,-114,100,-114,37,36,-53,107,85,113,-81,20,-77,-39,-105,-51,-122,-105
,-94,32,-55,-14,-34,116,-83,42,-66,-18,118,-12,0,127,102,3,-64,-45,122,-51,-113,-13,-103,36,115,-12,125,-17,-10,81,-60,-80
,8,45,-115,-93,-120,93,-41,57,-39,52,77,-102,8,-127,39,-4,-113,-71,-35,80,-41,117,42,-121,97,-128,-102,38,60,-30,121,-102
,48,-114,35,-92,-42,-70,109,-92,124,24,108,-74,91,104,-83,91,-112,-52,79,-57,35,47,-85,-43,-97,125,-33,0,-77,36,-31,-3
,-90,16,66,-7,118,56,48,83,-118,5,-64,2,-96,81,-118,58,-114,-23,-67,47,1,64,44,15,119,-50,-67,59,-25,82,0,-48
,90,-73,-58,-104,79,33,-60,23,0,-4,2,104,-32,-104,-29,25,125,-89,0,0,0,0,0,73,69,78,68,-82,66,96,-126 };
}


JavaPic_testjpg.java
-------------------------------------------------------------------
// JavaPic_testjpg.java

import javax.swing.*;
import java.awt.*;

//Raw image data:

public class JavaPic_testjpg{
public static ImageIcon getImageIcon() {
if (imageIcon == null) { imageIcon = new ImageIcon(bytes); }
return imageIcon;
}
public static Image getImage() { return getImageIcon().getImage(); }
private static ImageIcon imageIcon;
private static byte[] bytes = {
-1,-40,-1,-32,0,16,74,70,73,70,0,1,1,1,0,96,0,96,0,0,-1,-31,0,22,69,120,105,102,0,0,73,73
,42,0,8,0,0,0,0,0,0,0,0,0,-1,-37,0,67,0,8,6,6,7,6,5,8,7,7,7,9,9,8,10,12
,20,13,12,11,11,12,25,18,19,15,20,29,26,31,30,29,26,28,28,32,36,46,39,32,34,44,35,28,28,40,55,41
,44,48,49,52,52,52,31,39,57,61,56,50,60,46,51,52,50,-1,-37,0,67,1,9,9,9,12,11,12,24,13,13,24
,50,33,28,33,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50
,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,-1,-64,0,17,8,0,79,0,82,3
,1,34,0,2,17,1,3,17,1,-1,-60,0,31,0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1
,2,3,4,5,6,7,8,9,10,11,-1,-60,0,-75,16,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125,1
,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,-127,-111,-95,8,35,66,-79,-63,21,82,-47,-16,36
,51,98,114,-126,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74
,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,-125,-124,-123,-122,-121,-120,-119,-118
,-110,-109,-108,-107,-106,-105,-104,-103,-102,-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,-72,-71,-70,-62,-61,-60,-59,-58
,-57,-56,-55,-54,-46,-45,-44,-43,-42,-41,-40,-39,-38,-31,-30,-29,-28,-27,-26,-25,-24,-23,-22,-15,-14,-13,-12,-11,-10,-9,-8,-7
,-6,-1,-60,0,31,1,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9
,10,11,-1,-60,0,-75,17,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119,0,1,2,3,17,4,5,33,49
,6,18,65,81,7,97,113,19,34,50,-127,8,20,66,-111,-95,-79,-63,9,35,51,82,-16,21,98,114,-47,10,22,36,52,-31
,37,-15,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89
,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,-126,-125,-124,-123,-122,-121,-120,-119,-118,-110,-109,-108,-107,-106,-105
,-104,-103,-102,-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,-72,-71,-70,-62,-61,-60,-59,-58,-57,-56,-55,-54,-46,-45
,-44,-43,-42,-41,-40,-39,-38,-30,-29,-28,-27,-26,-25,-24,-23,-22,-14,-13,-12,-11,-10,-9,-8,-7,-6,-1,-38,0,12,3,1,0
,2,17,3,17,0,63,0,-9,-22,76,-47,77,118,17,-95,102,96,-86,6,73,39,0,80,3,-77,75,92,-28,-34,53,-47,3
,-68,118,83,75,-86,76,-71,5,52,-24,-116,-32,17,-40,-70,-4,-118,127,-34,97,85,37,-15,7,-120,-89,98,45,116,75,75,40
,-5,75,-88,94,110,56,-1,0,114,37,111,-43,-123,3,-77,58,-46,113,64,-82,54,67,-30,-87,-119,-13,53,-21,27,114,78,0
,-74,-45,114,7,-30,-14,30,127,15,-62,-111,-76,88,-18,-92,118,-44,-75,61,106,-17,32,-99,-83,120,-48,32,-6,44,59,63,92
,-46,-70,11,29,-99,45,112,126,26,-46,108,-12,15,28,79,107,-91,-68,-47,88,-34,105,107,63,-39,-91,-72,-106,95,-34,-92,-52
,25,-127,118,56,-31,-44,17,-98,-30,-69,-81,-88,-90,33,120,-92,98,0,36,-112,0,25,38,-102,-57,-44,87,-108,-22,58,-107,-41
,-60,127,20,46,-115,-92,-34,-36,-63,-95,-61,-1,0,31,18,91,-74,-47,60,60,-84,-116,-57,-70,-79,-52,104,7,92,59,-25,0
,80,7,-86,69,115,4,-16,-92,-48,-51,28,-111,72,-95,-111,-47,-127,86,7,-112,65,29,69,20,-80,65,29,-83,-68,86,-10,-24
,-79,67,18,4,-114,52,24,85,80,48,0,29,-128,20,80,4,-107,-54,-8,-50,-38,-41,87,109,39,67,-70,-127,103,-118,-22,-20
,92,76,-116,50,4,80,15,49,-119,29,8,45,-27,-95,7,-76,-107,-44,-111,92,-70,-80,-66,-15,54,-81,121,-116,-91,-116,105,-89
,-60,79,56,102,81,44,-92,125,119,66,15,-68,116,13,110,98,90,-68,114,-34,-57,21,-52,45,21,-76,-111,-122,-124,65,-108,75
,108,-79,11,-128,62,85,-56,3,-109,-33,-118,-24,-83,81,-26,-76,84,-111,-117,109,115,27,62,58,-19,36,100,-3,106,15,-20,105
,34,111,46,59,-81,46,-38,101,-38,-53,-80,51,109,-55,33,67,30,-39,99,-114,51,-51,104,-37,-94,71,18,67,12,120,17,-116
,4,7,-89,-41,-34,-96,-20,-81,82,18,-118,-27,27,36,42,-74,-5,-112,117,96,0,39,60,83,101,5,14,118,-27,-55,-64,4
,116,-84,-7,124,85,-96,69,105,4,-51,-85,90,-78,-54,89,98,88,-28,15,36,-52,9,82,17,6,89,-120,32,-116,1,-100,-46
,89,-21,-106,-70,-83,-44,-112,-37,-59,123,26,-94,111,-1,0,74,-80,-102,5,97,-100,28,51,-86,-125,-12,-21,67,71,33,93,-121
,-39,-4,111,-31,-39,24,20,50,65,121,9,35,-95,-56,-119,-126,-1,0,-29,-124,-2,21,-38,113,-36,-41,13,-83,73,-28,107,126
,23,-68,-56,0,106,-126,6,-57,0,9,33,-108,1,-7,-127,84,62,34,124,64,93,36,62,-119,-91,-77,-66,-94,-61,23,18,-57
,-113,-12,112,70,112,51,-4,100,17,-2,-24,32,-98,-64,-43,-20,-82,-55,-101,-74,-84,79,-120,-98,50,-74,17,-49,-31,-5,59,-112
,11,41,-2,-47,-99,15,-6,-88,-121,-34,-119,79,121,24,124,-72,-22,1,-2,-15,21,-46,120,27,65,109,23,64,13,115,2,-61
,125,120,-1,0,104,-72,-116,115,-27,-110,48,-111,-125,-24,-120,21,126,-96,-98,-11,-25,-1,0,14,60,22,-105,-73,-111,-22,23,-87
,35,69,99,54,-10,-33,-99,-78,93,3,-112,-86,79,37,34,-18,123,-56,79,-9,57,-10,96,49,73,93,-22,76,110,-11,97,-118
,41,104,-86,40,-114,105,-93,-73,-122,73,-26,112,-111,70,-91,-35,-113,64,-96,100,-102,-27,124,59,12,-121,-61,54,-78,78,-123,110
,47,-117,-33,74,8,-63,87,-103,-116,-104,62,-22,24,47,-47,106,-9,-116,15,-101,-96,54,-100,-84,68,-102,-108,-47,-39,32,7,-110
,29,-66,127,-64,70,28,-97,96,106,91,-5,-109,106,-77,78,-74,-110,-52,-112,12,-120,-83,-41,115,-73,110,23,35,63,-31,73,-20
,52,98,106,26,102,-67,115,120,90,-49,-60,66,-38,-39,-91,4,-59,-10,40,-28,104,-62,-82,0,86,61,65,110,91,32,-10,-58
,-34,106,20,-16,101,-83,-52,-79,-49,-85,-33,95,-22,119,37,-61,-97,58,-31,-29,-120,-80,-50,63,116,-124,32,30,-40,62,-7,-85
,31,-37,-102,-108,-14,98,-53,-62,-6,-127,45,-109,-101,-55,-94,-127,113,-45,63,121,-104,28,-10,43,-98,-12,-44,111,24,79,-9,34
,-48,-20,0,111,-108,-69,-53,116,-40,-12,-64,17,-127,-7,-45,87,25,-64,107,86,-19,-16,-41,-58,79,-83,105,86,-47,-117,13,72
,9,30,-43,-79,-80,-78,-97,-34,-58,-89,-86,-74,8,117,61,57,97,-125,93,78,-101,-29,91,-67,122,-47,117,29,47,-61,119,-45
,-38,22,101,-35,37,-52,10,3,-81,108,111,-50,112,65,-28,15,-21,71,-119,-68,37,-86,106,-38,37,-12,23,-70,-93,-22,51,-112
,-77,65,0,-73,-114,8,-42,85,109,-61,102,50,-61,43,-108,-27,-113,-33,36,-25,-116,121,-73,-122,-4,67,-87,-8,86,-34,127,-20
,-5,79,60,28,-84,-74,115,-97,41,100,-27,-126,73,-98,-50,10,-107,32,14,118,-111,-44,10,-103,73,39,-87,18,-107,-98,-69,30
,-105,-29,-3,94,-33,77,-46,-20,45,12,109,46,-91,37,-46,93,90,0,-33,-22,25,14,68,-84,1,-28,3,-64,7,-126,122,-16
,13,121,-66,-97,-94,-36,-21,-70,-60,58,92,44,-58,-10,-19,-34,89,38,102,-34,-24,9,5,-99,-37,-66,-47,-109,-98,-18,84,119
,-29,43,80,-44,110,-82,101,-106,-1,0,80,-69,50,93,56,51,-53,59,13,-95,20,113,-64,-20,-93,56,10,61,113,-55,39,62
,-29,-16,-9,-62,103,64,-45,30,-14,-10,37,93,74,-13,5,-57,83,12,67,-18,-57,-97,94,-84,-40,-2,38,61,-128,-84,83,-10
,-78,-45,-31,95,-119,-118,126,-46,94,72,-22,116,-51,58,-41,72,-45,45,-76,-5,52,-14,-19,-83,-29,88,-93,92,-28,-32,14,-25
,-71,-18,79,115,-109,87,5,32,-23,78,-82,-125,113,51,-19,69,45,20,1,-51,107,79,-25,-8,-85,66,-75,-29,22,-21,113,-88
,55,60,-4,-88,33,81,-8,-3,-95,-113,-4,6,-97,115,-88,37,-77,-58,74,-79,46,72,84,64,73,56,-22,79,-80,-51,86,70
,19,120,-93,90,-68,32,98,24,-32,-45,-29,39,-44,3,51,-111,-1,0,127,-112,127,-64,105,-115,29,-55,107,-107,-119,37,89,100
,-57,-105,50,-19,33,87,3,-41,-33,119,24,-17,74,70,-44,-94,-92,-11,46,92,-35,93,-84,120,-45,96,-118,-30,-28,-19,1,103
,-112,-58,-125,39,-106,36,41,60,122,1,-49,-75,99,-34,-65,-119,34,-78,121,-17,-75,45,59,72,-124,19,-71,109,96,105,-27,108
,115,-14,59,-112,-96,-98,-39,67,-8,-44,-77,88,106,114,-111,-74,-27,-107,-118,96,-77,16,15,-73,3,-66,51,-45,-90,125,-86,-65
,-10,93,-28,-96,-49,61,-62,-36,2,-30,85,-127,-104,-124,56,57,-58,15,79,74,73,-40,-24,-123,10,109,-34,82,38,-125,-61,119
,87,-106,81,-36,-65,-119,-11,-55,-52,-118,25,-48,73,12,99,-24,60,-72,-58,-36,123,30,107,-50,-4,103,-96,-37,-23,-6,-115,-90
,-87,97,47,-101,105,116,-90,38,50,63,-101,-5,-15,-126,114,-35,-39,-44,23,-25,57,40,-25,-8,-85,-45,101,-78,-78,-41,-12,72
,-32,-65,-119,102,-124,-71,-112,4,-54,40,97,-111,-128,87,7,-71,21,-51,-33,105,30,28,-70,-16,125,-4,23,80,-82,-105,-90,92
,92,40,19,90,32,-115,-78,-84,2,-70,-128,-89,-110,114,58,28,-125,-17,74,105,77,89,-100,-75,104,-74,-92,-70,35,-118,-80,-16
,-60,122,-81,-126,-68,69,-82,-33,68,94,24,44,-82,35,-78,-116,-29,-9,-110,-94,54,100,56,-22,20,-115,-85,-22,-37,-113,-9,113
,-17,-74,-114,-78,89,-62,-22,114,-115,26,-107,-6,17,92,-82,-98,-102,110,-81,-31,-59,-79,-45,98,-106,-33,76,88,77,-84,97,-31
,104,-63,77,-72,5,67,0,89,72,32,-122,-17,90,62,11,-72,123,-49,6,-23,50,-53,-2,-75,45,-106,25,71,-92,-111,-4,-114
,63,-17,-91,52,-31,30,88,-39,25,-88,-88,-85,29,8,-59,46,105,-68,12,81,-42,-88,7,81,71,-29,69,0,113,-34,30,38
,109,49,-82,-101,-91,-35,-3,-35,-58,88,125,-27,51,56,67,-1,0,124,42,99,-37,20,-3,79,78,-66,-72,-44,90,107,15,16
,79,96,-116,-72,120,-106,24,-28,82,71,76,7,28,117,57,-11,-29,-111,-118,33,-16,55,-40,45,-110,-45,75,-15,38,-73,101,107
,30,68,118,-2,100,83,34,12,-12,30,98,51,99,-37,52,127,-62,21,44,-103,55,30,43,-15,20,-99,64,9,113,28,32,15
,-5,103,24,-93,-87,87,41,-22,-94,-30,29,58,43,73,-82,-89,-69,-72,-100,50,13,-86,-79,-7,-67,-127,36,14,0,-49,106,-107
,-4,59,52,-47,-76,-45,76,-46,92,-7,69,120,-50,-47,-57,65,-19,86,-113,-127,44,-99,-47,-89,-43,-4,65,54,-61,-112,31,85
,-105,3,-14,34,-98,124,9,-94,-74,55,73,-86,-79,29,-50,-81,117,-97,-3,25,71,42,58,35,-119,112,-126,-116,116,11,13,46
,91,11,66,103,-105,17,-112,114,-116,112,-88,-89,-33,56,-32,119,-84,-45,-30,-97,14,-40,-124,-73,-75,-44,22,-14,85,109,-94,-38
,-63,26,-27,-57,29,49,16,108,126,53,-85,31,-128,-68,48,-92,52,-70,76,87,76,63,-118,-15,-34,-32,-97,-81,-104,91,53,-65
,5,-68,54,-47,8,109,-31,-114,40,-105,-128,-111,-88,85,31,-128,-94,-56,-54,117,101,54,-37,56,-53,109,75,-60,-38,-72,45,101
,-31,116,-78,-124,28,36,-38,-59,-41,-106,-25,-44,-7,81,-85,31,-51,-123,110,-8,99,68,-101,67,-46,-27,-126,-26,-23,46,46,39
,-71,-102,-18,83,26,20,-115,94,71,44,85,20,-110,66,-126,120,-55,61,-49,122,-37,-38,59,81,-114,40,50,18,-108,102,-108,12
,10,90,0,79,-62,-118,92,-47,64,31,-1,-39 };
}


JavaPic_tutorialjpg.java
-------------------------------------------------------------------
// JavaPic_tutorialjpg.java

import javax.swing.*;
import java.awt.*;

//Raw image data:

public class JavaPic_tutorialjpg{
public static ImageIcon getImageIcon() {
if (imageIcon == null) { imageIcon = new ImageIcon(bytes); }
return imageIcon;
}
public static Image getImage() { return getImageIcon().getImage(); }
private static ImageIcon imageIcon;
private static byte[] bytes = {
-1,-40,-1,-32,0,16,74,70,73,70,0,1,1,1,0,96,0,96,0,0,-1,-31,0,22,69,120,105,102,0,0,73,73
,42,0,8,0,0,0,0,0,0,0,0,0,-1,-37,0,67,0,8,6,6,7,6,5,8,7,7,7,9,9,8,10,12
,20,13,12,11,11,12,25,18,19,15,20,29,26,31,30,29,26,28,28,32,36,46,39,32,34,44,35,28,28,40,55,41
,44,48,49,52,52,52,31,39,57,61,56,50,60,46,51,52,50,-1,-37,0,67,1,9,9,9,12,11,12,24,13,13,24
,50,33,28,33,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50
,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,-1,-64,0,17,8,0,63,0,66,3
,1,34,0,2,17,1,3,17,1,-1,-60,0,31,0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1
,2,3,4,5,6,7,8,9,10,11,-1,-60,0,-75,16,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125,1
,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,-127,-111,-95,8,35,66,-79,-63,21,82,-47,-16,36
,51,98,114,-126,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74
,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,-125,-124,-123,-122,-121,-120,-119,-118
,-110,-109,-108,-107,-106,-105,-104,-103,-102,-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,-72,-71,-70,-62,-61,-60,-59,-58
,-57,-56,-55,-54,-46,-45,-44,-43,-42,-41,-40,-39,-38,-31,-30,-29,-28,-27,-26,-25,-24,-23,-22,-15,-14,-13,-12,-11,-10,-9,-8,-7
,-6,-1,-60,0,31,1,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9
,10,11,-1,-60,0,-75,17,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119,0,1,2,3,17,4,5,33,49
,6,18,65,81,7,97,113,19,34,50,-127,8,20,66,-111,-95,-79,-63,9,35,51,82,-16,21,98,114,-47,10,22,36,52,-31
,37,-15,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89
,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,-126,-125,-124,-123,-122,-121,-120,-119,-118,-110,-109,-108,-107,-106,-105
,-104,-103,-102,-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,-72,-71,-70,-62,-61,-60,-59,-58,-57,-56,-55,-54,-46,-45
,-44,-43,-42,-41,-40,-39,-38,-30,-29,-28,-27,-26,-25,-24,-23,-22,-14,-13,-12,-11,-10,-9,-8,-7,-6,-1,-38,0,12,3,1,0
,2,17,3,17,0,63,0,-9,-36,-47,-102,40,-96,5,-92,-51,20,-108,0,-76,115,73,84,53,-83,77,116,-115,34,-30,-12,-95
,-111,-48,5,-118,49,-63,-110,70,33,81,7,-43,-120,31,-115,0,98,120,-97,86,-100,95,-63,-92,90,-68,-32,-70,-17,-104,91,48
,89,100,-50,118,68,-83,-97,-109,59,93,-103,-6,-123,67,-116,22,4,87,-66,-126,77,11,75,77,70,-62,-18,-3,110,82,104,87
,-20,-45,-35,-55,113,12,-51,36,-118,-126,54,-13,11,21,25,124,110,82,8,-21,-126,6,-45,83,-61,22,-126,75,-39,-82,110,88
,-53,113,30,22,107,-114,-66,116,-52,-86,100,124,-15,-63,-62,40,3,-128,23,104,-29,-118,-65,-90,88,-35,120,-93,74,-73,-70,-44
,47,-126,-38,73,57,121,44,109,-32,85,70,-14,-28,59,84,-65,44,-61,114,2,88,16,28,118,0,-30,-87,-85,104,7,97,-102
,40,-59,21,32,85,-68,-66,-74,-45,-19,36,-70,-68,-98,56,45,-30,25,121,36,109,-86,-93,-36,-41,-100,-21,95,24,-84,-96,45
,30,-117,100,-9,-116,63,-27,-75,-58,98,-116,-1,0,-70,-72,46,127,16,-93,-48,-102,-32,124,97,-90,-8,-85,-59,-34,51,-43,-84
,26,-49,82,-44,22,-50,-11,-42,8,-128,43,5,-68,124,24,-56,-50,-44,12,85,-127,-55,36,-112,125,-86,27,31,-121,-98,55,-16
,-15,-5,114,104,-69,-31,78,100,-126,59,-72,-28,114,-93,-87,85,-55,-61,96,100,99,62,-104,-12,-58,114,-98,-48,71,101,42,84
,82,82,-88,-2,71,69,39,-60,127,24,93,-54,-59,39,-76,-75,-116,117,-14,-20,-2,-18,127,-34,102,-1,0,-11,-42,-82,-113,-15
,79,82,-77,124,107,-42,-16,92,90,-87,2,75,-117,97,-74,88,-127,-2,38,76,-107,108,113,-112,-92,17,-24,122,86,84,-106,45
,-88,-23,-2,117,-84,-27,30,104,-124,-111,-54,-84,25,-103,126,-16,-64,39,-98,62,-100,30,-35,106,-66,-115,107,60,122,116,49,74
,33,-2,-45,-127,-10,58,-37,-36,9,-74,-79,-58,3,16,9,-36,51,-114,78,126,92,-28,-41,44,106,-43,94,-13,103,100,-87,97
,-27,-18,-88,-40,-9,72,-90,-114,120,82,88,-92,89,34,117,12,-114,-121,33,-127,-28,16,123,-116,87,27,-30,-21,-16,-6,-67,-67
,-82,-30,-55,101,23,-38,-116,72,57,121,91,114,70,9,-6,7,-64,-11,32,-10,25,95,6,79,37,-117,-36,104,110,17,98,-115
,5,-51,-110,47,1,99,44,67,-57,-114,-37,95,-112,50,112,36,81,-38,-78,45,-90,-2,-45,-15,29,-43,-40,114,82,107,-23,36
,3,-113,-106,59,115,-27,41,31,89,21,88,123,19,94,-123,57,41,46,100,121,51,-117,-117,105,-101,-16,22,-45,116,-87,45,96
,-69,-74,-122,-10,59,119,-108,77,47,40,-115,-55,105,88,103,-18,-122,39,63,-107,106,-8,78,5,-74,-16,-98,-104,-119,-25,5,120
,22,85,73,-64,13,24,127,-100,38,0,0,5,-35,-76,1,-48,0,43,-97,-76,-16,-26,-101,-30,13,75,81,-109,82,-13,39,-5
,60,-94,-40,68,-78,20,67,17,-119,91,99,-123,-63,63,51,-106,-63,-17,-76,-10,21,-36,15,90,-90,72,-6,41,1,-30,-118,-112
,26,84,83,74,-45,-15,77,60,-48,7,-100,-40,88,71,103,119,-85,-40,11,116,-14,-83,47,-35,83,119,-35,-14,-92,85,-104,46
,61,7,-101,-113,108,123,3,84,-12,-99,46,-30,-49,83,-66,86,-115,-82,45,8,89,35,111,41,21,3,28,-4,-86,20,-12,-58
,-36,-28,12,-29,-66,114,118,-11,-69,59,-105,-41,53,-104,-19,0,45,37,-75,-107,-53,33,98,-69,-10,-55,40,117,7,-79,101,69
,92,-10,-30,-78,-82,-89,-66,-76,-14,5,-36,-105,87,75,121,117,-69,-53,71,17,27,96,65,-7,78,-58,59,-112,29,-96,-113,114
,114,107,-50,-60,70,-45,105,117,59,-87,-44,-9,81,83,85,-15,61,-66,-122,-80,-22,-15,-93,-73,-40,-42,66,-81,12,106,-47,-51
,11,-90,-46,80,-87,-28,9,-68,-128,115,-56,56,-19,-125,92,-82,-103,-15,7,-61,-74,54,87,-15,91,106,-20,-105,-115,28,54,118
,-81,-28,56,81,-57,51,22,-40,112,-95,-27,114,70,50,118,96,14,-107,-44,-36,-37,-24,-111,88,62,-101,113,39,-6,52,-74,-81
,103,-119,36,102,-7,24,-126,-37,119,28,-106,44,1,-6,-86,-29,-90,43,-57,110,-4,7,-84,25,-121,-39,-76,59,-23,34,86,100
,-35,-28,-7,126,99,12,-31,-128,117,7,97,32,17,-111,-48,-116,-13,-102,-21,-61,84,-113,37,-98,-122,53,97,39,43,-97,83,-24
,-111,-23,-65,-39,80,75,-92,8,-2,-63,56,-13,-30,120,-13,-5,-51,-1,0,49,114,79,36,-100,-28,-109,-55,-17,90,96,122,87
,59,-31,127,16,69,-87,90,-37,88,-51,104,-10,87,-15,-38,-93,-76,38,48,-79,-112,2,-122,49,-32,-97,-108,49,3,28,17,-111
,-59,116,121,-83,-109,79,84,96,-45,78,-52,92,113,69,40,60,81,64,-124,-92,52,-76,-76,1,-58,120,-84,-55,107,-81,88,-54
,-96,-7,87,-74,-14,-38,57,0,-25,122,-111,34,-127,-113,85,-13,127,42,-13,-1,0,24,-71,58,27,-35,-63,-27,27,-85,87,18
,64,86,51,41,70,12,50,-64,-80,4,-114,-4,103,-95,-30,-67,-109,88,-46,109,-11,-99,54,91,27,-99,-31,31,5,94,51,-121
,-115,-127,-54,-78,-98,-60,30,107,-54,117,-113,2,-8,-82,107,-121,71,-74,-117,80,-116,100,44,-10,-46,-57,9,-112,0,0,44,-83
,-54,-12,31,40,36,117,-28,87,53,122,109,-75,40,-83,78,-36,52,-23,-37,-106,110,-58,87,-123,53,-53,68,-74,-112,94,90,42
,-22,81,109,45,113,36,108,-114,-22,-5,-128,36,-79,-35,-58,-45,-100,28,114,56,28,-30,-51,-9,-118,18,84,98,-61,108,96,-20
,93,-85,-106,108,-98,112,115,-11,-4,-121,-67,91,-46,126,20,120,-126,-22,83,115,-86,106,54,-70,106,-70,-123,16,-37,-125,52,-120
,-128,28,46,-17,-107,67,12,-79,-56,-36,50,123,-118,-19,116,-33,-122,94,23,-80,10,-45,88,-99,66,96,48,100,-67,111,51,119
,-43,56,79,-4,118,-79,-6,-76,-28,-18,-12,55,120,-102,16,-37,83,-112,-8,113,-86,29,91,-59,112,52,14,-84,-106,-10,87,43
,40,4,-74,-64,-49,9,3,61,1,-56,-23,-24,-89,-118,-11,-31,-18,41,-79,-59,28,49,44,81,34,-57,26,-116,42,-96,-64,3
,-40,10,120,-82,-54,112,-28,-113,41,-63,90,-89,-76,-101,-107,-84,46,40,-91,-19,69,89,-111,-1,-39 };
}


Line.java
-------------------------------------------------------------------
/**
* @author Steve Bradley
* Made a few changes in the naming conventions - AO
*/

public class Line {
/**
* @return Y-intercept
*/
public double getYIntercept() {
return b;
}


/**
*
* @return Slope
*/
public double getSlope() {
return m;
}


/**
* Derives the line from two points
*
* @param x1
* First point's x
* @param y1
* First point's y
* @param x2
* Second point's x
* @param y2
* Second point's y
*/
public void setLine( double x1, double y1, double x2, double y2 ) {
m = ( y1 - y2 ) / ( x1 - x2 );
b = y1 - m * x1;
}


/**
* Derives the line from two points
*
* @param p1
* First point
* @param p2
* Second point
*/
public void setLine( Point p1, Point p2 ) {
setLine( p1.getX(), p1.getY(), p2.getX(), p2.getY() );
}


/**
* Using the line as a function, returns f( x )
*
* @param x
* The x value to use
* @return The corresponding y value
*/
public double f( double x ) {
return ( m * x + b );
}


/**
* Returns the residual's length
*
* @param x
* The point's x
* @param y
* The point's y
* @return The length of the residual
*/
public double findResidual( double x, double y ) {
double actY = f( x );
return ( y - actY );
}


/**
* Returns the residual's length
*
* @param p1
* The point used to find the residual
* @return The length of the residual
*/
public double findResidual( Point p1 ) {
return findResidual( p1.getX(), p1.getY() );
}

/**
* Returns a Line representing the residual
*
* @param p1
* The point
* @return
*/
public LineSegment findResidualLine( Point p1 ) {
LineSegment line = new LineSegment();
Point p2 = new Point();
p2.setLocation( p1.getX(), p1.getY() - findResidual( p1 ) );
line.setLine( p1, p2 );
return line;
}


/**
* Returns a rectangle representing SSres
*
* @param p1
* @return
*/
public Rectangle findResSquare( Point p1 ) {
Rectangle rect = new Rectangle();
double resLength = findResidual( p1 );
double absRes = Math.abs(resLength);

if ( ( m > 0 ) && ( resLength > 0 ) ) {
rect.setRect( p1.getX() - resLength, p1.getY(), resLength, resLength );
}
else if ( ( m > 0 ) && ( resLength < 0 ) ) {
rect.setRect( p1.getX(), p1.getY() + absRes, absRes, absRes );
}
else if ( ( m < 0 ) && ( resLength > 0 ) ) {
rect.setRect( p1.getX(), p1.getY(), resLength, resLength );
}
else {
rect.setRect( p1.getX() - absRes, p1.getY() + absRes, absRes, absRes );
}
return rect;
}


public Line( double newM, double newB ) {
m = newM;
b = newB;
}

public Line() {
m = 1;
b = 0;
}


public void setSlope( double newSlope ) {
m = newSlope;
}

public void setYIntercept( double newY ) {
b = newY;
}


private double m;

private double b;

}


LineSegment.java
-------------------------------------------------------------------
/*
* Created on Mar 23, 2005
*/

/**
* @author Andrew Owens
*/

import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
public class LineSegment extends Line2D.Double {
public String toString() {
return "";
}


public LineSegment( double x1, double y1, double x2, double y2 ) {
super( x1, y1, x2, y2 );
}


public LineSegment( Point2D first, Point2D second ) {
super( first, second );
}
public LineSegment() {
super();
}
}


LineTester.java
-------------------------------------------------------------------
/*
* Created on Apr 4, 2005
*/

/*
* @author Doug Tremblay
*
*/

// HACK - this could be written much more concisely and neater
public class LineTester extends Tester {

public void doTest() {

//testGetYIntercept();
//testGetSlope();
testSetLine();
//testSetLinePoint();
//testF();
//testFindResidual();
//testFindResidualPoint();

}


public void testGetYIntercept() {

System.out.print( "Enter m: " );
double m = IOReader.readDouble();
System.out.print( "Enter b: " );
double b = IOReader.readDouble();

Line testLine = new Line( m, b );

if ( testLine.getYIntercept() != b ) {
println( "Error with getYIntercept()");
}
else {
println( "No Error" );
}
}


public void testGetSlope() {

System.out.print( "Enter m: " );
double m = IOReader.readDouble();
System.out.print( "Enter b: " );
double b = IOReader.readDouble();

Line testLine = new Line( m, b );

if ( testLine.getSlope() != m ) {
println( "Error with getSlope()");
}
else {
println( "No Error" );
}
}


public void testSetLine() {

System.out.print( "Enter x1: " );
double x1 = IOReader.readDouble();
System.out.print( "Enter y1: " );
double y1 = IOReader.readDouble();
System.out.print( "Enter x2: " );
double x2 = IOReader.readDouble();
System.out.print( "Enter y2: " );
double y2 = IOReader.readDouble();

Line testLine = new Line();

System.out.print( "\nEnter expected m: " );
double expectedM = IOReader.readDouble();
System.out.print( "Enter expected b: " );
double expectedB = IOReader.readDouble();

testLine.setLine( x1, y1, x2, y2 );

if ( ( testLine.getSlope() != expectedM ) || ( testLine.getYIntercept() !expectedB ) ) {
System.out.print( " Error with setLine( " + x1 + ", " + y1 + ", " + x2
+ ", " + y2 + " )" );
}
else {
println( "No Error" );
}
}


public void testSetLinePoint() {

System.out.print( "Enter x1: " );
double x1 = IOReader.readDouble();
System.out.print( "Enter y1: " );
double y1 = IOReader.readDouble();
System.out.print( "Enter x2: " );
double x2 = IOReader.readDouble();
System.out.print( "Enter y2: " );
double y2 = IOReader.readDouble();

Point TestP1 = new Point();
Point TestP2 = new Point();

TestP1.setX( x1 );
TestP1.setY( y1 );
TestP2.setX( x2 );
TestP2.setY( y2 );

Line testLine = new Line();

testLine.setLine( TestP1, TestP2 );

System.out.print( "\nEnter expected m: " );
double expectedM = IOReader.readDouble();
System.out.print( "Enter expected b: " );
double expectedB = IOReader.readDouble();

if ( ( testLine.getSlope() != expectedM ) || ( testLine.getYIntercept() !expectedB ) ) {
System.out.print( " Error with setLine( " + x1 + ", " + y1 + ", " + x2
+ ", " + y2 + " )" );
}
else {
println( "No Error" );
}
}


public void testF() {

System.out.print( "Enter m: " );
double m = IOReader.readDouble();
System.out.print( "Enter b: " );
double b = IOReader.readDouble();

Line testLine = new Line( m, b );

System.out.print( "\nEnter an x value: " );
double x = IOReader.readDouble();
System.out.print( "Enter the expected y value: " );
double expectedY = IOReader.readDouble();

if ( testLine.f( x ) != expectedY ) {
println( "Error with f( " + x + " )" );
}
else {
println( "No Error " );
}
}


public void testFindResidual() {

System.out.print( "Enter x: ");
double x = IOReader.readDouble();
System.out.print( "Enter y: ");
double y = IOReader.readDouble();

System.out.print( "Enter m: " );
double m = IOReader.readDouble();
System.out.print( "Enter b: " );
double b = IOReader.readDouble();

Line testLine = new Line( m, b );

System.out.print( "\nEnter expected Residual: " );
double expectedResid = IOReader.readDouble();

if ( testLine.findResidual( x, y ) != expectedResid ) {
System.out.print( "Error with findResidual( " + x + ", " + y + " )" );
}
else {
System.out.print( "No Error" );
}

}


public void testFindResidualPoint() {

System.out.print( "Enter x: ");
double x = IOReader.readDouble();
System.out.print( "Enter y: ");
double y = IOReader.readDouble();

System.out.print( "Enter m: " );
double m = IOReader.readDouble();
System.out.print( "Enter b: " );
double b = IOReader.readDouble();

Point testPoint = new Point( x, y );
Line testLine = new Line( m, b );

System.out.print( "\nEnter expected Residual: " );
double expectedResid = IOReader.readDouble();

if ( testLine.findResidual( testPoint.getX() , testPoint.getY() ) !expectedResid ) {
System.out.print( "Error with findResidual( " + x + ", " + y + " )" );
}
else {
System.out.print( "No Error" );
}
}

/*
public void testFindResidualLine() {

System.out.print( "Enter x: ");
double x = IOReader.readDouble();
System.out.print( "Enter y: ");
double y = IOReader.readDouble();

System.out.print( "Enter m: " );
double m = IOReader.readDouble();
System.out.print( "Enter b: " );
double b = IOReader.readDouble();

Point testPoint1 = new Point();
Point testPoint2 = new Point();
LineSegment testLine = new LineSegment( m ,b );

testPoint1.setLocation( x, y );
testPoint2.setLocation( x, y - findResidual( testPoint1 ) );

]
*/



}


Mode.java
-------------------------------------------------------------------
/*
* Created on Apr 10, 2005
*/

/**
* @author Andrew Owens
*/

public interface Mode {
public void updateAll();
}


NavigationPanel.java
-------------------------------------------------------------------
/*
* Created on Apr 10, 2005
*/

/**
* @author Andrew Owens
*/

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.Iterator;

/**
* A reusable panel that allows the user to navigate through the application.
*/
public class NavigationPanel extends JPanel {
public NavigationPanel( String currentMode, Application app ) {
application = app;
loadImages();
initGUI( currentMode );
}


private void initGUI( String currentMode ) {
JLabel header = new JLabel( HEADER_TEXT );
ArrayList buttons = new ArrayList();
setBackground( Color.WHITE );
setLayout( new BoxLayout( this, BoxLayout.Y_AXIS ) );
add( header );

// make the buttons
JButton selectionButton = new JButton( SELECTION, hqImg );
JButton instructionButton = new JButton( INSTRUCTION, instructionImg );
JButton explorationButton = new JButton( EXPLORATION, tutorialImg );
JButton homeworkButton = new JButton( HOMEWORK, homeworkImg );
JButton testButton = new JButton( TEST, testImg );

selectionButton.setToolTipText( SELECTION_TOOLTIP );
instructionButton.setToolTipText( INSTRUCTION_TOOLTIP );
explorationButton.setToolTipText( EXPLORATION_TOOLTIP );
homeworkButton.setToolTipText( HOMEWORK_TOOLTIP );
testButton.setToolTipText( TEST_TOOLTIP );

// add each button:
buttons.add( selectionButton );
buttons.add( instructionButton );
buttons.add( testButton );
buttons.add( explorationButton );
buttons.add( homeworkButton );

ButtonHandler handler = new ButtonHandler();

Iterator buttonIt = buttons.iterator();

while ( buttonIt.hasNext() ) {
JButton button = (JButton) buttonIt.next();
button.setBackground( Color.WHITE );
button.addActionListener( handler );

}

buttonIt = buttons.iterator();
while ( buttonIt.hasNext() ) {
JButton button = (JButton) buttonIt.next();
if ( !button.getText().equals( currentMode ) ) {
add( button );
}
}

// add the SAIL emblem
add( new JLabel( "", JavaPic_emblemjpg.getImageIcon(), JLabel.CENTER ) );
}


private void loadImages() {
testImg = JavaPic_testjpg.getImageIcon();
hqImg = JavaPic_hqjpg.getImageIcon();
tutorialImg = JavaPic_tutorialjpg.getImageIcon();
instructionImg = JavaPic_instructionjpg.getImageIcon();
homeworkImg = JavaPic_homeworkjpg.getImageIcon();

}


private class ButtonHandler implements ActionListener {
public void actionPerformed( ActionEvent event ) {
String actionText = event.getActionCommand();

// find the button that was pressed
if ( actionText.equals( INSTRUCTION ) ) {
application.initInstructionMode();
}
else if ( actionText.equals( EXPLORATION ) ) {
application.initExplorationMode();
}
else if ( actionText.equals( SELECTION ) ) {
application.initHQ();
}
else if ( actionText.equals( TEST ) ) {
application.initTestMode();
}
else if ( actionText.equals( HOMEWORK ) ) {
// TODO: implement homework mode
//application.initHomeworkMode();
}
}
}


private Application application;

private static final String INSTRUCTION = "Instruction";

private static final String EXPLORATION = "Tutorial ";

private static final String HOMEWORK = "Homework";

private static final String TEST = "Test ";

private static final String SELECTION = "HQ ";

private static final String HEADER_TEXT = "Where would you like to go?";

private static final String SELECTION_TOOLTIP = "Go back to the central navigation screen";

private static final String EXPLORATION_TOOLTIP = "Learn about linear regression through an interactive tutorial";

private static final String INSTRUCTION_TOOLTIP = "Show linear regression to the class";

private static final String TEST_TOOLTIP = "Take a test on linear regression";

private static final String HOMEWORK_TOOLTIP = "Do linear regression homework";

private ImageIcon instructionImg;

private ImageIcon testImg;

private ImageIcon homeworkImg;

private ImageIcon hqImg;

private ImageIcon tutorialImg;
}


Panel.java
-------------------------------------------------------------------
/*
* Created on Mar 23, 2005
*/

/**
* @author Andrew Owens
*/

import javax.swing.JPanel;

public abstract class Panel extends JPanel {
/**
* Returns the name to be displayed on the tab above the panel
*/
public abstract String getName();


/**
* Updates the contents of the panel
*/
public abstract void updateContents();


/**
* Returns a String representing the panel's current contents
*
* @return A String representing the panel's current contents
*/
public String getContents() {
return "";
}


public Panel() {

}
}


PanelSeparator.java
-------------------------------------------------------------------
/*
* Created on Mar 23, 2005
*/

/**
* @author Andrew Owens
*/

import javax.swing.JTabbedPane;
import java.util.ArrayList;
import java.util.Iterator;

public class PanelSeparator extends JTabbedPane {

public PanelSeparator( Application app, ConfigManager configManager,
StatManager statManager, PointTable newTable ) {
application = app;
panels = new ArrayList();
initGUI();
initPanels( configManager, statManager, newTable );
attachPanels();

}


/**
* Updates the contents of each panel
*/
public void updatePanels() {
Iterator panelIt = panels.iterator();
while ( panelIt.hasNext() ) {
Panel panel = (Panel) panelIt.next();
panel.updateContents();
}
}


/**
* Create and initialize each panel, store them in an ArrayList
*/
private void initPanels( ConfigManager configManager,
StatManager statManager, PointTable newTable ) {
StatPanel statPanel = new StatPanel( configManager, statManager );
TableEditor tableEditorPanel = new TableEditor( newTable );
ConfigEditor configEditorPanel = new ConfigEditor( configManager );

// the navigation tab

panels.add( statPanel );
panels.add( tableEditorPanel );
panels.add( configEditorPanel );
}


/**
* Add each element in the panel list to the tabbed pane.
*/
private void attachPanels() {
Iterator panelIt = panels.iterator();

while ( panelIt.hasNext() ) {
Panel panel = (Panel) panelIt.next();
addTab( panel.getName(), null, panel, "" );
}

addNavigationPanel();
}


private void addNavigationPanel() {
addTab( "Navigation", new NavigationPanel( "Instruction", application ) );
}

/**
* Set up the layout and GUI information
*/
private void initGUI() {
}

// a list that contains each Panel
private ArrayList panels;

private Application application;
}


Point.java
-------------------------------------------------------------------
/*
* Created on Mar 23, 2005
*/

/**
* @author Andrew Owens
*/

import java.awt.geom.Point2D;

public class Point extends Point2D.Double {
public String toString() {
return "";
}


public Point() {
setLocation( 0, 0 );
}


public Point( double newX, double newY ) {
super( newX, newY );
}


public Point( Point2D p ) {
setX( p.getX() );
setY( p.getY() );
}


public void setX( double newX ) {
setLocation( newX, getY() );
}


public void setY( double newY ) {
setLocation( getX(), newY );
}
}


PointTable.java
-------------------------------------------------------------------
/*
* Created on Mar 23, 2005
*/

/**
* @author Andrew Owens
*/

import java.util.ArrayList;
import java.util.Comparator;
import java.util.ConcurrentModificationException;
import javax.swing.table.AbstractTableModel;
import java.util.AbstractCollection;
import javax.swing.event.TableModelListener;
import javax.swing.event.TableModelEvent;
import java.util.Collections;
public class PointTable {

public PointTable( GraphCoordinator coordinator ) {
pointComparator = new Comparator() {
public int compare( Object first, Object second ) {
Point firstPoint = (Point)first;
Point secondPoint = (Point)second;

if ( firstPoint == null ) {
return 1;
}
else if ( secondPoint == null ) {
return -1;
}
else if ( firstPoint.getX() < secondPoint.getX() ) {
return -1;
}
else {
return 1;
}
}
};
this.coordinator = coordinator;
points = new ArrayList();
tableModel = new TableModel();
updateTable();
}


public AbstractCollection getPointList() {
return points;
}


public boolean isChanged() {
return isChanged;
}

public void updateState() {
isChanged = false;
}


/**
* Add the provided point to the table
*
* @param point
* The point to add
*/
public void addPoint( Point point ) {
try {
points.add( point );

// this method is used from the outside, so we need to notify the
// table model of these changes
updateTable();
} catch ( ConcurrentModificationException e ) {
// if there was a concurrent modification, then we can ignore it
//System.out.println( e.getMessage() );
}
}


public TableModel getTableModel() {
return tableModel;
}


public void updateTable() {
sortPoints();
if ( points.size() == 0 ) {
addRow();
}
else if ( points.get( points.size() - 1 ) != null ) {
addRow();
}

isChanged = true;

tableModel.fireTableChanged( null );

coordinator.updateGraph();
}


public void clear() {
points.clear();
updateTable();
}


private void addRow() {
points.add( null );
}


private void sortPoints() {
// sort the points, placing null (blank) entries
// at the end
Collections.sort( points, pointComparator );
}


private class TableModel extends AbstractTableModel implements TableModelListener {

public void tableChanged( TableModelEvent e ) {

}


public int getColumnCount() {
return 2;
}


public int getRowCount() {
return points.size();
}


public String getColumnName( int col ) {
return ( col == 0 ) ? "x" : "y";
}


public Object getValueAt( int row, int col ) {
Point point = (Point) points.get( row );

if ( point == null ) {
return null;
}
// we'll display the numbers as
// Integers rather than Doubles
// because it's awkward to
// manipulate floating-point
// numbers in the table
if ( col == 0 ) {

return new Integer( (int) point.getX() );
}
else {
return new Integer( (int) point.getY() );
}
}


public Class getColumnClass( int col ) {
return new Integer( 0 ).getClass();
}


public boolean isCellEditable( int row, int col ) {
return true;
}


/**
* Sets the corresponding position to the given value and accounts for
* invalid points
*
* @param value
* The new value to set
* @param row
* The row value to change
* @param col
* The column value to change
*/
public void setValueAt( Object value, int row, int col ) {
Point point = (Point) points.get( row );

// we need to check if point is
// null because a null
// point is an empty one
if ( point == null ) {
// add a new point at the
// same position
Point newPoint = new Point();
points.set( row, newPoint );
point = newPoint;

}

if ( value != null ) {
if ( col == 0 ) {
point.setX( ( (Integer) value ).intValue() );
}
else {
point.setY( ( (Integer) value ).intValue() );
}
}

// we tell swing that we updated the whole
// table because if the point was null, then we're
// changing both the x and y, which it won't
// know otherwise
updateTable();
}

}


private ArrayList points;

private boolean isChanged;

private TableModel tableModel;

private GraphCoordinator coordinator;

private Comparator pointComparator;
}


Question.java
-------------------------------------------------------------------
/*
* Created on Apr 11, 2005
*/

/**
* @author Doug Tremblay
*/

public class Question {

public Question() { }

public void setQuestion( String inputQuestion ) {
question = inputQuestion;
}

public void setAnswer( String inputAnswer ) {
answer = inputAnswer;
}

public void setWrongAnswer1( String inputWrongAnswer1 ) {
wrongAnswer1 = inputWrongAnswer1;
}

public void setWrongAnswer2( String inputWrongAnswer2 ) {
wrongAnswer2 = inputWrongAnswer2;
}

public void setWrongAnswer3( String inputWrongAnswer3 ) {
wrongAnswer3 = inputWrongAnswer3;
}

public String getQuestion() {
return question;
}

public String getAnswer() {
return answer;
}

public String getWrongAnswer1() {
return wrongAnswer1;
}

public String getWrongAnswer2() {
return wrongAnswer2;
}

public String getWrongAnswer3() {
return wrongAnswer3;
}

private String question;

private String answer;

private String wrongAnswer1;

private String wrongAnswer2;

private String wrongAnswer3;

}


Rectangle.java
-------------------------------------------------------------------
/*
* Created on Mar 23, 2005
*/

/**
* @author Andrew Owens
*/

import java.awt.geom.Rectangle2D;

public class Rectangle extends Rectangle2D.Double {
public String toString() {
return "";
}


public Rectangle() {
setRect( 0, 0, 0, 0 );
}


public Rectangle( double x1, double y1, double x2, double y2 ) {
super( x1, y1, x2, y2 );
}
}


SailApplet.java
-------------------------------------------------------------------
import javax.swing.*;


public class SailApplet extends JApplet {

public void init() {
new Application(this);
}
}


SelectionScreen.java
-------------------------------------------------------------------
/*
* Created on Apr 10, 2005
*/

/**
* @author Andrew Owens
*/

import javax.swing.*;
import java.awt.*;

public class SelectionScreen extends JPanel {
public SelectionScreen( Application app, Container cp ) {
application = app;
contentPane = cp;
initGUI();
}


private void initGUI() {
setBackground( Color.WHITE );
SpringLayout layout = new SpringLayout();
// JComponent welcomeText = new JLabel( WELCOME_TEXT, JavaPic_hqjpg.getImageIcon(), JLabel.CENTER );
JPanel leftPanel = new SelectionScreenIntro();
NavigationPanel navPanel = new NavigationPanel( "HQ ", application );

// welcome text at ( 100, 100 )
layout.putConstraint( SpringLayout.WEST, leftPanel, 50, SpringLayout.WEST, contentPane );
layout.putConstraint( SpringLayout.NORTH, leftPanel, 20, SpringLayout.NORTH, contentPane );

// put the navigation panel on the right
layout.putConstraint( SpringLayout.WEST, navPanel, 500, SpringLayout.WEST, leftPanel );
layout.putConstraint( SpringLayout.NORTH, navPanel, 0, SpringLayout.NORTH, leftPanel );

setLayout( layout );

//add( welcomeText );
add( leftPanel );
add( navPanel );
}


private Application application;


private static final String WELCOME_TEXT = ""
+ "
HQ

"
+ "For class demonstration, choose Instruction."
+ "";

private Container contentPane;


}


SelectionScreenIntro.java
-------------------------------------------------------------------
/*
* Created on Apr 17, 2005
*/

/*
* @author Andrew Owens
*/

import java.awt.*;
import javax.swing.*;

public class SelectionScreenIntro extends JPanel {
public SelectionScreenIntro() {
setBackground( Color.WHITE );
setLayout( new BoxLayout( this, BoxLayout.Y_AXIS ) );
//add( new JLabel( "
HQ

" ) );
ImageIcon backgroundHQ = new ImageIcon( "Data/backgroundhq.jpg" );
add( new JLabel( "", backgroundHQ, JLabel.CENTER ));
//add( new JLabel( "





"));
}

}


Setting.java
-------------------------------------------------------------------
/*
* Created on Mar 24, 2005
*/

/**
* @author Andrew Owens
*/
public class Setting {

public boolean isValid() {
return isValid;
}


public boolean booleanValue() {
return ( (Boolean) variant ).booleanValue();
}


public String stringValue() {
return (String) variant;
}


public int intValue() {
return ( (Integer) variant ).intValue();
}


public double doubleValue() {
return ( (Double) variant ).doubleValue();
}


public Setting() {
isValid = false;
}


public Setting( Object newVariant ) {
variant = newVariant;
isValid = true;
}

private Object variant;

private boolean isValid;
}


SSResDevDisplay.java
-------------------------------------------------------------------
/*
* Created on Apr 13, 2005
*/

/**
* @author Andrew Owens
*/

import javax.swing.*;
import java.awt.*;

public class SSResDevDisplay extends JPanel {
public SSResDevDisplay() {
ssResLen = 0;
ssDevLen = 0;
}

public void onUpdate( double ssRes, double ssDev ) {
// get the lengths of SSres and SSdev by taking the
// square root of each
ssResLen = Math.sqrt( ssRes );
ssDevLen = Math.sqrt( ssDev );

// scale each of the lengths
ssResLen = scaleDimension( ssResLen );
ssDevLen = scaleDimension( ssDevLen );

}


public void paintComponent( Graphics g ) {
g.clearRect(0, 0, getWidth(), getHeight() );

g.setColor( Color.BLACK );
g.drawString( SSRES_TEXT, 10, 10 + 10 );
g.drawString( SSDEV_TEXT, 10, 10 + (int)ssResLen + 10 + 10 );

g.setColor( Color.RED );
g.fillRect( SSRES_TEXT.length() * 8, 10, SSRES_TEXT.length() * 8 + (int)ssResLen, (int)ssResLen + 10 );


g.setColor( ColorSchemeManager.DEVATION );
g.fillRect( SSDEV_TEXT.length() * 8, (int)ssResLen + 10, SSDEV_TEXT.length() * 8 + (int)ssDevLen, (int)ssDevLen + (int)ssResLen + 10 + 10);
}


private double scaleDimension( double dimension ) {
return dimension * DIMENSION_SCALE;
}

private double ssResLen;

private double ssDevLen;

private static final String SSRES_TEXT = "SSres = ";

private static final String SSDEV_TEXT = "SSdev = ";
private static final double DIMENSION_SCALE = 0.1;
}


StatManager.java
-------------------------------------------------------------------
/*
* Created on Mar 24, 2005
*/

/**
* @author Doug Tremblay
* @author Andrew Owens
*/

import java.util.AbstractCollection;
import java.util.Iterator;
import java.util.ArrayList;

public class StatManager {
public StatManager( GraphCoordinator newCoordinator, PointTable table ) {
pointTable = table;
coordinator = newCoordinator;
regressionLine = null;
}


private double sigmaX() {
double sigma = 0;

AbstractCollection container = getPointList();
Iterator it = container.iterator();
while ( it.hasNext() ) {
Point p = (Point) it.next();

// ignore null pointers
if ( p != null ) {
sigma += p.getX();
}

}
return sigma;
}


private double sigmaY() {
double sigma = 0;

AbstractCollection container = getPointList();
Iterator it = container.iterator();
while ( it.hasNext() ) {

Point p = (Point) it.next();
// ignore null pointers
if ( p != null ) {
sigma += p.getY();
}
}
return sigma;
}


public int countPoints() {
return getPointList().size();
}


public double calcXBar() {
return sigmaX() / countPoints();
}


public double calcYBar() {
return sigmaY() / countPoints();
}


public double calcSSres( Line line ) {
double sum = 0;

AbstractCollection container = getPointList();
Iterator it = container.iterator();
while ( it.hasNext() ) {
Point p = (Point) it.next();

sum += Math.pow( line.findResidual( p ), 2 );
}
return sum;
}


public double calcSSres() {
return calcSSres( calcRegressionLine() );
}


public double calcSSdev() {
double sum = 0;
double yBar = calcYBar();

AbstractCollection container = getPointList();
Iterator it = container.iterator();
while ( it.hasNext() ) {
Point p = (Point) it.next();

sum += Math.pow( ( p.getY() - yBar ), 2 );

}
return sum;
}


public double calcRSquare() {
return ( calcSSdev() - calcSSres() ) / calcSSdev();
}


public double calcR() {
return Math.sqrt( calcRSquare() );
}


public Line calcRegressionLine() {
if ( regressionLine == null ) {
regressionLine = calcBestFit();
}
return regressionLine;
}


public Line calcBestFit() {
double sigmaXY = 0;
double sigmaXX = 0;
double xBar = calcXBar();
double yBar = calcYBar();

AbstractCollection container = getPointList();
Iterator it = container.iterator();
while ( it.hasNext() ) {
Point p = (Point) it.next();

sigmaXY += ( ( p.getX() - xBar ) * ( p.getY() - yBar ) );
sigmaXX += Math.pow( ( p.getX() - xBar ), 2 );
}
double m = sigmaXY / sigmaXX;
double b = yBar - m * xBar;

return new Line( m, b );
}

public Point nearestPoint( Point startPoint ) {
AbstractCollection container = getPointList();
Iterator it = container.iterator();

double smallestSqDistance = -1;

boolean firstPass = true;

Point nearest = null;

if ( countPoints() == 0 ) {
return null;
}

while ( it.hasNext() ) {

Point point = (Point) it.next();

double sqDistance = startPoint.distanceSq( point );

if ( firstPass ) {
nearest = point;
smallestSqDistance = sqDistance;
firstPass = false;
}
if ( sqDistance < smallestSqDistance ) {
nearest = point;
smallestSqDistance = sqDistance;
}

}

return nearest;
}


/**
* Tells Swing to refresh the table because the StatManager or user of
* StatManager changed it.
*/
public void refreshTable() {
// TODO: there's probably a safer/cleaner way to do this
pointTable.updateTable();
}


/**
* Returns a collection of valid points with no null pointers
*
* @return Returns a container of valid points
*/
public AbstractCollection getPointList() {
AbstractCollection mixedList = pointTable.getPointList();
ArrayList validPoints = new ArrayList();
Iterator pointIt = mixedList.iterator();

// the caller is assured that there are no
// empty (null) points, so we have
// to iterate through the list
// and grab only the valid ones
while ( pointIt.hasNext() ) {
Point point = (Point) pointIt.next();

if ( point != null ) {
validPoints.add( point );
}
}
return validPoints;
}


public boolean tableChanged() {
return pointTable.isChanged();
}


public static double roundStat( double stat, int numDecimalPlaces ) {
double newStat = stat * Math.pow( 10, numDecimalPlaces );
newStat = Math.round( newStat );
return newStat / Math.pow( 10, numDecimalPlaces );
}


public void setRegressionLine( Line newRegressionLine ) {
regressionLine = newRegressionLine;
}


public void useBestFitRegressionLine() {
regressionLine = null;
}

private Line regressionLine;

private Application application;

private PointTable pointTable;

private GraphCoordinator coordinator;
}


StatPanel.java
-------------------------------------------------------------------
/*
* Created on Mar 23, 2005
*/

/**
* @author Andrew Owens
*/

import javax.swing.JLabel;
//import javax.swing.JSeparator;
import javax.swing.BoxLayout;

public class StatPanel extends Panel {
public StatPanel( ConfigManager newConfigManager, StatManager newStatManager ) {
configManager = newConfigManager;
statManager = newStatManager;
ssDisplay = new SSResDevDisplay();
initGUI();
initStats();
}


private void initGUI() {
BoxLayout layout = new BoxLayout( this, BoxLayout.Y_AXIS );
setLayout( layout );
setSize( 250, 400 );
ssDisplay.setVisible( false );
}


private void initStats() {
statDisplay = new JLabel( "" );

add( statDisplay );
add( ssDisplay );
}


public String getName() {
return PANEL_NAME;
}


public void updateContents() {
if ( statManager.tableChanged() ) {
setStats();
}

if ( ( configManager.querySetting( "PlotResSquares" ).booleanValue()
|| configManager.querySetting( "PlotDevSquares" ).booleanValue() )
&& statManager.countPoints() > 0 ) {
ssDisplay.setVisible( true );
// update the SSres and SSdev display if we have one point and an SS is on
ssDisplay.onUpdate( statManager.calcSSres(), statManager.calcSSdev() );
ssDisplay.repaint();
}
else {
ssDisplay.setVisible( false );
}
}


private void setStats() {
Line regressionLine = statManager.calcRegressionLine();

StringBuffer display = new StringBuffer();

// TODO:
// Find a better way to translate the stats
// to the right than adding    to the beginning
// of the text

display.append( "
" );
if ( configManager.querySetting( "ShowEquation" ).isValid()
&& configManager.querySetting( "ShowEquation" ).booleanValue() ) {

display.append( "  ŷ = " + StatManager.roundStat( regressionLine.getSlope(), 3 )
+ "x + "
+ StatManager.roundStat( regressionLine.getYIntercept(), 3 )
+ "

" );
}
if ( configManager.querySetting( "ShowXYBars" ).isValid()
&& configManager.querySetting( "ShowXYBars" ).booleanValue() ) {
display.append( "  x = "
+ StatManager.roundStat( statManager.calcXBar(), 3 )
+ "

" );
display.append( "  y = "
+ StatManager.roundStat( statManager.calcYBar(), 3 )
+ "

" );
}
if ( configManager.querySetting( "ShowR" ).isValid()
&& configManager.querySetting( "ShowR" ).booleanValue() ) {
display.append( "  r = "
+ StatManager.roundStat( statManager.calcR(), 4 )
+ "

" );
}
if ( configManager.querySetting( "ShowRSquared" ).isValid()
&& configManager.querySetting( "ShowRSquared" ).booleanValue() ) {
display.append( "  r2 = "
+ StatManager.roundStat( statManager.calcRSquare(), 4 )
+ "

" );
}
if ( configManager.querySetting( "ShowSSres").isValid()
&& configManager.querySetting( "ShowSSres").booleanValue() ) {

display.append( "  SSres = "
+ StatManager.roundStat( statManager.calcSSres(), 3 )
+ "

" );
}
if ( configManager.querySetting( "ShowSSdev" ).isValid()
&& configManager.querySetting( "ShowSSdev").booleanValue() ) {

display.append( "  SSdev = "
+ StatManager.roundStat( statManager.calcSSdev(), 3 )
+ "

" );
}


display.append( "" );
statDisplay.setText( display.toString() );
}



private JLabel statDisplay;

private ConfigManager configManager;

private StatManager statManager;

private SSResDevDisplay ssDisplay;

private static final String PANEL_NAME = "Statistics";
}


StatTests.java
-------------------------------------------------------------------
/**
* @author Doug Tremblay
*/
public class StatTests extends Tester {

public StatTests (StatManager stats) {
statManager = stats;
initTable();

}

public void doTest() {
nearestPointTest();
}

public void sigmaXTest() {
//System.out.println(statManager.sigmaX());
}

public void sigmaYTest() {
//System.out.println(statManager.sigmaY());
}

public void countPointsTest() {
System.out.println(statManager.countPoints());
}

private void calcXBarTest() {
System.out.println(statManager.calcXBar());
}

private void calcYBarTest() {
System.out.println(statManager.calcYBar());
}

private void calcBestFitTest() {
Line line = statManager.calcBestFit();
System.out.println("m = " + line.getSlope());
System.out.println("b = " + line.getYIntercept());
}

private void calcSSresTest() {
System.out.println(statManager.calcSSres(statManager.calcBestFit()));
}

private void calcSSdevTest() {
System.out.println(statManager.calcSSdev());
}

private void calcRSquareTest() {
System.out.println(statManager.calcRSquare());
}

private void nearestPointTest() {
Point start = new Point(3,3);
Point point = statManager.nearestPoint(start);
System.out.println("(" + point.getX() + ", " + point.getY() + ")");

}

private void initTable() {
//statManager.pointTable.addPoint( new Point(2, 3));
//statManager.pointTable.addPoint( new Point(4, 3));
//statManager.pointTable.addPoint( new Point(6, 7));
}

private StatManager statManager;

}


TableEditor.java
-------------------------------------------------------------------
/*
* Created on Mar 23, 2005
*/

/**
* @author Andrew Owens
*/

import javax.swing.JScrollPane;
import javax.swing.JTable;
import java.awt.Dimension;
import javax.swing.JButton;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;

public class TableEditor extends Panel {
public TableEditor( PointTable newTable ) {
pointTable = newTable;
initGUI();
}


public String getName() {
return PANEL_NAME;
}


public void updateContents() {

}


private void initGUI() {
setSize( 230, 200 );
viewedTable = new JTable( pointTable.getTableModel() );

// get rid of the vertical separator in the
// table
viewedTable.setShowHorizontalLines( false );

// remove the annoying background color
viewedTable.setSelectionBackground( Color.WHITE );

// TODO: HACK - DON'T CHANGE THE DIMENSIONS!
// For some reason the width of this table
// perfectly balances the alignment of the
// table PanelSeparator and the tabs'
// correct placement! - AO

viewedTable.setPreferredScrollableViewportSize( new Dimension( 270, 310 ) );
JScrollPane scrollPane = new JScrollPane( viewedTable );

// always show the vertical scroll bar
scrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );

JButton clearButton = new JButton( "Clear" );
//JButton rowButton = new JButton( "Add Point" );

clearButton.addActionListener( new ClearButtonHandler() );
//rowButton.addActionListener( new AddRowButtonHandler() );

setLayout( new BorderLayout() );

add( scrollPane, BorderLayout.NORTH );

//add( rowButton );
add( clearButton, BorderLayout.SOUTH );

setVisible( true );
}

private class ClearButtonHandler implements ActionListener {
public void actionPerformed( ActionEvent event ) {
clearTable();
}
}


/*
* private class AddRowButtonHandler implements ActionListener { public void
* actionPerformed( ActionEvent event ) { //addRow(); } }
*/

private void clearTable() {
pointTable.clear();
}

/*
* private void addRow() { pointTable.addRow(); }
*/

private JTable viewedTable;

private PointTable pointTable;

private static final String PANEL_NAME = "Table";
}


Tester.java
-------------------------------------------------------------------
/*
* Created on Apr 4, 2005
*/

/*
* @author Andrew Owens
*
*/

import java.io.*;

class IOReader {
public static String readString() {
java.io.InputStreamReader isr = new java.io.InputStreamReader(System.in);
java.io.BufferedReader d = new java.io.BufferedReader(isr);
try { return d.readLine(); } catch (Exception e) { return "error"; }
}
public static int readInt() { return Integer.parseInt(readString()); }
public static double readDouble() {
return Double.valueOf(readString()).doubleValue();
}
}


public abstract class Tester {
public Tester() {
report = new String();
}


public abstract void doTest();


public void doReport( OutputStreamWriter out ) {
try {
out.write( report );
out.close();
}
catch ( Exception e ) {

}
}

protected void println( String str ) {
report = str + "\n";
}

protected void print( String str ) {
report = str;
}

private String report;
}


UnitTester.java
-------------------------------------------------------------------