public class Memory_Chart_Panel extends JPanel
The panel may optionally be provided with a popup menu that includes Memory_Chart controls that are also bound to accelerator keys. In addition to basic Memory_Chart controls, a Save History action is provided that will save the current memory sampling history to a file in comma separated value (CSV) format.
Memory_Chart
,
Serialized FormJPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static int |
ANNOTATION_KEY
Menu mnemonic and keyboard accellerator keys.
|
static int |
DEFAULT_SAMPLING_RATE
The default
Memory_Chart sampling rate. |
static String |
ID
Class identification name with source code version and date.
|
static int |
SAMPLING_RATE_KEY
Menu mnemonic and keyboard accellerator keys.
|
static int |
SAVE_HISTORY_KEY
Menu mnemonic and keyboard accellerator keys.
|
static int |
SECONDS_SCALE_KEY
Menu mnemonic and keyboard accellerator keys.
|
static int |
STOP_START_KEY
Menu mnemonic and keyboard accellerator keys.
|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
Memory_Chart_Panel()
Construct a Memory_Chart_Panel with a popup menu and using the
DEFAULT_SAMPLING_RATE . |
Memory_Chart_Panel(boolean provide_menu)
Construct a Memory_Chart_Panel with an optional popup menu.
|
Memory_Chart_Panel(int rate)
Construct a Memory_Chart_Panel using a sampling rate.
|
Memory_Chart_Panel(int rate,
boolean provide_menu)
Construct a Memory_Chart_Panel using a sampling rate and optional
popup menu.
|
Modifier and Type | Method and Description |
---|---|
static long |
Allocated_Memory()
Get the amount of memory currently in use by the Java runtime
environment.
|
boolean |
Annotation()
Test if the Memory_Chart
annotation is enabled. |
Memory_Chart_Panel |
Annotation(boolean enabled)
Enable or disable the Memory_Chart annotations.
|
static long |
Available_Memory()
Get the total amount of memory available to the Java runtime
environment.
|
Memory_Chart_Panel |
CWD(File file)
Sets the current working directory for finding parameter files.
|
static long |
Free_Memory()
Get the amount of memory allocated by the Java runtime environment
but not currently in use.
|
JPopupMenu |
Menu()
Get a popup menu with Memory_Chart controls.
|
int |
Previous_Rate()
Get the previous memory sampling rate.
|
int |
Rate()
Get the memory sampling rate.
|
Memory_Chart_Panel |
Rate(int rate)
Set the memory sampling rate.
|
Memory_Chart_Panel |
Run(boolean run)
Enable or disable the operation of the Memory_Chart.
|
boolean |
Seconds_Scale()
Test if the Memory_Chart
seconds scale is enabled. |
Memory_Chart_Panel |
Seconds_Scale(boolean enabled)
Enable or disable the Memory_Chart seconds scale.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final String ID
public static final int DEFAULT_SAMPLING_RATE
Memory_Chart
sampling rate.public static final int STOP_START_KEY
When the menu
is visible, each key combined with the
ALT key will select the corresponding menu item. When the component
has focus, each key combined with the CTL (control) key will cause
the corresponding action to occur.
public static final int SAMPLING_RATE_KEY
When the menu
is visible, each key combined with the
ALT key will select the corresponding menu item. When the component
has focus, each key combined with the CTL (control) key will cause
the corresponding action to occur.
public static final int ANNOTATION_KEY
When the menu
is visible, each key combined with the
ALT key will select the corresponding menu item. When the component
has focus, each key combined with the CTL (control) key will cause
the corresponding action to occur.
public static final int SECONDS_SCALE_KEY
When the menu
is visible, each key combined with the
ALT key will select the corresponding menu item. When the component
has focus, each key combined with the CTL (control) key will cause
the corresponding action to occur.
public static final int SAVE_HISTORY_KEY
When the menu
is visible, each key combined with the
ALT key will select the corresponding menu item. When the component
has focus, each key combined with the CTL (control) key will cause
the corresponding action to occur.
public Memory_Chart_Panel(int rate, boolean provide_menu)
A border with the title "Memory Use" is placed around a Memory_Chart
that uses the specified sampling rate. A popup menu
is provided if requested.
rate
- The memory sampling rate for the Memory_Chart.provide_menu
- If true, a popup menu is provided.public Memory_Chart_Panel(int rate)
A popup menu
is provided.
rate
- The memory sampling rate for the Memory_Chart.public Memory_Chart_Panel(boolean provide_menu)
The Memory_Chart will use the DEFAULT_SAMPLING_RATE
.
provide_menu
- If true, a popup menu is provided.public Memory_Chart_Panel()
DEFAULT_SAMPLING_RATE
.public boolean Annotation()
annotation
is enabled.
public boolean Seconds_Scale()
seconds scale
is enabled.
public int Rate()
Memory_Chart.Rate(int)
public int Previous_Rate()
Memory_Chart.Previous_Rate()
public static long Free_Memory()
Memory_History.Available_Memory()
public static long Allocated_Memory()
Memory_History.Available_Memory()
public static long Available_Memory()
Memory_History.Available_Memory()
public JPopupMenu Menu()
Controls to stop
and start
memory sampling, set the
sampling rate
, enable and
disable the annotations
and seconds scale
,
and save the current sampling
history
to a file are provided.
The menu actions are also bound to keyboard accelerators.
The Save History action will use a file chooser to select a file in
which the current memory sampling history will be written in comma
separated values (CSV) format. The first line provides the names of
the values on the following lines (one line per sample): "Sample" is
the sample index, starting with zero; "Allocated" followed by a
slash characater ('/') and the total amount of memory available is
the amount of allocated
memory
; and "Free" is the amount of free memory
in the allocated pool.
public Memory_Chart_Panel Run(boolean run)
public Memory_Chart_Panel Rate(int rate)
rate
- The memory sampling
rate
.public Memory_Chart_Panel Annotation(boolean enabled)
enabled
- If true, chart annotations
will be shown. If
false they will not be shown.public Memory_Chart_Panel Seconds_Scale(boolean enabled)
enabled
- If true, chart seconds scale
will be
shown. If false it will not be shown.public Memory_Chart_Panel CWD(File file) throws FileNotFoundException
file
- A File to which to set the CWD. If null, the
"user.dir" System property will be used. If the file does not
refer to an existing directory, the file's parent will be used.FileNotFoundException
- If neither the file nor the file's
parent refers to an existing directory.