Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class uk.co.ist.mwt.ScalePanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--uk.co.ist.mwt.ScalePanel

public class ScalePanel
extends java.awt.Panel
The ScalePanel implements the behaviour of a Motif XmScale widget; it is a Panel subclass and can thus take children. If you want to use a simple scale component - that is, one without children - you should use the Scale component

See Also:
Serialized Form

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
ScalePanel()
          Create a new ScalePanel with default settings (vertical orientation, and default values for the Scale child).
 
Method Summary
java.awt.Component add(java.awt.Component comp, int pos)
          Add a component to the Panel; overriden so that any children added are put into the scaleChildPanel.
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
int getMultiple()
          What is the multiple's value?
int getValue()
          Gets the value of the scale
boolean isMaxTopRight()
          Returns whether the top/right part of the scale is where its maximum value is
boolean isVertical()
          Gets the Scale's orientation
java.awt.Component locate(int x, int y)
          Locate a component; as we're hiding the existence of the internal scaleChildPanel, we must return one of its children if the click is inside it.
void maxTopRightIf(boolean mtr)
          Sets the scale up so that the minimum value is on the right/at the top (as appropriate for the orientation).
void removeAll()
          Remove all components from the panel; actually removes those from the scaleChildPanel.
void remove(java.awt.Component comp)
          Remove a component from the panel; overriden so that any children are removed from the scaleChildPanel.
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 setMinimum(int min)
          Sets the minimum value for the scale
void setMultiple(int mult)
          Sets the multiple's 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 Scale's orientation, and reorganise the children of this panel to reflect this.
boolean showingValue()
          Are we showing the scale's value at the moment?
void showValueIf(boolean whether)
          Tell the scale to display its current value
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addNotify, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponentAt, getComponentAt, getComponent, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, paint, preferredSize, printComponents, print, removeAll, remove, remove, removeContainerListener, removeNotify, setLayout, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paint, postEvent, preferredSize, prepareImage, prepareImage, printAll, print, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Constructor Detail

ScalePanel

public ScalePanel()
Create a new ScalePanel with default settings (vertical orientation, and default values for the Scale child).
Method Detail

setVertical

public void setVertical(boolean vert)
Sets the Scale's orientation, and reorganise the children of this panel to reflect this.
Parameters:
vert - if true, set the orientation to vertical; if false, set orientation to horizontal.

isVertical

public boolean isVertical()
Gets the Scale's orientation
Returns:
true if the scale is vertical, false if otherwise

showValueIf

public void showValueIf(boolean whether)
Tell the scale to display its current value
Parameters:
whether - if true, the value will be displayed; if false, it won't
See Also:
setDecimalPoints, #getShowValue

showingValue

public boolean showingValue()
Are we showing the scale's value at the moment?
Returns:
true if we are, false otherwise

setDecimalPoints

public void setDecimalPoints(int dp)
Sets the number of digits to the right of the decimal point if we've decided to show the value
See Also:
showValueIf, getDecimalPoints

getDecimalPoints

public int getDecimalPoints()
Gets the number of digits to the right of the decimal point if we've decided to show the value
See Also:
#setShowValue, setDecimalPoints

setValue

public void setValue(int val)
Sets the current value of the scale, rounded up or down to the minimum or maximum if appropriate
Parameters:
val - the new value
See Also:
getValue

getValue

public int getValue()
Gets the value of the scale
Returns:
the value
See Also:
setValue

maxTopRightIf

public void maxTopRightIf(boolean mtr)
Sets the scale up so that the minimum value is on the right/at the top (as appropriate for the orientation).
Parameters:
mtr - true to set the maximum value to the right or top, false for the maximum at the bottom or left.

isMaxTopRight

public boolean isMaxTopRight()
Returns whether the top/right part of the scale is where its maximum value is
Returns:
true if the maximum is in the top or right, false otherwise

setMaximum

public void setMaximum(int max)
Sets the maximum value for the scale
Parameters:
max - the new maximum

getMaximum

public int getMaximum()
Gets the maximum value for the scale

setMinimum

public void setMinimum(int min)
Sets the minimum value for the scale
Parameters:
min - the new minimum

getMinimum

public int getMinimum()
Gets the minimum value for the scale

setMultiple

public void setMultiple(int mult)
Sets 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.)
Parameters:
mult - the new multiple

getMultiple

public 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.
Returns:
the multiple for this scale

add

public java.awt.Component add(java.awt.Component comp,
                     int pos)
Add a component to the Panel; overriden so that any children added are put into the scaleChildPanel.
Parameters:
comp - the component to add
pos - the position in the list of children at which to add it; -1 means 'at the end'.
Overrides:
add in class java.awt.Container

remove

public void remove(java.awt.Component comp)
Remove a component from the panel; overriden so that any children are removed from the scaleChildPanel.
Parameters:
comp - the component to remove
Overrides:
remove in class java.awt.Container

removeAll

public void removeAll()
Remove all components from the panel; actually removes those from the scaleChildPanel.
Overrides:
removeAll in class java.awt.Container

locate

public java.awt.Component locate(int x,
                        int y)
Locate a component; as we're hiding the existence of the internal scaleChildPanel, we must return one of its children if the click is inside it.
Parameters:
x - the x co-ordinate within this component which the desired component contains
y - the y co-ordinate within this component which the desired component contains
Overrides:
locate in class java.awt.Container

Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD