|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JInternalFrame
jmri.jmrit.throttle.ControlPanel
public class ControlPanel
A JInternalFrame that contains a JSlider to control loco speed, and buttons for forward, reverse and STOP.
TODO: fix speed increments (14, 28)
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JInternalFrame |
|---|
JInternalFrame.AccessibleJInternalFrame, JInternalFrame.JDesktopIcon |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
int |
accelerateKey
|
int |
accelerateKey1
|
int |
accelerateKey2
|
static int |
BUTTON_SIZE
|
int |
decelerateKey
|
int |
decelerateKey1
|
int |
decelerateKey2
|
int |
forwardKey
|
int |
idleKey
|
int |
reverseKey
|
static int |
SLIDERDISPLAY
|
static int |
SLIDERDISPLAYCONTINUOUS
|
static int |
STEPDISPLAY
|
int |
stopKey
|
| Fields inherited from class javax.swing.JInternalFrame |
|---|
closable, CONTENT_PANE_PROPERTY, desktopIcon, FRAME_ICON_PROPERTY, frameIcon, GLASS_PANE_PROPERTY, iconable, IS_CLOSED_PROPERTY, IS_ICON_PROPERTY, IS_MAXIMUM_PROPERTY, IS_SELECTED_PROPERTY, isClosed, isIcon, isMaximum, isSelected, LAYERED_PANE_PROPERTY, maximizable, MENU_BAR_PROPERTY, resizable, ROOT_PANE_PROPERTY, rootPane, rootPaneCheckingEnabled, title, TITLE_PROPERTY |
| 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 |
| Fields inherited from interface javax.swing.WindowConstants |
|---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
ControlPanel()
Constructor. |
|
| Method Summary | |
|---|---|
void |
accelerate1()
|
void |
accelerate10()
|
void |
actionPerformed(ActionEvent e)
Handle the selection from the popup menu. |
void |
decelerate1()
|
void |
decelerate10()
|
void |
destroy()
|
int |
getDisplaySlider()
Get the value indicating what speed input we're displaying |
boolean |
getIsForward()
|
JSlider |
getSpeedSlider()
|
String |
getSwitchSliderFunction()
|
boolean |
getTrackSlider()
Get status of real-time speed slider tracking |
Element |
getXml()
Collect the prefs of this object into XML Element Window prefs |
boolean |
isSpeedControllerAvailable(int displaySlider)
Is this Speed Control selection method possible? |
void |
notifyAddressChosen(int newAddress,
boolean isLong)
Receive notification that a new address has been selected. |
void |
notifyAddressReleased(int address,
boolean isLong)
Receive notification that an address has been released/dispatched |
void |
notifyAddressThrottleFound(DccThrottle t)
Receive notification that a throttle has been found |
void |
propertyChange(PropertyChangeEvent e)
|
void |
saveToRoster(RosterEntry re)
|
void |
setAddressPanel(AddressPanel addressPanel)
|
void |
setEnabled(boolean isEnabled)
Enable/Disable all buttons and slider. |
void |
setForwardDirection(boolean isForward)
Set forward/reverse direction in both the GUI and on the layout |
void |
setIsForward(boolean isForward)
Set the GUI to match that the loco is set to forward. |
void |
setSpeedController(int displaySlider)
Set the Speed Control selection method |
void |
setSpeedStepsMode(int speedStepMode)
Set the GUI to match the speed steps of the current address. |
void |
setSpeedValues(float speedIncrement,
float speed)
Set the GUI to match that the loco speed. |
void |
setSwitchSliderFunction(String fn)
|
void |
setTrackSlider(boolean track)
Set real-time tracking of speed slider, or not |
void |
setXml(Element e)
Set the preferences based on the XML Element. |
void |
stop()
Perform an emergency stop |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int SLIDERDISPLAY
public static final int STEPDISPLAY
public static final int SLIDERDISPLAYCONTINUOUS
public static final int BUTTON_SIZE
public int accelerateKey
public int decelerateKey
public int accelerateKey1
public int decelerateKey1
public int accelerateKey2
public int decelerateKey2
public int reverseKey
public int forwardKey
public int stopKey
public int idleKey
| Constructor Detail |
|---|
public ControlPanel()
| Method Detail |
|---|
public void setAddressPanel(AddressPanel addressPanel)
public void destroy()
public void setEnabled(boolean isEnabled)
setEnabled in class JComponentisEnabled - True if the buttons/slider should be enabled, false
otherwise.public void setIsForward(boolean isForward)
isForward - True if the loco is set to forward, false otherwise.public boolean getIsForward()
public void setForwardDirection(boolean isForward)
public void setSpeedStepsMode(int speedStepMode)
speedStepMode - Desired speed step mode. One of:
DccThrottle.SpeedStepMode128, DccThrottle.SpeedStepMode28,
DccThrottle.SpeedStepMode27, DccThrottle.SpeedStepMode14
step modepublic boolean isSpeedControllerAvailable(int displaySlider)
displaySlider - integer value. possible values:
SLIDERDISPLAY = use speed slider display
STEPDISPLAY = use speed step displaypublic void setSpeedController(int displaySlider)
displaySlider - integer value. possible values:
SLIDERDISPLAY = use speed slider display
STEPDISPLAY = use speed step displaypublic int getDisplaySlider()
public void setTrackSlider(boolean track)
track - boolean value, true to track, false to set speed on unclickpublic boolean getTrackSlider()
public void setSpeedValues(float speedIncrement,
float speed)
speedIncrement - The throttle back end's speed increment
value - % increase for each speed step.speed - The speed value of the loco.public JSlider getSpeedSlider()
public void stop()
public void accelerate1()
public void accelerate10()
public void decelerate1()
public void decelerate10()
public void propertyChange(PropertyChangeEvent e)
propertyChange in interface PropertyChangeListenerpublic void actionPerformed(ActionEvent e)
actionPerformed in interface ActionListenere - The ActionEvent causing the action.public Element getXml()
public void setXml(Element e)
e - The Element for this object.
public void notifyAddressChosen(int newAddress,
boolean isLong)
AddressListener
notifyAddressChosen in interface AddressListenernewAddress - The address that is now selected.
public void notifyAddressReleased(int address,
boolean isLong)
AddressListener
notifyAddressReleased in interface AddressListeneraddress - The address released/dispatchedpublic void notifyAddressThrottleFound(DccThrottle t)
AddressListener
notifyAddressThrottleFound in interface AddressListenert - The throttlepublic void setSwitchSliderFunction(String fn)
public String getSwitchSliderFunction()
public void saveToRoster(RosterEntry re)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||