|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
gr.zeus.ui.JConsolePane
public final class JConsolePane
A java console to replace the command line window. Redirects the stdout and stderr. Customizable. Can save its messages to text file. In addition, it can auto dump to a log file and clear the textarea. Can be used with JFrame, JInternalFrame or as a JPanel. If used in conjunction with any exe creator for java, e.g: launch4j or JSmooth, it eliminates the dos application windows and your application looks more professional.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary |
---|
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 |
Method Summary | |
---|---|
void |
clearBufferMessages()
Clears all the messages stored in the internal buffer from the begining of the JConsolePane . |
void |
clearScreenMessages()
Clears only the messages that are displayed in the textarea. |
void |
destroyConsole()
Destroys the console. |
void |
dumpConsole(java.lang.String filename,
boolean append)
Dumps all the console messages (up to now) to a file (not only the messages displayed in the textarea). |
boolean |
getAppendFirstTime()
Gets append policy. |
boolean |
getAutoSave()
Gets auto save status. |
java.awt.Color |
getBackgroundColor()
Gets the background color of the textarea. |
java.lang.String |
getClearButtonText()
Gets the text of the clear button. |
java.lang.String |
getCloseButtonText()
Gets the text of the close button. |
java.lang.String |
getConfimMessage()
Gets the text for the popup window that confirms file overwrite. |
java.lang.String |
getConfimTitle()
Gets the title for the popup window that confirms file overwrite. |
static JConsolePane |
getConsolePane()
Singleton constructor. |
java.lang.String |
getFilechooserApproveButtonText()
Gets the filechooser approve button text. |
java.lang.String |
getFilechooserTitle()
Gets the filechooser title. |
java.awt.Color |
getForegroundColor()
Gets the foreground color of the textarea. |
int |
getMaxChars()
If -1 no limit, else the messages will be flushed to 'traceFilename' and cleared when this limit is reached. |
java.lang.String |
getMessagesFilename()
Gets the default filename for the filechooser. |
java.lang.String |
getSaveButtonText()
Gets the text of the save button. |
java.awt.Color |
getSelectedTextColor()
Gets the selected text color of the textarea. |
java.awt.Color |
getSelectionColor()
Gets the selection color of the textarea. |
java.awt.Font |
getTextFont()
Gets the font of the textarea. |
java.lang.String |
getTraceFilename()
Gets the file used by dumpConsole() and
all auto save methods. |
void |
hideConsole()
Hides the console. |
void |
hideControlButtons()
Hides the control buttons. |
void |
setAppendFirstTime(boolean b)
Sets append policy. |
void |
setAutoSave(boolean b)
Sets auto save status. |
void |
setBackgroundColor(java.awt.Color c)
Sets the background color of the textarea. |
void |
setClearButtonText(java.lang.String s)
Sets the text of the clear button. |
void |
setCloseButtonText(java.lang.String s)
Sets the text of the close button. |
void |
setConfimMessage(java.lang.String s)
Sets the text for the popup window that confirms file overwrite. |
void |
setConfimTitle(java.lang.String s)
Sets the title for the popup window that confirms file overwrite. |
void |
setFilechooserApproveButtonText(java.lang.String s)
Sets the filechooser approve button text. |
void |
setFilechooserTitle(java.lang.String s)
Sets the filechooser title. |
void |
setForegroundColor(java.awt.Color c)
Sets the foreground color of the textarea. |
void |
setMaxChars(int i)
If -1 no limit, else the messages will be flushed to 'traceFilename' and cleared when this limit is reached. |
void |
setMessagesFilename(java.lang.String s)
Sets the default filename for the filechooser. |
void |
setSaveButtonText(java.lang.String s)
Sets the text of the save button. |
void |
setSelectedTextColor(java.awt.Color c)
Sets the selected text color of the textarea. |
void |
setSelectionColor(java.awt.Color c)
Sets the selection color of the textarea. |
void |
setTextFont(java.awt.Font f)
Sets the font of the textarea. |
void |
setTraceFilename(java.lang.String s)
Sets the file used by dumpConsole() and
all auto save methods. |
void |
showConsole()
Shows the console. |
void |
showControlButtons()
Shows the control buttons. |
void |
startConsole()
Attachs the new streams to stdout and stderr. |
void |
stopConsole()
Attachs the original streams to stdout and stderr. |
void |
updateLNF()
Updates the look and feel of the JConsolePane and it's
components. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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 |
Methods inherited from class java.awt.Container |
---|
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, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
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, hide, 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, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static JConsolePane getConsolePane()
JConsolePane
.public void startConsole()
public void stopConsole()
public void showConsole()
public void hideConsole()
public void showControlButtons()
public void hideControlButtons()
public void clearBufferMessages()
JConsolePane
. Use this if you have printed too many
messages and you want to free up the memory used. Perhaps you should
invoke dumpConsole()
to store the messages first, unless
of course you already have enabled autosave.
public void clearScreenMessages()
public void dumpConsole(java.lang.String filename, boolean append)
clearBufferMessages()
for this.
filename
- The filename to store all console's messages.append
- If true
text is appended in the file,
else the file gets overwritten.public void destroyConsole()
getConsole()
after this
method you will get a brand new console with no messages at all. This
method is not needed for simple applications that are about to invoke
System.exit() or normaly close.
public void updateLNF()
JConsolePane
and it's
components. MUST be called AFTER invoking:
UIManager.setLookAndFeel()
in your application.
public java.lang.String getConfimTitle()
public void setConfimTitle(java.lang.String s)
s
- The title.public java.lang.String getConfimMessage()
public void setConfimMessage(java.lang.String s)
s
- The message.public java.lang.String getMessagesFilename()
public void setMessagesFilename(java.lang.String s)
s
- The filename.public java.lang.String getTraceFilename()
dumpConsole()
and
all auto save methods.
public void setTraceFilename(java.lang.String s)
dumpConsole()
and
all auto save methods.
s
- The filename.public boolean getAppendFirstTime()
public void setAppendFirstTime(boolean b)
b
- true/falsepublic boolean getAutoSave()
public void setAutoSave(boolean b)
b
- true/falsepublic int getMaxChars()
public void setMaxChars(int i)
i
- The limit.public java.awt.Color getForegroundColor()
public void setForegroundColor(java.awt.Color c)
c
- The color.public java.awt.Color getBackgroundColor()
public void setBackgroundColor(java.awt.Color c)
c
- The color.public java.awt.Color getSelectedTextColor()
public void setSelectedTextColor(java.awt.Color c)
c
- The color.public java.awt.Color getSelectionColor()
public void setSelectionColor(java.awt.Color c)
c
- The color.public java.lang.String getClearButtonText()
public void setClearButtonText(java.lang.String s)
s
- The text.public java.lang.String getSaveButtonText()
public void setSaveButtonText(java.lang.String s)
s
- The text.public java.lang.String getCloseButtonText()
public void setCloseButtonText(java.lang.String s)
s
- The text.public java.lang.String getFilechooserTitle()
public void setFilechooserTitle(java.lang.String s)
s
- The title.public java.lang.String getFilechooserApproveButtonText()
public void setFilechooserApproveButtonText(java.lang.String s)
s
- The text.public java.awt.Font getTextFont()
public void setTextFont(java.awt.Font f)
f
- The font.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |