|
|||||||||||
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
de.uni_paderborn.fujaba.fsa.swing.JEgg
The Java Enterprise Grub Gang - shortly called J-EGG - serves to make possible problems that can occur in the design phase of a software project explicit. Imagine a large software design and suddenly you notice that behind nearly every part of that design something hides you did not expect. Getting rid of these things is not easy ...
Please not that JEgg requires FSA (the new Fujaba display structures) to run and one active diagram (what type does not matter).
Should you discover any bugs in this code, please do not remove them. :)
Nested Class Summary | |
private class |
JEgg.EggDeathMouseListener
Listens for death-bringing mouse clicks |
static class |
JEgg.EggMouseListener
This key listener listens for a triple click and adds the EggKeyListener
to a given component if a triple click has been found |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
(package private) boolean |
alive
Determines whether this JEgg is still alive or whether it has already been hit by a death-bringing mouse click |
private static int |
COLLISION_WITH_JEGG
Return value for isConcealed . |
private static int |
CONCEALED
Return value for isConcealed . |
private static javax.swing.ImageIcon |
deadIcon
The icon for the JEgg that will be displayed when alive is false. |
private int |
direction
The direction this JEgg currently has. |
private static int[] |
DIRECTION_X_DIFF
This array converts an angle as defined in direction into the position difference
in pixels of the x-axis that is used when a JEgg makes one step. |
private static int[] |
DIRECTION_Y_DIFF
This array converts an angle as defined in direction into the position difference
in pixels of the y-axis that is used when a JEgg makes one step. |
private int |
directionDelta
The direction in which this JEgg may turn. |
private static int |
height
The maximum height of all icons. |
private static javax.swing.ImageIcon[][] |
icons
The icons of the JEgg. |
private static int |
instanceCount
Counts the instances of Bugs on the diagram. |
private int |
moveState
The move state this JEgg currently has. |
private static int |
NOT_CONCEALED
Return value for isConcealed . |
private static int |
width
The maximum width of all icons. |
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.Container |
|
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 | |
private |
JEgg()
Creates a new JEgg and initializes it. |
Method Summary | |
private void |
changeDirection()
Calculates a new direction for this JEgg. |
private int |
getContainerHeight()
Returns the height of the container this component is contained in |
private int |
getContainerWidth()
Returns the width of the container this component is contained in |
private void |
getIcons()
Ensures that the icons required for a JEgg are loaded. |
java.awt.Dimension |
getPreferredSize()
Returns the preferred size of a JEgg |
boolean |
isAlive()
Determines whether this JEgg is still alive or whether it has already been hit by a death-bringing mouse click |
private int |
isConcealed()
Checks whether this component is concealed by any other component in the view (with the exception of JLines, because they are not really useful for hiding :). |
void |
paintComponent(java.awt.Graphics g)
Paints this JEgg according to its state |
private void |
removeYou()
Remove this component from its container |
void |
run()
Run method for the Thread of this JEgg, as defined by the Runnable interface. |
static void |
start()
Starts JEgg. |
private void |
toBack()
Puts this component behind all other components of the container |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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 |
private static int instanceCount
private static javax.swing.ImageIcon[][] icons
getIcons()
. The first dimension defines the angle of the JEgg (the variable direction
should be used as index for this dimension). This version of JEgg uses 8 different values,
representing the angles 30�, 60�, 120�, 150�, 210�, 240�, 300� and 330�.
The second dimension defines a move-state of the JEgg. There are currently three move-states.
(the variable moveState
should be used as index for this dimension).
private static javax.swing.ImageIcon deadIcon
alive
is false. To ensure
that this field is set-up correctly call getIcons()
.
private static int width
getIcons()
.
private static int height
getIcons()
.
private int direction
icons
and index for
the direction(X|Y)diff
arrays.
private int directionDelta
private int moveState
icons
.
private static final int[] DIRECTION_X_DIFF
direction
into the position difference
in pixels of the x-axis that is used when a JEgg makes one step. direction
should be used as index for this.
private static final int[] DIRECTION_Y_DIFF
direction
into the position difference
in pixels of the y-axis that is used when a JEgg makes one step. direction
should be used as index for this.
boolean alive
private static final int NOT_CONCEALED
isConcealed
. The JEgg is visible.
private static final int CONCEALED
isConcealed
. The JEgg is not visible.
private static final int COLLISION_WITH_JEGG
isConcealed
. The JEgg shares the same position with another
JEgg.
Constructor Detail |
private JEgg()
start()
.
Method Detail |
private void getIcons()
icon
and deadIcon
.
java.lang.RuntimeException
- if the icons could not be loaded.public java.awt.Dimension getPreferredSize()
public void paintComponent(java.awt.Graphics g)
g
- No description providedpublic boolean isAlive()
public void run()
Runnable
interface.
run
in interface java.lang.Runnable
private int getContainerWidth()
private int getContainerHeight()
private int isConcealed()
CONCEALED
is returned. If this component shares
its place with another JEgg, COLLISION_WITH_JEGG
is returned. Otherwise
NOT_CONCEALED
is returned.
private void changeDirection()
directionDelta
to direction
. In 30% of all cases directionDelta
is automatically
inverted.
private void removeYou()
private void toBack()
public static void start()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |