|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
main_canvas
public class main_canvas
The class main_canvas represents a blank rectangular area of the screen onto which the application can draw or from which the application can trap input events from the user. There are no OS/Hardware dependencies and no variances. There is no need for any security constraints and no references to external specifications.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
boolean |
brush
Default brush false. |
java.awt.Font |
current_font
Font object that represents a current font style. |
java.awt.Stroke |
current_stroke
Stroke object that represents the current stroke. |
int |
currentLayer
current layer. |
boolean |
curve
Default curve false. |
boolean |
elipse
Default elipse false. |
boolean |
eraser
Default eraser false. |
(package private) java.awt.Graphics2D |
gd
Graphics2D object which represents the canvas. |
boolean |
grayscale
Color scale or gray scale. |
int |
heig
height of canvas. |
javax.swing.JLayeredPane |
layeredPane
JLayeredPane object. |
java.util.LinkedList |
layerList
LinkedList object that contains the layers. |
java.awt.Color |
left_color
Color object that represents left mouse click event color. |
boolean |
letter
Default letter false. |
boolean |
line
Default line false. |
java.util.LinkedList |
list
LinkedList object that contains the LinkedLists of BufferedImages for layers separately. |
javax.swing.ImageIcon |
main_icon
Shows all image icons on TerpPaint. |
java.awt.image.BufferedImage |
main_image
BufferedImage object that represents main image. |
int |
max_list_len
max_list_len that indicates the max list length. |
boolean |
medicine
Default medicine false. |
java.util.Vector |
nameList
Vector object holding the Layer names. |
(package private) static double |
oldZoomFactor
Sets oldZoomFactor default 1.0. |
boolean |
paint
Default paint false. |
boolean |
pencil
Default pencil false. |
ScrollablePicture |
picture
Image that can be scrolled by setting either the horizontal scroll bar or the vertical scroll bar. |
javax.swing.JScrollPane |
pictureScrollPane
Provides scrolling functionality for the image. |
java.util.Vector |
place_list
Place[i] is the spot in the BufferedImage linked list for the ith layer. |
boolean |
polygon
Default polygon false. |
java.awt.Color |
right_color
Color object that represents right mouse click event color. |
boolean |
rounded_rectangle
Default rouned_rectangle false. |
boolean |
select
Default select false. |
boolean |
selectall
Default selectall false. |
boolean |
spray
Default spray false. |
boolean |
square
Default square false. |
(package private) java.awt.geom.AffineTransform |
t
AffineTransform object for various transformations. |
java.awt.image.BufferedImage |
temp_x
BufferedImage object that is for temporary storage. |
int |
widt
width of the canvas. |
boolean |
zoom
Default zoom false. |
double |
zoomFactor
Sets zoomFactor default 1.0. |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
main_canvas()
Starts loading the image icons. |
|
main_canvas(int h,
int w)
main_canvas constructor that creates a canvas of the size according to params. |
Method Summary | |
---|---|
void |
addLayer()
This method adds a new layer. |
int |
canvasScale(int coord)
This method returns the coordinate. |
void |
changeLayer(java.lang.String correct)
This method changes to another layer. |
void |
clear()
This method sets the main image with the default size and color. |
void |
drawIt(java.awt.Shape s)
This method creates and draws the graphics and adds to the image list. |
void |
flattenLayer(javax.swing.JDialog window)
This method flattens all layers into one. |
java.awt.image.BufferedImage |
getBufferedImage()
Returns the main image. |
java.awt.image.BufferedImage |
getCopy(java.awt.image.BufferedImage in)
Returns a copy of main image object. |
boolean |
getGrayscale()
Returns the grayscale or colorscale There are no OS/Hardware dependencies and no variances. |
double |
getOldZoom()
Returns the size of the old zoom factor. |
double |
getZoom()
Returns the size of the zoom factor. |
void |
invertColors()
This method inverts the colors for drawing with the graphics context. |
void |
itemStateChanged(java.awt.event.ItemEvent e)
This method responds to checkbox events. |
boolean |
madeChanges()
Returns true if any changes occur more than once; otherwise false. |
static void |
main(java.lang.String[] s)
Creates the main drawing frame. |
void |
moveBottom(int number)
This method used to move a layer to the bottom of the layer stack. |
void |
moveDown(int number)
This method used to move a layer down in the layer stack. |
void |
moveFront(int number)
This method used to move a layer to the top of the layer stack. |
void |
moveUp(int number)
This method used to move a layer up in the layer stack. |
void |
noChanges()
This method sets linked list to size 0, so that undo and redo are disabled. |
void |
paint(java.awt.Graphics g)
This method sets the main image scale and draw image if the main image is not null. |
boolean |
redo()
This method repeats the last drawing action. |
void |
removeLayer(int index)
This method removes a layer. |
void |
resetLayer()
This method resets the layer. |
void |
resizeImage(int width,
int height)
This method resizes the image. |
void |
setBufferedImage(java.awt.image.BufferedImage in)
This method sets the main image. |
void |
setFont(java.awt.Font f)
This method sets a current font style. |
void |
setLeftColor(java.awt.Color in)
This method sets the left mouse button color. |
void |
setOldZoom(double factor)
This method sets the size of the old zoom factor. |
void |
setRightColor(java.awt.Color in)
This method sets the right mouse button color. |
void |
setStroke(int in)
This method sets the characteristics of the rectangle's border or the lines for any other shape. |
void |
setZoom(double factor)
This method sets the zoomFactor. |
void |
sizeImage(int width,
int height)
This method resizes the image. |
void |
undo()
This method cancels the last drawing action. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public javax.swing.JLayeredPane layeredPane
public int max_list_len
public java.util.LinkedList layerList
public java.util.Vector nameList
public int currentLayer
public java.util.LinkedList list
public java.awt.image.BufferedImage main_image
public java.awt.image.BufferedImage temp_x
public java.awt.Color left_color
public java.awt.Color right_color
public boolean grayscale
public java.awt.Stroke current_stroke
public java.awt.Font current_font
public java.util.Vector place_list
public boolean line
public boolean curve
public boolean rounded_rectangle
public boolean square
public boolean polygon
public boolean elipse
public boolean selectall
public boolean eraser
public boolean paint
public boolean medicine
public boolean zoom
public boolean pencil
public boolean brush
public boolean spray
public boolean letter
public boolean select
public double zoomFactor
static double oldZoomFactor
public javax.swing.JScrollPane pictureScrollPane
public ScrollablePicture picture
public javax.swing.ImageIcon main_icon
public int widt
public int heig
java.awt.Graphics2D gd
java.awt.geom.AffineTransform t
Constructor Detail |
---|
public main_canvas()
public main_canvas(int h, int w)
w
- width paramh
- height paramMethod Detail |
---|
public void itemStateChanged(java.awt.event.ItemEvent e)
e
- provides the functionalities of ItemEventpublic boolean madeChanges()
public void noChanges()
public void clear()
public void setStroke(int in)
in
- the border size of the line.public void setFont(java.awt.Font f)
setFont
in class javax.swing.JComponent
f
- contains the specified font, style and size.public void drawIt(java.awt.Shape s)
s
- specifies the bounding of the image to display.public void resizeImage(int width, int height)
width
- a new width size of the image.height
- a new height size of the image.public void sizeImage(int width, int height)
width
- new widthheight
- new heightpublic void setBufferedImage(java.awt.image.BufferedImage in)
in
- contains information of buffered image.getBufferedImage()
public java.awt.image.BufferedImage getBufferedImage()
setBufferedImage(java.awt.image.BufferedImage)
public java.awt.image.BufferedImage getCopy(java.awt.image.BufferedImage in)
in
- contains information of buffered image.
public void setLeftColor(java.awt.Color in)
in
- the color to be the left_color.public void setRightColor(java.awt.Color in)
in
- the color to be the right_color.public void paint(java.awt.Graphics g)
paint
in class javax.swing.JComponent
g
- supports Graphics2D object to provide the functionality of it.public void undo()
public boolean redo()
public int canvasScale(int coord)
coord
- the scale of the coordinate.
public void setZoom(double factor)
factor
- the size of the zoom factor.getZoom()
public void setOldZoom(double factor)
factor
- the size of the zoom to be the old zoom factor.getOldZoom()
public double getZoom()
setZoom(double)
public double getOldZoom()
setOldZoom(double)
public boolean getGrayscale()
public void invertColors()
public void moveUp(int number)
number
- an int to represent layer number to movepublic void moveDown(int number)
number
- an int to represent layer number to movepublic void moveFront(int number)
number
- an int to represent layer number to movepublic void moveBottom(int number)
number
- an int to represent layer number to movepublic void changeLayer(java.lang.String correct)
correct
- correct layer to be displayedpublic void addLayer()
public void resetLayer()
public void removeLayer(int index)
index
- index of the layer to be removedpublic void flattenLayer(javax.swing.JDialog window)
window
- Shows the progress while flatteningpublic static void main(java.lang.String[] s)
s
- the command line argument.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |