Package jmri.jmrit

Class DccLocoAddressSelector

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class DccLocoAddressSelector extends JPanel
Tool for selecting short/long address for DCC throttles. This is made more complex because we want it to appear easier. Some DCC systems allow addresses like 112 to be either long (extended) or short; others default to one or the other.

When locked (the default), the short/long selection is forced to stay in synch with what's available from the current ThrottleManager. If unlocked, this can differ if it's been explicity specified via the GUI (e.g. you can call 63 a long address even if the DCC system can't actually do it right now). This is useful in decoder programming, for example, where you might be configuring a loco to run somewhere else.

See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • setLocked

      public void setLocked(boolean l)
    • getLocked

      public boolean getLocked(boolean l)
    • getAddress

      Get the currently selected DCC address.

      This is the primary output of this class.

      Returns:
      DccLocoAddress object containing GUI choices, or null if no entries in GUI
    • setAddress

      public void setAddress(DccLocoAddress a)
    • setVariableSize

      public void setVariableSize(boolean s)
    • reset

      public void reset()
      Put back to original state, clearing GUI
    • getCombinedJPanel

      Get a JPanel containing the combined selector.

      Because Swing only allows a component to be inserted in one container, this can only be done once

    • setEnabled

      public void setEnabled(boolean e)
      Provide a common setEnable call for the GUI components in the selector
      Overrides:
      setEnabled in class JComponent
    • setEnabledProtocol

      public void setEnabledProtocol(boolean e)
    • getTextField

      Get the text field for entering the number as a separate component.

      Because Swing only allows a component to be inserted in one container, this can only be done once

    • reportError

      void reportError(String msg)
    • getSelector

      Get the selector box for picking long/short as a separate component. Because Swing only allows a component to be inserted in one container, this can only be done once
    • followAnotherSelector

      This Selector's protocol box will follow another DccLocoAddressSelector's selected protocol, so this one's protocol choice is constrained to match. At present, this can't be undone. Meant for use in e.g. the consist tool for protocols that require only one type of protocol in a consist
    • addKeyListener

      public void addKeyListener(KeyListener l)
      Overrides:
      addKeyListener in class Component