Class JAutoScale2

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.swing.SwingConstants

    public class JAutoScale2
    extends JScale<java.math.BigDecimal>
    Graphical scale with automatic labelling.
    Author:
    K.Jaensch, klausj@phonetik.uni-muenchen.de
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  JAutoScale2.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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int HORIZONTAL  
      static int VERTICAL  
      • 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 interface javax.swing.SwingConstants

        BOTTOM, CENTER, EAST, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, WEST
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void calcMaxLabelSize()  
      protected void calcMaxLabelSize​(int length)  
      protected java.math.BigDecimal[] computeExampleTicks()  
      void doLayout()  
      double getBase()  
      double getHorizontalPaddingFactor()  
      java.text.Format getLabelFormat()  
      java.awt.Dimension getMinimumSize()  
      java.awt.Dimension getPreferredSize()  
      java.math.BigDecimal getScaleBegin()  
      java.math.BigDecimal getScaleEnd()  
      GridTick<java.math.BigDecimal>[] getScaleTicks​(int fromPixel, int toPixel)  
      double getVerticalPaddingFactor()  
      static void main​(java.lang.String[] args)  
      protected void paintComponent​(java.awt.Graphics g)  
      void setBase​(double base)  
      void setFont​(java.awt.Font f)  
      void setHorizontalPaddingFactor​(double d)  
      void setLabelFormat​(java.text.Format format)  
      void setOrientation​(JScale.Orientation orientation)  
      void setScaleBegin​(java.math.BigDecimal scaleBegin)  
      void setScaleEnd​(java.math.BigDecimal scaleEnd)  
      void setVerticalPaddingFactor​(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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • JAutoScale2

        public JAutoScale2()
      • JAutoScale2

        public JAutoScale2​(JScale.Orientation orientation,
                           java.math.BigDecimal from,
                           java.math.BigDecimal to)
        Create scale.
        Parameters:
        orientation -
        from - start pint
        to - end point
      • JAutoScale2

        public JAutoScale2​(JScale.Orientation orientation,
                           int length,
                           java.math.BigDecimal d,
                           java.math.BigDecimal e)
        Create scale.
        Parameters:
        orientation -
        length - in pixels
        d - start pint
        e - end point
    • Method Detail

      • getBase

        public double getBase()
      • setBase

        public void setBase​(double base)
      • computeExampleTicks

        protected java.math.BigDecimal[] computeExampleTicks()
      • paintComponent

        protected void paintComponent​(java.awt.Graphics g)
        Overrides:
        paintComponent in class javax.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
      • calcMaxLabelSize

        protected void calcMaxLabelSize()
      • calcMaxLabelSize

        protected void calcMaxLabelSize​(int length)
      • getMinimumSize

        public java.awt.Dimension getMinimumSize()
        Overrides:
        getMinimumSize in class javax.swing.JComponent
      • getPreferredSize

        public java.awt.Dimension getPreferredSize()
        Overrides:
        getPreferredSize in class javax.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:
        setFont in class javax.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.
      • setOrientation

        public void setOrientation​(JScale.Orientation orientation)
        Overrides:
        setOrientation in class JScale<java.math.BigDecimal>
        Parameters:
        orientation - The orientation to set.
      • doLayout

        public void doLayout()
        Overrides:
        doLayout in class java.awt.Container
      • main

        public static void main​(java.lang.String[] args)