|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--uk.co.ist.mwt.ShadowedComponent | +--uk.co.ist.mwt.Scale
A Scale mimics the Scale capabilities of a Motif XmScale; it does not implement the layout part. If you want a Scale with children a la Motif, use a ScalePanel.
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Field Summary | |
static int |
kUndefined
A constant to say that a resource setting is undefined. |
Fields inherited from class uk.co.ist.mwt.ShadowedComponent |
shadowDrawer |
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 |
Constructor Summary | |
Scale()
Creates a scale with a normal shadow thickness |
Method Summary | |
protected void |
calculateClickableRects()
Calculate the rectangles /aboveRect/ and /belowRect/ which, if clicked, cause a 'page up' or 'page down' action in the scale |
protected void |
calculateRectangles()
Calculate the various rectangles which define the sections of this scale |
protected void |
drawThumbRect(java.awt.Graphics g)
Draw the thumb rectangle, assuming the value is valid |
protected void |
drawValueDisplay(java.awt.Graphics g)
Draw the value display, if necessary, assuming the rectangle set up for it is OK |
int |
getDecimalPoints()
Gets the number of digits to the right of the decimal point if we've decided to show the value |
int |
getMaximum()
Gets the maximum value for the scale |
int |
getMinimum()
Gets the minimum value for the scale |
java.awt.Dimension |
getMinimumSize()
Finds out the smallest possible size for the scale |
int |
getMultiple()
What is the multiple's value? (The multiple is the amount (in terms of the maximum and minimum values) that the scale will move its thumb when a non-thumb place in the scale is clicked.) Because the multiple, if it has never been set, is dynamically calculated, all access to it should be through this method - even from inside this class. |
protected java.awt.Rectangle |
getNewSliderRect()
Calculates the rectangle for the 'trough' |
protected java.awt.Rectangle |
getNewThumbRect()
Calculate the rectangle for the thumb, assuming the sliderRect is correct |
protected java.awt.Rectangle |
getNewValueRect()
Calculate the rectangle for the value display, assuming the sliderRect and the thumbRect are correct |
java.awt.Dimension |
getPreferredSize()
Finds out the size the scale would like to be |
boolean |
getShowValue()
Tells you whether this scale is showing its value |
int |
getValue()
Gets the value of the scale |
protected java.awt.Dimension |
getValueSize(boolean realVal)
Finds out how much space we need to alot to the value |
boolean |
getVertical()
Accessor for the current orientation |
boolean |
isMaxTopRight()
Returns whether the top/right part of the scale is where its maximum value is |
void |
onMouseDown(int x,
int y)
Event handler to start tracking mouse movements on mousedown; decides whether the button press is the start of a drag, or part of a paging action (ie. |
void |
onMouseDragged(int x,
int y)
Handles drags by updating the current value |
void |
onMouseUp(int x,
int y)
Event handler to work out what to do when the user releases the mouse button; if we were dragging, then set the value to the appropriate value. |
void |
paintComponent(java.awt.Graphics g)
Draws the scale |
protected void |
processMouseEvent(java.awt.event.MouseEvent e)
Event handler delegating mouse events to other handlers... |
protected void |
processMouseMotionEvent(java.awt.event.MouseEvent e)
Event handler delegating mouse events to other handlers... |
protected void |
resetValue(int pos)
Updates the value, using a particular pixel position in the trough (a y value if vertical, an x value if horizontal) |
void |
setBounds(int x,
int y,
int width,
int height)
Changes the size/position of the scale |
void |
setDecimalPoints(int dp)
Sets the number of digits to the right of the decimal point if we've decided to show the value |
void |
setMaximum(int max)
Sets the maximum value for the scale |
void |
setMaxTopRight(boolean mtr)
Sets the scale up so that the minimum value is on the right/at the bottom (as appropriate for the orientation). |
void |
setMinimum(int min)
Sets the minimum value for the scale |
void |
setMultiple(int mult)
Sets the multiple's value. |
void |
setShowValue(boolean whether)
Tell the scale to display its current value |
void |
setValue(int val)
Sets the current value of the scale, rounded up or down to the minimum or maximum if appropriate |
void |
setVertical(boolean vert)
Sets the current orientation to vertical (or horizontal, of course) |
protected void |
sliderMovedRedraw()
Do a repaint, assuming that the slider has moved |
protected java.lang.String |
valueStr()
Method to get the string representation of the value of the scale |
Methods inherited from class uk.co.ist.mwt.ShadowedComponent |
draw3DRect,
draw3DRect,
draw3DRect,
draw3DRect,
drawShadow,
drawShadow,
getBottomShadowColor,
getShadowThickness,
getTopShadowColor,
setBottomShadowColor,
setShadowThickness,
setTopShadowColor |
Methods inherited from class javax.swing.JComponent |
addAncestorListener,
addNotify,
addPropertyChangeListener,
addPropertyChangeListener,
addVetoableChangeListener,
computeVisibleRect,
contains,
createToolTip,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
fireVetoableChange,
getAccessibleContext,
getActionForKeyStroke,
getAlignmentX,
getAlignmentY,
getAutoscrolls,
getBorder,
getBounds,
getClientProperty,
getComponentGraphics,
getConditionForKeyStroke,
getDebugGraphicsOptions,
getGraphics,
getHeight,
getInsets,
getInsets,
getLocation,
getMaximumSize,
getNextFocusableComponent,
getRegisteredKeyStrokes,
getRootPane,
getSize,
getToolTipLocation,
getToolTipText,
getToolTipText,
getTopLevelAncestor,
getUIClassID,
getVisibleRect,
getWidth,
getX,
getY,
grabFocus,
hasFocus,
isDoubleBuffered,
isFocusCycleRoot,
isFocusTraversable,
isLightweightComponent,
isManagingFocus,
isOpaque,
isOptimizedDrawingEnabled,
isPaintingTile,
isRequestFocusEnabled,
isValidateRoot,
paint,
paintBorder,
paintChildren,
paintImmediately,
paintImmediately,
paramString,
processComponentKeyEvent,
processFocusEvent,
processKeyEvent,
putClientProperty,
registerKeyboardAction,
registerKeyboardAction,
removeAncestorListener,
removeNotify,
removePropertyChangeListener,
removePropertyChangeListener,
removeVetoableChangeListener,
repaint,
repaint,
requestDefaultFocus,
requestFocus,
resetKeyboardActions,
reshape,
revalidate,
scrollRectToVisible,
setAlignmentX,
setAlignmentY,
setAutoscrolls,
setBackground,
setBorder,
setDebugGraphicsOptions,
setDoubleBuffered,
setEnabled,
setFont,
setForeground,
setMaximumSize,
setMinimumSize,
setNextFocusableComponent,
setOpaque,
setPreferredSize,
setRequestFocusEnabled,
setToolTipText,
setUI,
setVisible,
unregisterKeyboardAction,
update,
updateUI |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getLayout,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
preferredSize,
print,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
setCursor,
setLayout,
validate,
validateTree |
Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
getBackground,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getInputContext,
getInputMethodRequests,
getLocale,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getToolkit,
getTreeLock,
gotFocus,
handleEvent,
hide,
imageUpdate,
inside,
isDisplayable,
isEnabled,
isLightweight,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
postEvent,
prepareImage,
prepareImage,
printAll,
processComponentEvent,
processInputMethodEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
repaint,
repaint,
repaint,
resize,
resize,
setBounds,
setComponentOrientation,
setDropTarget,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
show,
show,
size,
toString,
transferFocus |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final int kUndefined
Constructor Detail |
public Scale()
Method Detail |
public void setVertical(boolean vert)
getVertical()
public boolean getVertical()
setVertical(boolean)
public void setShowValue(boolean whether)
setDecimalPoints(int)
,
getShowValue()
public boolean getShowValue()
setShowValue(boolean)
public void setDecimalPoints(int dp)
setShowValue(boolean)
public int getDecimalPoints()
setDecimalPoints(int)
public void setValue(int val)
getValue()
public int getValue()
setValue(int)
public void setMaxTopRight(boolean mtr)
public boolean isMaxTopRight()
public void setMaximum(int max)
public int getMaximum()
public void setMinimum(int min)
public int getMinimum()
public void setMultiple(int mult)
public int getMultiple()
public void setBounds(int x, int y, int width, int height)
public void paintComponent(java.awt.Graphics g)
public java.awt.Dimension getPreferredSize()
public java.awt.Dimension getMinimumSize()
protected void processMouseEvent(java.awt.event.MouseEvent e)
onMouseDown(int, int)
,
onMouseUp(int, int)
protected void processMouseMotionEvent(java.awt.event.MouseEvent e)
onMouseDragged(int, int)
public void onMouseDown(int x, int y)
public void onMouseUp(int x, int y)
public void onMouseDragged(int x, int y)
protected void resetValue(int pos)
protected java.awt.Dimension getValueSize(boolean realVal)
protected void calculateRectangles()
protected java.awt.Rectangle getNewSliderRect()
protected java.awt.Rectangle getNewThumbRect()
protected java.awt.Rectangle getNewValueRect()
protected void calculateClickableRects()
protected void drawThumbRect(java.awt.Graphics g)
protected void drawValueDisplay(java.awt.Graphics g)
protected void sliderMovedRedraw()
protected java.lang.String valueStr()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |