jET
1.0alpha5


org.jet.sce
Class JRule

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--org.jet.sce.JRule
All Implemented Interfaces:
javax.swing.event.ChangeListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseMotionListener, SceneryConstants, java.io.Serializable

public class JRule
extends javax.swing.JComponent
implements java.awt.event.MouseMotionListener, javax.swing.event.ChangeListener, SceneryConstants

A rule for scenery editor. Rule resides in front of scroll bar in scenery editor and it's always visible. There is a linear scale measured in meters on the rule. Rule can be vertical and horizontal.

See Also:
Serialized Form

Field Summary
static int HORIZONTAL
          This constant indicates horizontal rule.
static int SIZE
          Height or width depending on rule oreintation of rule.
static int VERTICAL
          This constant indicates vertical rule.
 
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 org.jet.sce.SceneryConstants
PIXELS_PER_METER
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JRule(int o)
          Creates new rule with orientation.
 
Method Summary
 int getIncrement()
          Gets incrementation.
 int getOrientation()
          Gets orientation of rule.
 void mouseDragged(java.awt.event.MouseEvent me)
          This task is executed when mouse in scenery editor moves.
 void mouseMoved(java.awt.event.MouseEvent me)
          This task is executed when mouse in scenery editor moves.
 void paintComponent(java.awt.Graphics g)
          Paints the component.
protected  void paintScale(java.awt.Graphics g)
          Paints scale.
 void setIncrement(int i)
          Sets incrementation.
 void setOrientation(int o)
          Sets orientation of this rule.
 void setPreferredHeight(int ph)
          Sets height for vertical rule.
 void setPreferredWidth(int pw)
          Sets the width for horizontal rule.
 void stateChanged(javax.swing.event.ChangeEvent ce)
          Source for this change listener should come from viewport associated with this rule.
 
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, getPreferredSize, 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

SIZE

public static final int SIZE
Height or width depending on rule oreintation of rule.

See Also:
Constant Field Values

HORIZONTAL

public static final int HORIZONTAL
This constant indicates horizontal rule.

See Also:
Constant Field Values

VERTICAL

public static final int VERTICAL
This constant indicates vertical rule.

See Also:
Constant Field Values
Constructor Detail

JRule

public JRule(int o)
Creates new rule with orientation.

Parameters:
o - Orientation of the rule.
See Also:
HORIZONTAL, VERTICAL
Method Detail

setOrientation

public void setOrientation(int o)
Sets orientation of this rule.

Parameters:
o - Orientation of the rule.
See Also:
HORIZONTAL, VERTICAL

getOrientation

public int getOrientation()
Gets orientation of rule.

Returns:
Orientation which may be vertical or horizontal.
See Also:
HORIZONTAL, VERTICAL

setPreferredWidth

public void setPreferredWidth(int pw)
Sets the width for horizontal rule.

Parameters:
pw - New width of horizontal rule.

setPreferredHeight

public void setPreferredHeight(int ph)
Sets height for vertical rule.

Parameters:
ph - New height of vertical rule.

setIncrement

public void setIncrement(int i)
Sets incrementation. The incrementation is amount of pixels between peaks of scale.

Parameters:
i - Incrementation.

getIncrement

public int getIncrement()
Gets incrementation. The incrementation is amount of pixels between peaks of scale.

Returns:
Incrementation.

paintComponent

public void paintComponent(java.awt.Graphics g)
Paints the component.

Overrides:
paintComponent in class javax.swing.JComponent
Parameters:
g - Graphic context.

paintScale

protected void paintScale(java.awt.Graphics g)
Paints scale. It isinvoked inside paintComponent method.

Parameters:
g - Graphics to use.

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent me)
This task is executed when mouse in scenery editor moves. It updates a rule with line pointer.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Parameters:
me - Mouse event.

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent me)
This task is executed when mouse in scenery editor moves. It updates a rule with line pointer.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Parameters:
me - Mouse event.

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent ce)
Source for this change listener should come from viewport associated with this rule.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
ce - Viewport change.

jET
1.0alpha5