public class IlvVerticalHourScale extends JComponent implements Scrollable
IlvVerticalHourScale
is a Swing component that displays a vertical
scale marked and labeled with the hours of the day.JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
IlvVerticalHourScale()
Creates a new vertical hour scale.
|
Modifier and Type | Method and Description |
---|---|
Color |
getBackground()
Returns the background color of the scale.
|
Font |
getHourFont()
Returns the font of the hour labels.
|
int |
getHourHeight()
Returns the height of each hour interval.
|
float |
getHourOfDay(int y)
Returns the hour of the day that corresponds to the specified Y position.
|
Color |
getLabelColor()
Returns the color of the labels.
|
Dimension |
getMaximumSize()
Returns the maximum size of the scale.
|
Font |
getMinuteFont()
Returns the font of the minute labels.
|
Dimension |
getPreferredScrollableViewportSize()
Returns the preferred size of the viewport for this scale.
|
Dimension |
getPreferredSize()
Returns the preferred size of the scale.
|
int |
getPreferredVisibleHours()
Returns the preferred number of hours that will be displayed when the scale is
placed in a scrollpane.
|
int |
getScrollableBlockIncrement(Rectangle visibleRect,
int orientation,
int direction)
Returns the distance to scroll to expose the next or previous block of hour rows
for vertical scrolling, or the value of 10 pixels for horizontal scrolling.
|
boolean |
getScrollableTracksViewportHeight()
Returns
false to indicate that a viewport should not force the
height of the scale to match the height of the viewport. |
boolean |
getScrollableTracksViewportWidth()
Returns
true to indicate that a viewport should always force the
width of the scale to match the width of the viewport. |
int |
getScrollableUnitIncrement(Rectangle visibleRect,
int orientation,
int direction)
Returns the distance to scroll to expose the next or previous
hour row for vertical scrolling, or the value of 1 pixel for horizontal scrolling.
|
Color |
getTickColor()
Returns the color of the hourly tick marks.
|
int |
getTickMargin()
Returns the margin of the hourly tick marks.
|
ULocale |
getULocale()
Returns the locale used by the scale.
|
float |
getY(Calendar calendar)
Returns the vertical Y position within the scale that corresponds to the hour of the
day of the specified calendar.
|
float |
getY(float hourOfDay)
Returns the vertical Y position within the scale that corresponds to the specified
hour of the day.
|
void |
paintComponent(Graphics g)
Paints the time scale.
|
void |
setHourFont(Font font)
Sets the font of the hour labels.
|
void |
setHourHeight(int height)
Sets the height of each hour interval.
|
void |
setLabelColor(Color color)
Sets the color of the labels.
|
void |
setMinuteFont(Font font)
Sets the font of the minute labels.
|
void |
setPreferredVisibleHours(int visibleHours)
Sets the preferred number of hours that will be displayed when the scale is
placed in a scrollpane.
|
void |
setTickColor(Color color)
Sets the color of the hourly tick marks.
|
void |
setTickMargin(int margin)
Sets the margin of the hourly tick marks.
|
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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, 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, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, 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
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, 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, getName, getParent, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public IlvVerticalHourScale()
public ULocale getULocale()
public Color getBackground()
getBackground
in class Component
public int getHourHeight()
setHourHeight(int)
public void setHourHeight(int height)
height
- The interval height.getHourHeight()
public Font getHourFont()
setHourFont(java.awt.Font)
public void setHourFont(Font font)
font
- The hour label font.getHourFont()
public Font getMinuteFont()
setMinuteFont(java.awt.Font)
public void setMinuteFont(Font font)
font
- The minute label font.getMinuteFont()
public Color getLabelColor()
setLabelColor(java.awt.Color)
public void setLabelColor(Color color)
color
- The label color.getLabelColor()
public Color getTickColor()
setTickColor(java.awt.Color)
public void setTickColor(Color color)
color
- The tick color.getTickColor()
public int getTickMargin()
setTickMargin(int)
public void setTickMargin(int margin)
margin
- The tick margin.getTickMargin()
public float getHourOfDay(int y)
y
- The vertical Y position.public float getY(float hourOfDay)
hourOfDay
- The hour of the day, which should be a value from 0 to 24.public float getY(Calendar calendar)
calendar
- The calendar.public Dimension getPreferredSize()
getPreferredSize
in class JComponent
Dimension
.public Dimension getMaximumSize()
getMaximumSize
in class JComponent
Dimension
.public int getPreferredVisibleHours()
setPreferredVisibleHours(int)
public void setPreferredVisibleHours(int visibleHours)
getPreferredScrollableViewportSize()
property.visibleHours
- The preferred number of visible hours.getPreferredVisibleHours()
public Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize
in interface Scrollable
JViewport
whose view
is this scale.getPreferredVisibleHours()
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableUnitIncrement
in interface Scrollable
visibleRect
- The visible rectangleorientation
- The scroll orientation, which must be either
SwingConstants.VERTICAL
or SwingConstants.HORIZONTAL
.direction
- The scroll direction, which will be less than zero to scroll
up/left or greater than zero for down/right.public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableBlockIncrement
in interface Scrollable
visibleRect
- The visible rectangleorientation
- The scroll orientation, which must be either
SwingConstants.VERTICAL
or SwingConstants.HORIZONTAL
.direction
- The scroll direction, which will be less than zero to scroll
up/left or greater than zero for down/right.public boolean getScrollableTracksViewportWidth()
true
to indicate that a viewport should always force the
width of the scale to match the width of the viewport. Note, that this
effectively disables horizontal scrolling when the scale is placed in a
JScrollPane
.getScrollableTracksViewportWidth
in interface Scrollable
true
, which indicates that a viewport should force the
scale's width to match its own.public boolean getScrollableTracksViewportHeight()
false
to indicate that a viewport should not force the
height of the scale to match the height of the viewport. Note, that this
effectively enables vertical scrolling when the scale is placed in a
JScrollPane
.getScrollableTracksViewportHeight
in interface Scrollable
false
, which indicates that a viewport should not force the
scale's height to match its own.public void paintComponent(Graphics g)
paintComponent
in class JComponent
g
- The graphics context.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.