Class ViewJFrameRegisteredImages

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener, ListSelectionListener, RootPaneContainer, WindowConstants

public class ViewJFrameRegisteredImages extends JFrame implements ActionListener, ListSelectionListener, ChangeListener
Contains a seperatly running thread which checks the list of registered images. The list is updated at a rate which is user-specified. The frame will allow the user to adjust how frequently the list will be updated. For efficiency, no updating will occur if the frame has been minimized.

The registered images frame provides direct user access to the function Runtime.getRuntime.gc() via a "Garbage Collector" button.

There are a number of possible supported uses. There is an unimplemented button to remove un-framed images from the ViewUserInterface image hashtable and there is a button to bring framed-images to the front.

This class has a number of inside classes:

  • ImageRegistryMonitor (a type of Thread) to update the list of images registered with the ViewUserInterface
  • MouseClickAdapter (a type of MouseAdapter) to attempt to bring the selected image's frame to the front
  • ImageCellRenderer (a type of JLabel) to present both the image-name and a helpful icon depicting whether or not the associated image is in a frame or not
Version:
15 April 2002
Author:
Lynne M. Pusanik, Matthew J. McAuliffe, Ph.D., David A. Parsons
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • callImageDeleteButton

      private JButton callImageDeleteButton
      Buttons for dealing with image deletions
    • callImageDeleteAllButton

      private JButton callImageDeleteAllButton
      Buttons for dealing with image deletions
    • callGCButton

      private JButton callGCButton
      Button for dealing with garbage collection
    • callFrameToFrontButton

      private JButton callFrameToFrontButton
      Button for bringing frame to front
    • callFrameDeleteButton

      private JButton callFrameDeleteButton
      Buttons for dealing with frame deletion.
    • callFrameDeleteAllButton

      private JButton callFrameDeleteAllButton
      Buttons for dealing with frame deletion.
    • imageList

      private JList imageList
      The list of images and frames
    • pauseButton

      private JButton pauseButton
      Button for pausing updating of currently registered images
    • paused

      private boolean paused
      Whether currently registered images list is updating
    • sampleRate

      private JTextField sampleRate
      The rate at which to update imageList
    • scrollPane

      private JScrollPane scrollPane
      The scroll pane containing the image list
    • surf

      private ImageRegistryMonitor surf
      thread to watch image registry.
    • UI

      private ViewUserInterface UI
      The current user interface
  • Constructor Details

    • ViewJFrameRegisteredImages

      public ViewJFrameRegisteredImages()
      Constructor.
  • Method Details

    • buildButtonPanel

      private JPanel buildButtonPanel()
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Calls various methods based on the user's actions.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      event - event that triggered function
    • deleteItem

      private void deleteItem(String name, boolean deleteFrame)
      Deletes the item specified by name. If false, only the model image is deleted
      Parameters:
      name - the object to delete
      deleteFrame - whether the frame should be deleted along with the image
    • setVisible

      public void setVisible(boolean flag)
      Shows the frame with the memory.
      Overrides:
      setVisible in class Window
      Parameters:
      flag - DOCUMENT ME!
    • stateChanged

      public void stateChanged(ChangeEvent event)
      Calls various methods based on the changes in the memory panel.
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      event - event that triggered function
    • valueChanged

      public void valueChanged(ListSelectionEvent event)
      Whenever the list changes, the valueChanged is called.

      calls callToFrontbutton#doClick() when the list has been double-clicked, to bring the selected image (and associated frame) to the front.

      Specified by:
      valueChanged in interface ListSelectionListener
      Parameters:
      event - DOCUMENT ME!
    • makeNumericsOnly

      protected void makeNumericsOnly(JTextField txt)
      Takes a txt field, and forces the textfield to accept numbers, backspace and delete-key entries.

      also tells the pauseButton to click.

      Parameters:
      txt - DOCUMENT ME!
    • imageToFront

      private void imageToFront(String selectedName) throws NullPointerException, IllegalArgumentException
      Using the supplied name as the image name, this method finds the frame associated with the image and brings it to the front. Does nothing when selectedName is null.
      Parameters:
      selectedName - DOCUMENT ME!
      Throws:
      NullPointerException - when the selectedName is in the image list, but not associated with any frame.
      IllegalArgumentException - if the selectedName cannot be found in the image list