Package ipsk.swing

Class JAutoScale

  • All Implemented Interfaces:
    TickProvider<java.lang.Long>, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.swing.SwingConstants

    public class JAutoScale
    extends JScale<java.lang.Long>
    implements TickProvider<java.lang.Long>
    Graphical 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
      class  JAutoScale.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()  
      void doLayout()  
      double getBase()  
      double getHorizontalPaddingFactor()  
      java.text.Format getLabelFormat()  
      java.awt.Dimension getMinimumSize()  
      java.awt.Dimension getPreferredSize()  
      long getScaleBegin()  
      long getScaleEnd()  
      GridTick<java.lang.Long>[] getScaleTicks​(int fromPixel, int toPixel)
      Get array of scale ticks.
      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​(long scaleBegin)  
      void setScaleEnd​(long 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

      • JAutoScale

        public JAutoScale()
      • JAutoScale

        public JAutoScale​(JScale.Orientation orientation,
                          long from,
                          long to)
        Create scale.
        Parameters:
        orientation -
        from - start pint
        to - end point
      • JAutoScale

        public JAutoScale​(JScale.Orientation orientation,
                          int length,
                          long from,
                          long to)
        Create scale.
        Parameters:
        orientation -
        length - in pixels
        from - start pint
        to - end point
    • Method Detail

      • getBase

        public double getBase()
      • setBase

        public void setBase​(double base)
      • paintComponent

        protected void paintComponent​(java.awt.Graphics g)
        Overrides:
        paintComponent in class javax.swing.JComponent
      • getScaleTicks

        public GridTick<java.lang.Long>[] getScaleTicks​(int fromPixel,
                                                        int toPixel)
        Description copied from interface: TickProvider
        Get array of scale ticks. Returns only the ticks in the given interval.
        Specified by:
        getScaleTicks in interface TickProvider<java.lang.Long>
        Parameters:
        fromPixel - interval start pixel position
        toPixel - interval end pixel position
        Returns:
        array of grid ticks
      • 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()
      • 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 long getScaleBegin()
        Returns:
        Returns the scaleBegin.
      • setScaleBegin

        public void setScaleBegin​(long scaleBegin)
        Parameters:
        scaleBegin - The scaleBegin to set.
      • getScaleEnd

        public long getScaleEnd()
        Returns:
        Returns the scaleEnd.
      • setScaleEnd

        public void setScaleEnd​(long scaleEnd)
        Parameters:
        scaleEnd - The scaleEnd to set.
      • setOrientation

        public void setOrientation​(JScale.Orientation orientation)
        Overrides:
        setOrientation in class JScale<java.lang.Long>
        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)