Class Paint

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by Paint
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ComponentListener, java.awt.event.KeyListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ListSelectionListener, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class Paint
extends javax.swing.JFrame
implements java.awt.event.ActionListener, javax.swing.event.ListSelectionListener, java.awt.event.KeyListener, java.awt.event.ComponentListener

TODO Put here a description of what this class does.

Author:
ian. Created Mar 22, 2008.
See Also:
Serialized Form

Nested Class Summary
(package private)  class Paint.opener
          this class allows a picture file to be opened in Paint
(package private)  class Paint.saver
          the class that allows Paint to save files
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
(package private)  javax.swing.JViewport b
          the view area fro JPaint
(package private)  java.util.ArrayList<Brush> brush
          This is a list of all of the tools that are on the tool window
(package private)  javax.swing.JList brushes
          the actual list of brushes
(package private)  javax.swing.JScrollPane brushlist
          this is the pane that hols the list of tools
(package private)  javax.swing.JScrollBar brushscroller
          this scroll bar for the list of brushes
(package private)  javax.swing.JPanel buttons
          this holds the button for custom brushes
(package private)  Canvas canvas
          This is the space that all of the drawing exists on
(package private)  javax.swing.JColorChooser cc
          the is the color chooser menu for the toolbar window
(package private)  javax.swing.JMenuItem deselect
          the deslect pixels command
(package private)  javax.swing.JMenu edit
          the Edit menu
(package private)  javax.swing.JMenuItem exit
          the exit program command
(package private)  javax.swing.JFileChooser fc
          this is the file chooser menu for opening and saving
(package private)  javax.swing.JMenu file
          the File menu
(package private)  javax.swing.JFrame frame
          the window for JPaint
(package private)  javax.swing.JScrollPane imageviewer
          this allows the scroll bar on the Jpaint window
(package private)  javax.swing.JScrollBar imageX
          this is the horizontal scroll bar
(package private)  javax.swing.JScrollBar imageY
          this is the vertical scroll bar
(package private)  java.awt.GridBagLayout l
          this grid for the JPaint window
(package private)  javax.swing.JButton makeBrush
          This is the button for making brushes for a picture file
(package private)  javax.swing.JMenuBar mb
          this is the menu bar for the JPaint window
(package private)  javax.swing.JTextField name
          the name of brushes
(package private)  javax.swing.JMenuItem New
          the new JPaint wwindow command
(package private)  javax.swing.JMenuItem open
          the open command
(package private)  javax.swing.JMenuItem redo
           
(package private)  javax.swing.JMenuItem save
          the save command
(package private)  javax.swing.JMenuItem showTools
          the command to bring back the toolbar window
(package private)  javax.swing.JSlider tolerance
          this is the slider that allows tolerance for magic wand and paintbucket
(package private)  javax.swing.JFrame toolPallet
          this is the Frame that holds all of the tool elements
(package private)  javax.swing.JPanel tools
          this holds the tools list
(package private)  javax.swing.JMenuItem undo
          the undo command
(package private)  javax.swing.JMenu view
          the View menu
(package private)  javax.swing.JTextField X
          the text field for naming files in x direction
(package private)  javax.swing.JTextField Y
          the text field for naming files in y direction
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Paint(int w, int h)
          the constructor for Paint
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent arg0)
           
 void componentHidden(java.awt.event.ComponentEvent e)
           
 void componentMoved(java.awt.event.ComponentEvent e)
           
 void componentResized(java.awt.event.ComponentEvent e)
           
 void componentShown(java.awt.event.ComponentEvent e)
           
 void create(java.awt.event.MouseEvent e)
          the creation of brush strokes in the Paint window
 void deselectAll(java.awt.event.MouseEvent e)
          Starts the program.
 void exitProgram(java.awt.event.MouseEvent e)
          exits the program
 void keyPressed(java.awt.event.KeyEvent arg0)
           
 void keyReleased(java.awt.event.KeyEvent arg0)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
static void main(java.lang.String[] args)
          This is what causes Paint to run
 void makebrush(java.awt.event.MouseEvent e)
          Creates a new brush to be selected from the list.
 void newCanvas(java.awt.event.MouseEvent e)
          creates a new canvas after new was selected from the file menu
 void openFile(java.awt.event.MouseEvent e)
          creates a new dialog to open a file.
 void redo(java.awt.event.MouseEvent e)
           
 void saveFile(java.awt.event.MouseEvent e)
          creates a new dialog to save a file
 void showTools(java.awt.event.MouseEvent e)
          Shows the tool pallet window
 void undo(java.awt.event.MouseEvent e)
          undoes the previous action up to 10 steps back.
 void valueChanged(javax.swing.event.ListSelectionEvent arg0)
           
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

canvas

Canvas canvas
This is the space that all of the drawing exists on


cc

javax.swing.JColorChooser cc
the is the color chooser menu for the toolbar window


mb

javax.swing.JMenuBar mb
this is the menu bar for the JPaint window


toolPallet

javax.swing.JFrame toolPallet
this is the Frame that holds all of the tool elements


brush

java.util.ArrayList<Brush> brush
This is a list of all of the tools that are on the tool window


fc

javax.swing.JFileChooser fc
this is the file chooser menu for opening and saving


makeBrush

javax.swing.JButton makeBrush
This is the button for making brushes for a picture file


buttons

javax.swing.JPanel buttons
this holds the button for custom brushes


tools

javax.swing.JPanel tools
this holds the tools list


brushlist

javax.swing.JScrollPane brushlist
this is the pane that hols the list of tools


imageviewer

javax.swing.JScrollPane imageviewer
this allows the scroll bar on the Jpaint window


imageX

javax.swing.JScrollBar imageX
this is the horizontal scroll bar


imageY

javax.swing.JScrollBar imageY
this is the vertical scroll bar


brushscroller

javax.swing.JScrollBar brushscroller
this scroll bar for the list of brushes


b

javax.swing.JViewport b
the view area fro JPaint


tolerance

javax.swing.JSlider tolerance
this is the slider that allows tolerance for magic wand and paintbucket


brushes

javax.swing.JList brushes
the actual list of brushes


frame

javax.swing.JFrame frame
the window for JPaint


l

java.awt.GridBagLayout l
this grid for the JPaint window


name

javax.swing.JTextField name
the name of brushes


edit

javax.swing.JMenu edit
the Edit menu


file

javax.swing.JMenu file
the File menu


view

javax.swing.JMenu view
the View menu


undo

javax.swing.JMenuItem undo
the undo command


redo

javax.swing.JMenuItem redo

New

javax.swing.JMenuItem New
the new JPaint wwindow command


save

javax.swing.JMenuItem save
the save command


open

javax.swing.JMenuItem open
the open command


deselect

javax.swing.JMenuItem deselect
the deslect pixels command


exit

javax.swing.JMenuItem exit
the exit program command


showTools

javax.swing.JMenuItem showTools
the command to bring back the toolbar window


X

javax.swing.JTextField X
the text field for naming files in x direction


Y

javax.swing.JTextField Y
the text field for naming files in y direction

Constructor Detail

Paint

public Paint(int w,
             int h)
the constructor for Paint

Parameters:
w - window width
h - window height
Method Detail

makebrush

public void makebrush(java.awt.event.MouseEvent e)
Creates a new brush to be selected from the list.

Parameters:
e -

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent arg0)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent arg0)
Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener

undo

public void undo(java.awt.event.MouseEvent e)
undoes the previous action up to 10 steps back.

Parameters:
e -

redo

public void redo(java.awt.event.MouseEvent e)

openFile

public void openFile(java.awt.event.MouseEvent e)
creates a new dialog to open a file.

Parameters:
e -

saveFile

public void saveFile(java.awt.event.MouseEvent e)
creates a new dialog to save a file

Parameters:
e -

exitProgram

public void exitProgram(java.awt.event.MouseEvent e)
exits the program

Parameters:
e -

newCanvas

public void newCanvas(java.awt.event.MouseEvent e)
creates a new canvas after new was selected from the file menu

Parameters:
e -

create

public void create(java.awt.event.MouseEvent e)
the creation of brush strokes in the Paint window

Parameters:
e -

showTools

public void showTools(java.awt.event.MouseEvent e)
Shows the tool pallet window

Parameters:
e -

deselectAll

public void deselectAll(java.awt.event.MouseEvent e)
Starts the program.

Parameters:
e -

keyPressed

public void keyPressed(java.awt.event.KeyEvent arg0)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent arg0)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

main

public static void main(java.lang.String[] args)
This is what causes Paint to run

Parameters:
args -

componentHidden

public void componentHidden(java.awt.event.ComponentEvent e)
Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
Specified by:
componentMoved in interface java.awt.event.ComponentListener

componentResized

public void componentResized(java.awt.event.ComponentEvent e)
Specified by:
componentResized in interface java.awt.event.ComponentListener

componentShown

public void componentShown(java.awt.event.ComponentEvent e)
Specified by:
componentShown in interface java.awt.event.ComponentListener