Class ImageEditor

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--ImageEditor

public class ImageEditor
extends JFrame

A class for editing small images for use in the games.
This class has been written to allow people to easily edit icon like images
for use in the game. It is not intended to be a full featured editor, but it
is much easier to use than doing by hand coding of Graphics drawing statements.
It also features easy ways to do arrays and 2D arrays of images that can be
loaded in to simplify animations or different modes for types.


Inner Class Summary
 (package private) classImageEditor.ImagePanel
           
 (package private) classImageEditor.ImageSelectionPanel
           

Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled, accessibleContext

Fields inherited from class java.awt.Frame
DEFAULT_CURSOR, CROSSHAIR_CURSOR, TEXT_CURSOR, WAIT_CURSOR, SW_RESIZE_CURSOR, SE_RESIZE_CURSOR, NW_RESIZE_CURSOR, NE_RESIZE_CURSOR, N_RESIZE_CURSOR, S_RESIZE_CURSOR, W_RESIZE_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, MOVE_CURSOR, NORMAL, ICONIFIED

Fields inherited from class java.awt.Component
TOP_ALIGNMENT, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT

Constructor Summary
ImageEditor()
          The default constructor

Method Summary
 static voidmain(String[] args)
          The main method simply creates an object of type ImageEditor.
 static BufferedImage[][]readImageArray2D(String fileName)
          This method reads in a 2D array of images from a file.
 static BufferedImage[][]readImageArray2D(DataInputStream dis)
          This method reads in a 2D array of images from a file.
 voidwriteImageArray2D(BufferedImage[][] img, String fileName)
          This function writes a 2D array of images out to file.
 voidwriteImageArray2D(BufferedImage[][] img, DataOutputStream dos)
          This function writes a 2D array of images out to file.

Methods inherited from class javax.swing.JFrame
frameInit, createRootPane, processKeyEvent, processWindowEvent, setDefaultCloseOperation, getDefaultCloseOperation, update, setJMenuBar, getJMenuBar, isRootPaneCheckingEnabled, setRootPaneCheckingEnabled, addImpl, remove, setLayout, getRootPane, setRootPane, getContentPane, setContentPane, getLayeredPane, setLayeredPane, getGlassPane, setGlassPane, paramString, getAccessibleContext

Methods inherited from class java.awt.Frame
finalize, addNotify, getTitle, setTitle, getIconImage, setIconImage, getMenuBar, setMenuBar, isResizable, setResizable, setState, getState, remove, removeNotify, setCursor, getCursorType, getFrames

Methods inherited from class java.awt.Window
pack, show, hide, dispose, toFront, toBack, getToolkit, getWarningString, getLocale, getInputContext, setCursor, getOwner, getOwnedWindows, addWindowListener, removeWindowListener, getListeners, processEvent, getFocusOwner, postEvent, isShowing, applyResourceBundle, applyResourceBundle, getGraphicsConfiguration

Methods inherited from class java.awt.Container
getComponentCount, countComponents, getComponent, getComponents, getInsets, insets, add, add, add, add, add, remove, removeAll, getLayout, doLayout, layout, invalidate, validate, validateTree, setFont, getPreferredSize, preferredSize, getMinimumSize, minimumSize, getMaximumSize, getAlignmentX, getAlignmentY, paint, print, paintComponents, printComponents, addContainerListener, removeContainerListener, processContainerEvent, deliverEvent, getComponentAt, locate, getComponentAt, findComponentAt, findComponentAt, isAncestorOf, list, list

Methods inherited from class java.awt.Component
getName, setName, getParent, getPeer, setDropTarget, getDropTarget, getTreeLock, isValid, isDisplayable, isVisible, isEnabled, setEnabled, enable, enable, disable, isDoubleBuffered, enableInputMethods, setVisible, show, getForeground, setForeground, getBackground, setBackground, getFont, setLocale, getColorModel, getLocation, getLocationOnScreen, location, setLocation, move, setLocation, getSize, size, setSize, resize, setSize, resize, getBounds, bounds, setBounds, reshape, setBounds, getX, getY, getWidth, getHeight, getBounds, getSize, getLocation, isOpaque, isLightweight, getGraphics, getFontMetrics, getCursor, paintAll, repaint, repaint, repaint, repaint, printAll, imageUpdate, createImage, createImage, prepareImage, prepareImage, checkImage, checkImage, contains, inside, contains, dispatchEvent, addComponentListener, removeComponentListener, addFocusListener, removeFocusListener, addHierarchyListener, removeHierarchyListener, addHierarchyBoundsListener, removeHierarchyBoundsListener, addKeyListener, removeKeyListener, addMouseListener, removeMouseListener, addMouseMotionListener, removeMouseMotionListener, addInputMethodListener, removeInputMethodListener, getInputMethodRequests, enableEvents, disableEvents, coalesceEvents, processComponentEvent, processFocusEvent, processMouseEvent, processMouseMotionEvent, processInputMethodEvent, processHierarchyEvent, processHierarchyBoundsEvent, handleEvent, mouseDown, mouseDrag, mouseUp, mouseMove, mouseEnter, mouseExit, keyDown, keyUp, action, gotFocus, lostFocus, isFocusTraversable, requestFocus, transferFocus, nextFocus, hasFocus, add, toString, list, list, list, addPropertyChangeListener, removePropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, firePropertyChange, setComponentOrientation, getComponentOrientation

Methods inherited from class java.lang.Object
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait

Constructor Detail

ImageEditor

public ImageEditor()
The default constructor
Method Detail

main

public static void main(String[] args)
The main method simply creates an object of type ImageEditor.

readImageArray2D

public static BufferedImage[][] readImageArray2D(String fileName)
throws java.io.IOException
This method reads in a 2D array of images from a file.
Parameters:
fileName The name of the file to open up for reading.
Returns: Returns a 2D array of images.
Throws:
IOException This can throw in IOException if something goes wrong opening the file or reading from it.

readImageArray2D

public static BufferedImage[][] readImageArray2D(DataInputStream dis)
throws java.io.IOException
This method reads in a 2D array of images from a file.
Parameters:
dis The DataInputStream to read from.
Returns: Returns a 2D array of images.
Throws:
IOException This can throw in IOException if something goes wrong reading from the DataInputStream.

writeImageArray2D

public void writeImageArray2D(BufferedImage[][] img, String fileName)
throws java.io.IOException
This function writes a 2D array of images out to file.
Parameters:
img This is the 2D array of BufferedImages that is to be written.
fileName The name of the file that is should be written to.
Throws:
This can throw in IOException if something goes wrong opening the file or writing to it.

writeImageArray2D

public void writeImageArray2D(BufferedImage[][] img, DataOutputStream dos)
throws java.io.IOException
This function writes a 2D array of images out to file.
Parameters:
img This is the 2D array of BufferedImages that is to be written.
dos The DataOutputStream that is should be written to.
Throws:
This can throw in IOException if something goes wrong to the DataOutputStream.

Association Links

to Class java.awt.image.BufferedImage

to Class ImageEditor.ImagePanel

to Class ImageEditor.ImageSelectionPanel

to Class javax.swing.JColorChooser

to Class javax.swing.JSlider

to Class java.lang.String