fi.jyu.mit.graphics
Class EasyWindow

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 fi.jyu.mit.graphics.Window
                          extended by fi.jyu.mit.graphics.EasyWindow
All Implemented Interfaces:
Easy, Transformable, ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class EasyWindow
extends Window
implements Easy

Luokka jonka avulla voi helposti piirtää kuvioita ruudulle. Ikkunaan voi lisätä kuvioita, esimerkiksi

      window.addLine(0,0,100,100).setColor(Color.RED);
      window.addCircle(0, 0, 1).setColor(Color.RED);
      window.addShape(new Line(0, 0, 10, 10)).setColor(Color.RED);
 

Author:
Markus Kivioja
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
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
EasyWindow()
          Luo uuden ikkunan
EasyWindow(int width, int height)
          Luo uuden ikkunan
 
Method Summary
 Axis addAxis(double xLength, double yLength, double zLength)
          Lisää olioon koordinaatistoakselit.
 Axis addAxis(double xLength, double yLength, double zLength, double x, double y, double z)
          Lisää olioon koordinaatistoakselit.
 Circle addCircle(double x, double y, double r)
          Lisää olioon ympyrän.
 Circle addCircle(double x, double y, double z, double r)
          Lisää olioon ympyrän.
 FillPolygon addFillPolygon(double[][] points)
          Lisää olioon täytetyn monikulmion.
 FillPolygon addFillPolygon(double[] xpoints, double[] ypoints)
          Lisää olioon täytetyn monikulmion.
 Line addLine(double x1, double y1, double x2, double y2)
          Lisää olioon uuden viivan.
 Line addLine(double x1, double y1, double z1, double x2, double y2, double z2)
          Lisää olioon viivan.
 Polygon addPolygon(double[][] points)
          Lisää olioon monikulmion.
 Polygon addPolygon(double[] xpoints, double[] ypoints)
          Lisää olioon monikulmion.
 Drawable addShape(Drawable shape)
          Lisää olioon kuvion joka on Drawable-olio.
 
Methods inherited from class fi.jyu.mit.graphics.Window
add, changeTransform, getFullTransform, getPanel, getRotator, getSavedPath, getTransform, move, redraw, remove, rotate, scale, scale, setControlButtons, setIsotrophic, setRotator, setSpace, setTouchPad, setTouchPad, setTransform, showWindow, transform
 
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
 

Constructor Detail

EasyWindow

public EasyWindow()
Luo uuden ikkunan


EasyWindow

public EasyWindow(int width,
                  int height)
Luo uuden ikkunan

Parameters:
width - ikkunan leveys
height - ikkunan korkeus
Method Detail

addShape

public Drawable addShape(Drawable shape)
Description copied from interface: Easy
Lisää olioon kuvion joka on Drawable-olio. Palauttaa viitteen lisättyyn kuvioon, jolloin sille voidaan heti suorittaa jokin muukin operaatio, esimerkiksi:
      space.addShape(new Line(0, 0, 10, 10)).setColor(Color.RED);
 

Specified by:
addShape in interface Easy
Parameters:
shape - lisättävä kuvio
Returns:
lisätty olio

addLine

public Line addLine(double x1,
                    double y1,
                    double x2,
                    double y2)
Description copied from interface: Easy
Lisää olioon uuden viivan. Palauttaa viitteen lisättyyn viivaan, jolloin sille voidaan heti suorittaa jokin muukin operaatio, esimerkiksi:
     space.addLine(0,0,100,100).setColor(Color.RED);
 

Specified by:
addLine in interface Easy
Parameters:
x1 - viivan alkupisteen x
y1 - viivan alkupisteen y
x2 - viivan loppupisteen x
y2 - viivan loppupisteen y
Returns:
lisättyn viivaolion viite

addLine

public Line addLine(double x1,
                    double y1,
                    double z1,
                    double x2,
                    double y2,
                    double z2)
Description copied from interface: Easy
Lisää olioon viivan. Palauttaa viitteen lisättyyn viivaan, jolloin sille voidaan heti suorittaa jokin muukin operaatio, esimerkiksi:
     space.addLine(0, 0, 0, 100, 100, 100).setColor(Color.RED);
 

Specified by:
addLine in interface Easy
Parameters:
x1 - lähtöpisteen x-koordinaatti
y1 - lähtöpisteen y-koordinaatti
z1 - lähtöpisteen z-koordinaatti
x2 - loppupisteen x-koordinaatti
y2 - loppupisteen y-koordinaatti
z2 - loppupisteen z-koordinaatti
Returns:
lisätty Line-olio

addCircle

public Circle addCircle(double x,
                        double y,
                        double r)
Description copied from interface: Easy
Lisää olioon ympyrän. Palauttaa viitteen lisättyyn ympyrään, jolloin sille voidaan heti suorittaa jokin muukin operaatio, esimerkiksi:
       space.addCircle(0, 0, 1).setColor(Color.RED);
 

Specified by:
addCircle in interface Easy
Parameters:
x - ympyrän keskipisteen x-koordinaatti
y - ympyrän keskipisteen y-koordinaatti
r - ympyrän säde
Returns:
lisätty Circle-olio

addCircle

public Circle addCircle(double x,
                        double y,
                        double z,
                        double r)
Description copied from interface: Easy
Lisää olioon ympyrän. Palauttaa viitteen lisättyyn ympyrään, jolloin sille voidaan heti suorittaa jokin muukin operaatio, esimerkiksi:
      space.addCircle(0, 0, 0, 1).setColor(Color.RED);
 

Specified by:
addCircle in interface Easy
Parameters:
x - ympyrän keskipisteen x-koordinaatti
y - ympyrän keskipisteen y-koordinaatti
z - ympyrän keskipisteen z-koordinaatti
r - ympyrän säde
Returns:
lisätty Circle-olio

addPolygon

public Polygon addPolygon(double[] xpoints,
                          double[] ypoints)
Description copied from interface: Easy
Lisää olioon monikulmion. Palauttaa viitteen lisättyyn monikulmioon, jolloin sille voidaan heti suorittaa jokin muukin operaatio, esimerkiksi:
      double[] xpoints = {-1, 2, 4};
      double[] ypoints = [5, 6, 7};
      space.addPolygon(xpoints, ypoints).setColor(Color.RED);
 

Specified by:
addPolygon in interface Easy
Parameters:
xpoints - monikulmion kärkipisteiden x-koordinaatit
ypoints - monikulmion käskipisteiden y-koordinaatit
Returns:
lisätty Polygon-olio

addPolygon

public Polygon addPolygon(double[][] points)
Description copied from interface: Easy
Lisää olioon monikulmion. Palauttaa viitteen lisättyyn monikulmioon, jolloin sille voidaan heti suorittaa jokin muukin operaatio, esimerkiksi:
      double[][] points = {{2, 6}, {5, 5}, {-1, 2.5}}
      space.addPoylgon(points).setColor(Color.RED);
 

Specified by:
addPolygon in interface Easy
Parameters:
points - monikulmion kärkipisteiden koordinaatit
Returns:
lisätty Polygon-olio

addFillPolygon

public FillPolygon addFillPolygon(double[] xpoints,
                                  double[] ypoints)
Description copied from interface: Easy
Lisää olioon täytetyn monikulmion. Palauttaa viitteen lisättyyn täytettyyn monikulmioon, jolloin sille voidaan heti suorittaa jokin muukin operaatio, esimerkiksi:
      double[] xpoints = {-1, 2, 4};
      double[] ypoints = [5, 6, 7};
      space.addFillPolygon(xpoints, ypoints).setColor(Color.RED);
 

Specified by:
addFillPolygon in interface Easy
Parameters:
xpoints - monikulmion kärkipisteiden x-koordinaatit
ypoints - monikulmion käskipisteiden y-koordinaatit
Returns:
lisätty FillPolygon-olio

addFillPolygon

public FillPolygon addFillPolygon(double[][] points)
Description copied from interface: Easy
Lisää olioon täytetyn monikulmion. Palauttaa viitteen lisättyyn täytettyyn monikulmioon, jolloin sille voidaan heti suorittaa jokin muukin operaatio, esimerkiksi:
      double[][] points = {{2, 6}, {5, 5}, {-1, 2.5}}
      space.addFillPoylgon(points).setColor(Color.RED);
 

Specified by:
addFillPolygon in interface Easy
Parameters:
points - monikulmion kärkipisteiden koordinaatit
Returns:
lisätty FillPolygon-olio

addAxis

public Axis addAxis(double xLength,
                    double yLength,
                    double zLength)
Description copied from interface: Easy
Lisää olioon koordinaatistoakselit. Palauttaa viitteen lisättyyn akselistoon, jolloin sille voidaan heti suorittaa jokin muukin operaatio, esimerkiksi:
      space.addAxis(5, 5, 5).setColor(Color.RED);
 

Specified by:
addAxis in interface Easy
Parameters:
xLength - x-akselin pituus
yLength - y-akselin pituus
zLength - z-akselin pituus
Returns:
lisätty Axis-olio

addAxis

public Axis addAxis(double xLength,
                    double yLength,
                    double zLength,
                    double x,
                    double y,
                    double z)
Description copied from interface: Easy
Lisää olioon koordinaatistoakselit. Palauttaa viitteen lisättyyn akselistoon, jolloin sille voidaan heti suorittaa jokin muukin operaatio, esimerkiksi:
     space.addAxis(5, 5, 5, 0, 0, 0).setColor(Color.RED);
 

Specified by:
addAxis in interface Easy
Parameters:
xLength - x-akselin pituus
yLength - y-akselin pituus
zLength - z-akselin pituus
x - akselien leikkauspisteen x-koordinaatti
y - akselien leikkauspisteen y-koordinaatti
z - akselien leikkauspisteen z-koordinaatti
Returns:
lisätty Axis-olio