Class DisplayFrame

All Implemented Interfaces:
ComponentListener, WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants, BeanInterface, ModifiedFlag, WindowInterface
Direct Known Subclasses:
ItemPalette

public class DisplayFrame
extends JmriJFrame
Extended JmriJFrame that allows to add an InitEventListener for display of a tabbed frame in the CPE Add Item ItemPalette pane.

UML Class diagram

See Also:
Serialized Form
  • Field Details

  • Constructor Details

    • DisplayFrame

      public DisplayFrame​(boolean saveSize, boolean savePosition)
      Create a JmriJFrame with standard settings, optional save/restore of size and position.
      Parameters:
      saveSize - set true to save the last known size
      savePosition - set true to save the last known location
    • DisplayFrame

      public DisplayFrame​(String name, boolean saveSize, boolean savePosition)
      Create a JmriJFrame with with given name plus standard settings, including optional save/restore of size and position.
      Parameters:
      name - title of the Frame
      saveSize - set true to save the last knowm size
      savePosition - set true to save the last known location
    • DisplayFrame

      public DisplayFrame​(String name, Editor editor)
      Create a JmriJFrame for ItemPalette or for edit popups of a given editor panel. Such child classes need to provide backgrounds for their panes and panels.
      Parameters:
      name - title of the Frame
      editor - editor of panel items
    • DisplayFrame

      public DisplayFrame()
      Create a JmriJFrame with standard settings, including saving/restoring of size and position.
    • DisplayFrame

      public DisplayFrame​(String name)
      Create a JmriJFrame with with given name plus standard settings, including saving/restoring of size and position.
      Parameters:
      name - title of the JFrame
  • Method Details

    • setPreviewBg

      public void setPreviewBg​(int index)
      This may be used as a callback to notify children of this class when the preview color has changed. Children of this class should override if there are several other members with separate preview panels. e.g. ItemPalette But prevent a loop when calling super in that process (bug in 4.21.3; fixed in 4.21.4)
      Parameters:
      index - index of selection in _backgrounds array
    • getPreviewBg

      public int getPreviewBg()
    • getPreviewBackground

    • getCurrentColor

      Returns:
      the color of the background of editor display panel
    • getBackground

      public BufferedImage getBackground​(int index)
    • updateBackground

      public void updateBackground​(Editor ed)
      Called when the background of the display panel is changed.
      Parameters:
      ed - the editor of the display panel
    • getEditor

      public Editor getEditor()
    • reSize

      public void reSize​(Container container, Dimension deltaDim, Dimension newDim)
      Resizes this frame to accommodate the size of the tab panel when tab is changed. Otherwise it may force the tab panel to use scrollbars or be far oversized. As a trade off to keep right mouse arrow in same place for ItemPalette accept frame is wider in few cases.
      Parameters:
      container - Container to be resized
      deltaDim - Size difference of container with old contents
      newDim - Size of the new contents