|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Canvas com.softsynth.view.CustomFader
public class CustomFader
Our own horizontal fader (scrollbar), subclass of canvas,
which uses CustomFaderListener interface to communicate
with parent.
This fader is very similar to a Scrollbar except that it will jump to
a value if clicked while holding down the SHIFT key.
To use this class, choose either the AWT 1.0.2 version of CustomFader
package com.softsynth.view102, or the AWT 1.1 version in package com.softsynth.view111.
Example of using a CustomFader:
// A new fader with parent, with default value 50, visible of 10, min value 0, max value 100 myFader = new CustomFader(CustomFader.HORIZONTAL, 50, 10, 0, 100); // Assumes "this" is a class that implements CustomFaderListener myFader.addCustomFaderListener( this ); // set the increment that the value will jump when user clicks inside fader myFader.setBlockIncrement(10); // set the increment that the value will jump when user clicks on arrows of fader myFader.setUnitIncrement(1); // add it to layout add(myFader); ...
public void customFaderValueChanged(Object fader, int value) { System.out.println("Value = " + value); }This was written to provide a more consistent, less buggy Scrollbar substitute.
Field Summary | |
---|---|
static int |
HORIZONTAL
|
static int |
VERTICAL
|
Fields inherited from class java.awt.Component |
---|
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 |
Constructor Summary | |
---|---|
CustomFader(int orientation,
int val,
int visible,
int min,
int max)
Constructor with initial value, visible, min value, max value. |
Method Summary | |
---|---|
void |
addCustomFaderListener(CustomFaderListener listener)
Add a listener to receive value change events. |
int |
getBlockIncrement()
|
int |
getLineIncrement()
|
int |
getValue()
|
int |
getVisibleAmount(int amount)
|
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseDragged(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
paint(java.awt.Graphics g)
|
void |
removeCustomFaderListener(CustomFaderListener listener)
|
void |
setBlockIncrement(int v)
Set how much the value jumps when click to left or high of slider. |
void |
setUnitIncrement(int v)
Set how much the value jumps when click on an arrow. |
void |
setValue(int v)
|
void |
setValues(int val,
int min,
int max)
Set current value, minimum value, maximum value of fader |
void |
setVisibleAmount(int amount)
|
void |
update(java.awt.Graphics g)
|
Methods inherited from class java.awt.Canvas |
---|
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int HORIZONTAL
public static final int VERTICAL
Constructor Detail |
---|
public CustomFader(int orientation, int val, int visible, int min, int max)
Method Detail |
---|
public void addCustomFaderListener(CustomFaderListener listener)
public void removeCustomFaderListener(CustomFaderListener listener)
public void setValues(int val, int min, int max)
public int getValue()
public void setBlockIncrement(int v)
public int getBlockIncrement()
public void setUnitIncrement(int v)
public int getLineIncrement()
public int getVisibleAmount(int amount)
public void setVisibleAmount(int amount)
public void setValue(int v)
public void update(java.awt.Graphics g)
update
in class java.awt.Canvas
public void paint(java.awt.Graphics g)
paint
in class java.awt.Canvas
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |