Package ipsk.swing.scale
Class JDecimalAutoScale
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- ipsk.awt.JScale<java.math.BigDecimal>
-
- ipsk.swing.scale.JDecimalAutoScale
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,javax.swing.SwingConstants
public class JDecimalAutoScale extends JScale<java.math.BigDecimal>
Graphical decimal scale with automatic labeling.- Author:
- K.Jaensch, klausj@phonetik.uni-muenchen.de
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classJDecimalAutoScale.RenderModelclassJDecimalAutoScale.Size-
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
-
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class ipsk.awt.JScale
JScale.Orientation
-
-
Field Summary
Fields Modifier and Type Field Description static intHORIZONTALstatic intVERTICAL-
Fields inherited from class java.awt.Component
accessibleContext, 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
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class ipsk.awt.JScale
name, orientation, unit
-
-
Constructor Summary
Constructors Constructor Description JDecimalAutoScale()JDecimalAutoScale(JScale.Orientation orientation, int length, java.math.BigDecimal d, java.math.BigDecimal e)Create scale.JDecimalAutoScale(JScale.Orientation orientation, java.math.BigDecimal from, java.math.BigDecimal to)Create scale.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.math.BigDecimal[]computeExampleTicks()JDecimalAutoScale.RenderModelcomputeRenderModel(java.awt.Dimension size)voiddoLayout()doublegetBase()doublegetHorizontalPaddingFactor()java.text.FormatgetLabelFormat()intgetLength()java.awt.DimensiongetMinimumSize()JScale.OrientationgetOrientation()java.awt.DimensiongetPreferredSize()java.math.BigDecimalgetScaleBegin()java.math.BigDecimalgetScaleEnd()GridTick<java.math.BigDecimal>[]getScaleTicks(int fromPixel, int toPixel)doublegetVerticalPaddingFactor()static voidmain(java.lang.String[] args)protected voidpaintComponent(java.awt.Graphics g)voidsetBase(double base)voidsetFont(java.awt.Font f)voidsetHorizontalPaddingFactor(double d)voidsetLabelFormat(java.text.Format format)voidsetLength(int length)voidsetOrientation(JScale.Orientation orientation)voidsetScaleBegin(java.math.BigDecimal scaleBegin)voidsetScaleEnd(java.math.BigDecimal scaleEnd)voidsetVerticalPaddingFactor(double d)-
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, getAccessibleContext, 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, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, 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, transferFocusDownCycle, validate, validateTree
-
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, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, updateUI
-
-
-
-
Field Detail
-
HORIZONTAL
public static final int HORIZONTAL
- See Also:
- Constant Field Values
-
VERTICAL
public static final int VERTICAL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JDecimalAutoScale
public JDecimalAutoScale()
-
JDecimalAutoScale
public JDecimalAutoScale(JScale.Orientation orientation, java.math.BigDecimal from, java.math.BigDecimal to)
Create scale.- Parameters:
orientation-from- start pintto- end point
-
JDecimalAutoScale
public JDecimalAutoScale(JScale.Orientation orientation, int length, java.math.BigDecimal d, java.math.BigDecimal e)
Create scale.- Parameters:
orientation-length- in pixelsd- start pinte- end point
-
-
Method Detail
-
getLength
public int getLength()
- Returns:
- the length
-
setLength
public void setLength(int length)
- Parameters:
length- the length to set
-
getBase
public double getBase()
-
setBase
public void setBase(double base)
-
computeExampleTicks
protected java.math.BigDecimal[] computeExampleTicks()
-
computeRenderModel
public JDecimalAutoScale.RenderModel computeRenderModel(java.awt.Dimension size)
-
paintComponent
protected void paintComponent(java.awt.Graphics g)
- Overrides:
paintComponentin classjavax.swing.JComponent
-
getScaleTicks
public GridTick<java.math.BigDecimal>[] getScaleTicks(int fromPixel, int toPixel)
-
getVerticalPaddingFactor
public double getVerticalPaddingFactor()
- Returns:
- vertical padding factor
-
setVerticalPaddingFactor
public void setVerticalPaddingFactor(double d)
- Parameters:
d- vertical padding factor
-
getHorizontalPaddingFactor
public double getHorizontalPaddingFactor()
- Returns:
- horizontal padding factor
-
setHorizontalPaddingFactor
public void setHorizontalPaddingFactor(double d)
- Parameters:
d- horizontla padding factor
-
getMinimumSize
public java.awt.Dimension getMinimumSize()
- Overrides:
getMinimumSizein classjavax.swing.JComponent
-
getPreferredSize
public java.awt.Dimension getPreferredSize()
- Overrides:
getPreferredSizein classjavax.swing.JComponent
-
getLabelFormat
public java.text.Format getLabelFormat()
- Returns:
- label format
-
setLabelFormat
public void setLabelFormat(java.text.Format format)
- Parameters:
format- label format
-
setFont
public void setFont(java.awt.Font f)
- Overrides:
setFontin classjavax.swing.JComponent
-
getScaleBegin
public java.math.BigDecimal getScaleBegin()
- Returns:
- Returns the scaleBegin.
-
setScaleBegin
public void setScaleBegin(java.math.BigDecimal scaleBegin)
- Parameters:
scaleBegin- The scaleBegin to set.
-
getScaleEnd
public java.math.BigDecimal getScaleEnd()
- Returns:
- Returns the scaleEnd.
-
setScaleEnd
public void setScaleEnd(java.math.BigDecimal scaleEnd)
- Parameters:
scaleEnd- The scaleEnd to set.
-
getOrientation
public JScale.Orientation getOrientation()
- Overrides:
getOrientationin classJScale<java.math.BigDecimal>- Returns:
- Returns the orientation.
-
setOrientation
public void setOrientation(JScale.Orientation orientation)
- Overrides:
setOrientationin classJScale<java.math.BigDecimal>- Parameters:
orientation- The orientation to set.
-
doLayout
public void doLayout()
- Overrides:
doLayoutin classjava.awt.Container
-
main
public static void main(java.lang.String[] args)
-
-