public class JavaConsole
extends javax.swing.JFrame
implements java.awt.event.WindowListener, java.awt.event.KeyListener, java.awt.event.ComponentListener
JavaConsole
Program is a Java Console.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COLOR_AQUA |
static java.lang.String |
COLOR_BLACK |
static java.lang.String |
COLOR_BLUE |
static java.lang.String |
COLOR_FUCHSIA |
static java.lang.String |
COLOR_GRAY |
static java.lang.String |
COLOR_GREEN |
static java.lang.String |
COLOR_LIME |
static java.lang.String |
COLOR_MAROON |
static java.lang.String |
COLOR_NAVY |
static java.lang.String |
COLOR_OLIVE |
static java.lang.String |
COLOR_PURPLE |
static java.lang.String |
COLOR_RED |
static java.lang.String |
COLOR_SILVER |
static java.lang.String |
COLOR_TEAL |
static java.lang.String |
COLOR_WHITE |
static java.lang.String |
COLOR_YELLOW |
static java.lang.String |
FONT_FACE |
static int |
FONT_SIZE |
static int |
GRAPHIC_HEIGHT |
static int |
GRAPHIC_WIDTH |
javax.swing.JPanel |
pnlText |
javax.swing.JTabbedPane |
tpConsole |
static int |
WIN_HEIGHT |
static int |
WIN_WIDTH |
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
JavaConsole()
The constructor
JavaConsole creates a new instance(object) of the class. |
JavaConsole(java.lang.String header)
The constructor
JavaConsole creates a new instance(object) of the class. |
JavaConsole(java.lang.String header,
int width,
int height)
The constructor
JavaConsole creates a new instance(object) of the class. |
Modifier and Type | Method and Description |
---|---|
void |
center()
The method
center centers the window. |
void |
cls()
The method
cls clears the screen. |
void |
componentHidden(java.awt.event.ComponentEvent arg0) |
void |
componentMoved(java.awt.event.ComponentEvent arg0) |
void |
componentResized(java.awt.event.ComponentEvent arg0) |
void |
componentShown(java.awt.event.ComponentEvent arg0) |
java.lang.String |
getNumber2String(double number,
int digits,
java.util.Locale localedef)
The method
getNumber2String converts a number into formated. |
void |
initConsole()
The method
center centers the window. |
double |
input_double()
The method
input_double reads a double value. |
int |
input_int()
The method
input_int reads an integer value. |
java.lang.String |
input()
The method
input reads a string. |
void |
keyPressed(java.awt.event.KeyEvent e) |
void |
keyReleased(java.awt.event.KeyEvent e) |
void |
keyTyped(java.awt.event.KeyEvent e) |
void |
pause()
The method
pause performs a pause of one second. |
void |
pause(int millisecs)
The method
pause performs a pause in milliseconds. |
void |
print(char[] line)
The method
println prints a text and makes no line feed after that. |
void |
print(double number,
int digits)
The method
print prints a double number. |
void |
print(float number,
int digits)
The method
print prints a float number. |
void |
print(int number)
The method
print prints a number. |
void |
print(long number)
The method
print prints a number. |
void |
print(java.lang.String line)
The method
print prints a text. |
void |
println()
The method
println prints a line feed. |
void |
println(char[] line)
The method
println prints a text and makes a line feed after that. |
void |
println(double number,
int digits)
The method
println prints a double number and makes a line feed after that. |
void |
println(float number,
int digits)
The method
println prints a float number and makes a line feed after that. |
void |
println(int number)
The method
println prints a number and makes a line feed after that. |
void |
println(long number)
The method
println prints a number and makes a line feed after that. |
void |
println(java.lang.String line)
The method
println prints a text and makes a line feed after that. |
void |
setBackgroundColor(java.lang.String color)
The method
setBackgroundColor sets the background color of the current text. |
void |
setFontColor(java.lang.String color)
The method
setFontColor sets the fond color of the current text. |
void |
setGraphic(java.awt.image.BufferedImage image)
The method
setGraphic sets the image of a graphic. |
void |
setGraphicDimension(int width,
int height)
The method
setGraphicDimension sets the graphic width and height. |
void |
setStatusInfo(java.lang.String info)
The method
setStatusInfo sets the test of the status info field. |
void |
windowActivated(java.awt.event.WindowEvent e) |
void |
windowClosed(java.awt.event.WindowEvent e) |
void |
windowClosing(java.awt.event.WindowEvent e)
The methode
windowClosing finalizes the program. |
void |
windowDeactivated(java.awt.event.WindowEvent e) |
void |
windowDeiconified(java.awt.event.WindowEvent e) |
void |
windowIconified(java.awt.event.WindowEvent e) |
void |
windowOpened(java.awt.event.WindowEvent e) |
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int WIN_WIDTH
public static final int WIN_HEIGHT
public static final java.lang.String FONT_FACE
public static final int FONT_SIZE
public static final int GRAPHIC_WIDTH
public static final int GRAPHIC_HEIGHT
public static final java.lang.String COLOR_BLACK
public static final java.lang.String COLOR_MAROON
public static final java.lang.String COLOR_GREEN
public static final java.lang.String COLOR_OLIVE
public static final java.lang.String COLOR_NAVY
public static final java.lang.String COLOR_PURPLE
public static final java.lang.String COLOR_TEAL
public static final java.lang.String COLOR_GRAY
public static final java.lang.String COLOR_SILVER
public static final java.lang.String COLOR_RED
public static final java.lang.String COLOR_LIME
public static final java.lang.String COLOR_YELLOW
public static final java.lang.String COLOR_BLUE
public static final java.lang.String COLOR_FUCHSIA
public static final java.lang.String COLOR_AQUA
public static final java.lang.String COLOR_WHITE
public javax.swing.JTabbedPane tpConsole
public javax.swing.JPanel pnlText
public JavaConsole()
JavaConsole
creates a new instance(object) of the class.public JavaConsole(java.lang.String header)
JavaConsole
creates a new instance(object) of the class.header
- the header of the console window.public JavaConsole(java.lang.String header, int width, int height)
JavaConsole
creates a new instance(object) of the class.header
- the header of the console window.width
- the width of the console window.height
- the height of the console window.public void initConsole()
center
centers the window.public void setGraphicDimension(int width, int height)
setGraphicDimension
sets the graphic width and height.width
- the graphic width.height
- the graphic height.public void center()
center
centers the window.public void cls()
cls
clears the screen.public void pause()
pause
performs a pause of one second.public void pause(int millisecs)
pause
performs a pause in milliseconds.millisecs
- the length of the pause in milliseconds.public void setGraphic(java.awt.image.BufferedImage image)
setGraphic
sets the image of a graphic.image
- the image.public void setStatusInfo(java.lang.String info)
setStatusInfo
sets the test of the status info field.info
- the text.public void setFontColor(java.lang.String color)
setFontColor
sets the fond color of the current text.color
- the color string.public void setBackgroundColor(java.lang.String color)
setBackgroundColor
sets the background color of the current text.color
- the color string.public void print(java.lang.String line)
print
prints a text.line
- the text to print.public void println(java.lang.String line)
println
prints a text and makes a line feed after that.line
- the text to print.public void println()
println
prints a line feed.public void println(char[] line)
println
prints a text and makes a line feed after that.line
- the text to print.public void print(char[] line)
println
prints a text and makes no line feed after that.line
- the text to print.public void print(int number)
print
prints a number.number
- the number to print.public void print(long number)
print
prints a number.number
- the number to print.public void print(double number, int digits)
print
prints a double number.number
- the number to print.digits
- of the number.public void print(float number, int digits)
print
prints a float number.number
- the number to print.digits
- of the number.public void println(int number)
println
prints a number and makes a line feed after that.number
- the number to print.public void println(long number)
println
prints a number and makes a line feed after that.number
- the number to print.public void println(double number, int digits)
println
prints a double number and makes a line feed after that.number
- the number to print.digits
- of the number.public void println(float number, int digits)
println
prints a float number and makes a line feed after that.number
- the number to print.digits
- of the number.public java.lang.String input()
input
reads a string.public int input_int()
input_int
reads an integer value.public double input_double()
input_double
reads a double value.public java.lang.String getNumber2String(double number, int digits, java.util.Locale localedef) throws java.lang.Exception
getNumber2String
converts a number into formated.number
- as double.digits
- digits after decimal point.localedef
- the locale for format definition.java.lang.Exception
- if errorpublic void windowActivated(java.awt.event.WindowEvent e)
windowActivated
in interface java.awt.event.WindowListener
public void windowClosed(java.awt.event.WindowEvent e)
windowClosed
in interface java.awt.event.WindowListener
public void windowClosing(java.awt.event.WindowEvent e)
windowClosing
finalizes the program.windowClosing
in interface java.awt.event.WindowListener
public void windowDeactivated(java.awt.event.WindowEvent e)
windowDeactivated
in interface java.awt.event.WindowListener
public void windowDeiconified(java.awt.event.WindowEvent e)
windowDeiconified
in interface java.awt.event.WindowListener
public void windowIconified(java.awt.event.WindowEvent e)
windowIconified
in interface java.awt.event.WindowListener
public void windowOpened(java.awt.event.WindowEvent e)
windowOpened
in interface java.awt.event.WindowListener
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
public void componentHidden(java.awt.event.ComponentEvent arg0)
componentHidden
in interface java.awt.event.ComponentListener
public void componentMoved(java.awt.event.ComponentEvent arg0)
componentMoved
in interface java.awt.event.ComponentListener
public void componentResized(java.awt.event.ComponentEvent arg0)
componentResized
in interface java.awt.event.ComponentListener
public void componentShown(java.awt.event.ComponentEvent arg0)
componentShown
in interface java.awt.event.ComponentListener