Class MemoryMonitor

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Runnable, Accessible

public class MemoryMonitor extends JPanel implements Runnable
See Also:
  • Field Details

  • Constructor Details

    • MemoryMonitor

      public MemoryMonitor(StateManager stateManager)
      Default constructor.
      Parameters:
      stateManager - Reference back to application session's StateManager. Cannot be null.
    • MemoryMonitor

      public MemoryMonitor(StateManager stateManager, int percentThreshold, int percentCancel, boolean showClock)
      Create a new MemoryMonitor.
      Parameters:
      stateManager - Reference back to application session's StateManager. Cannot be null.
      percentThreshold - Percentage of use memory before garbage collection is run.
      percentCancel - Not currently in use.
      showClock - Whether or not the clock should be shown instead of the memory monitor widget.
  • Method Details

    • handleMouseEvent

      private void handleMouseEvent(MouseEvent event)
      Handle a mouse event
      Parameters:
      event - the event
    • toggleClock

      private void toggleClock()
    • getToolTip

      private String getToolTip()
      Returns a description of either the clock or memory monitor GUI.
      Returns:
      Description of either the clock or memory monitor GUI.
    • popupMenu

      private void popupMenu(MouseEvent event)
      Popup a menu on an event
      Parameters:
      event - the event
    • toggleRunning

      public void toggleRunning()
      Toggle running
    • setLabelFont

      public void setLabelFont(Font f)
      Set the label font
      Parameters:
      f - the font
    • stop

      public void stop()
      Stop running
    • start

      private void start()
      Start running
    • runGC

      public void runGC()
      Run the GC and clear the cache
    • showStats

      private void showStats() throws IllegalStateException
      Show the statistics.
      Throws:
      IllegalStateException
    • doColorThing

      private Color doColorThing(int percent)
    • run

      public void run()
      Run this monitor
      Specified by:
      run in interface Runnable
    • setRunning

      public void setRunning(boolean r)
      Set whether we are running
      Parameters:
      r - true if we are running
    • getRunning

      public boolean getRunning()
      Get whether we are running
      Returns:
      true if we are
    • main

      public static void main(String[] args)
      Test routine
      Parameters:
      args - not used