|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel com.jidesoft.swing.NullPanel com.jidesoft.status.StatusBarItem com.jidesoft.status.MemoryStatusBarItem
public class MemoryStatusBarItem
MemoryStatusBarItem is used to display current used memory vs total memory in current JVM. It also allows manually running garbage collection by pressing the garbage can button, or double clicking on the memory status area.
MemoryStatusBarItem
's item name is "Status". We hardcoded inside this class. So if you add it to
StatusBar and want to get it, you just call statusBar.getItemByName("Status"). If you want to change it to something
else, you would have to override getItemName method.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected AbstractButton |
_button
|
protected JPanel |
_buttonPanel
|
protected JComponent |
_statusArea
|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
MemoryStatusBarItem()
Default constructor. |
Method Summary | |
---|---|
protected AbstractButton |
createButton()
Creates a button which will run garbage collector. |
String |
formatText(long totalMemory,
long freeMemory,
long maxMemory)
Gets the text. |
protected String |
formatTooltip(long freeMemory,
long totalMemory,
long maxMemory)
Gets the tooltip. |
Color |
getFillColor()
Gets filled color. |
protected long |
getFreeMemory()
Gets the free memory. |
Icon |
getGcIcon()
Gets the icon of GC. |
String |
getItemName()
Gets item name. |
protected long |
getMaxMemory()
Returns the maximum amount of memory that the Java virtual machine will attempt to use. |
int |
getPreferredWidth()
Gets preferred width. |
protected long |
getTotalMemory()
Returns the total amount of memory in the Java virtual machine. |
int |
getUpdateInterval()
Gets the update interval in mini-second. |
boolean |
isShowMaxMemory()
Gets the flag for showMaxMemory. |
void |
setFillColor(Color fillColor)
Set filled color. |
void |
setGcIcon(Icon gcIcon)
Sets the icon of GC (Gabage Collection). |
void |
setShowMaxMemory(boolean showMaxMemory)
Sets of the upper memory is the actual heap memory or the max memory. |
void |
setUpdateInterval(int interval)
Sets update interval, in mini-second. |
void |
start()
Starts the timer to repaint the memory status area after certain interval (2 seconds by default). |
void |
stop()
Stops the timer. |
void |
updateUI()
Resets the UI property with a value from the current look and feel. |
Methods inherited from class com.jidesoft.status.StatusBarItem |
---|
getPreferredSize, setPreferredWidth |
Methods inherited from class com.jidesoft.swing.NullPanel |
---|
setBackground, setFont, setForeground |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected JComponent _statusArea
protected AbstractButton _button
protected JPanel _buttonPanel
Constructor Detail |
---|
public MemoryStatusBarItem()
Method Detail |
---|
protected AbstractButton createButton()
protected long getTotalMemory()
protected long getMaxMemory()
protected long getFreeMemory()
public String formatText(long totalMemory, long freeMemory, long maxMemory)
freeMemory
- the free memorytotalMemory
- the total memorymaxMemory
- the max memory as defined in JVM -Xmx.
protected String formatTooltip(long freeMemory, long totalMemory, long maxMemory)
freeMemory
- the free memorytotalMemory
- the total memorymaxMemory
- the max memory as defined in JVM -Xmx.
public String getItemName()
StatusBarItem
getItemName
in class StatusBarItem
public Color getFillColor()
public void updateUI()
StatusBarItem
updateUI
in class StatusBarItem
JComponent.updateUI()
public void setFillColor(Color fillColor)
fillColor
- the fill color.public Icon getGcIcon()
public void setGcIcon(Icon gcIcon)
gcIcon
- the GC iconpublic void setUpdateInterval(int interval)
interval
- interval in mini-secondpublic int getUpdateInterval()
public void start()
public void stop()
public int getPreferredWidth()
StatusBarItem
getPreferredWidth
in class StatusBarItem
public boolean isShowMaxMemory()
public void setShowMaxMemory(boolean showMaxMemory)
showMaxMemory
- true or false.
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |