Class ViewJFrameMemory

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

public class ViewJFrameMemory extends JFrame implements ActionListener, ChangeListener
Contains a seperatly running thread which checks the currently used and available memory. This frame will display that information several different ways:
  • in a text-area displaying memory used in K, total memory available to the JVM in K, and the relative used amount in per-cent.
  • in a bar-chart that resembles a graphic equaliser on a stereo.
  • in line-graph providing history information.

The memory usage is sampled at a rate which is user-specified. The frame will allow the user to adjust how frequently the memory size will be sampled. For efficiency, no sampling will occur if the frame has been minimized.

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

Version:
0.2 16 June 2001
Author:
David Parsons, Matthew J. McAuliffe, Ph.D.
See Also:
  • Field Details

    • serialVersionUID

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

      private BarMeter bm
      DOCUMENT ME!
    • callGCbutton

      private JButton callGCbutton
      DOCUMENT ME!
    • lm

      private LineMeter lm
      DOCUMENT ME!
    • pauseButton

      private JButton pauseButton
      DOCUMENT ME!
    • paused

      private boolean paused
      DOCUMENT ME!
    • percentUsed

      private JLabel percentUsed
      DOCUMENT ME!
    • sampleRate

      private JTextField sampleRate
      DOCUMENT ME!
    • surf

      thread.
    • total

      private JLabel total
      DOCUMENT ME!
    • used

      private JLabel used
      test notification of memory used.
  • Constructor Details

    • ViewJFrameMemory

      public ViewJFrameMemory()
      Constructor.
  • Method Details

    • 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
    • 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
    • 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.

      This method should be checked periodically to see if there is a good way to ensure that the action within can be superceded by the functionality in MipavUtil.makeNumericsOnly().

      Parameters:
      txt - DOCUMENT ME!