Class display.CharDisplay
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class display.CharDisplay

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----display.CharDisplay

public class CharDisplay
extends Panel
A simple character display.
Version:
$Id: CharDisplay.java,v 1.26 1998/02/09 08:26:33 leo Exp $
Author:
Matthias L. Jugel, Marcus Meißner

Variable Index

 o BOLD
Make character bold.
 o debug
Enable debug messages.
 o INVERT
Invert character.
 o NORMAL
Make character normal.
 o RESIZE_FONT
Resize the font to the new screensize.
 o RESIZE_NONE
Do nothing when the container is resized.
 o RESIZE_SCREEN
Resize the width and height of the characterscreen.
 o SCROLL_DOWN
Scroll down when inserting a line.
 o SCROLL_UP
Scroll up when inserting a line.
 o UNDERLINE
Underline character.
 o version
If you need the runtime version, just ask this variable.

Constructor Index

 o CharDisplay()
Create a character display with size 80x24 and Font "Courier", size 12.
 o CharDisplay(int, int)
Create a character display with specific size, Font is "Courier", size 12.
 o CharDisplay(int, int, String, int)
Create a character display with specific size, font and font size.
 o CharDisplay(String, int)
Create a character display with 80x24 and specific font and font size.

Method Index

 o deleteArea(int, int, int, int)
Delete a rectangular portion of the screen.
 o deleteChar(int, int)
Delete a character at a given position on the screen.
 o deleteLine(int)
Delete a line at a specific position.
 o getAttributes(int, int)
Get the attributes for the specified position.
 o getBottomMargin()
Get the bottom scroll margin.
 o getBufferSize()
Retrieve current scrollback buffer size.
 o getChar(int, int)
Get the character at the specified position.
 o getColumns()
Get amount of columns on the screen.
 o getCursorPos()
Get the current cursor position.
 o getMaxBufferSize()
Retrieve maximum buffer Size.
 o getRows()
Get amount of rows on the screen.
 o getTopMargin()
Get the top scroll margin.
 o getWindowBase()
Get the current window base.
 o handleEvent(Event)
Handle mouse events for copy & paste
 o insertChar(int, int, char, int)
Insert a character at a specific position on the screen.
 o insertLine(int)
Insert a blank line at a specific position.
 o insertLine(int, boolean)
Insert a blank line at a specific position.
 o insertLine(int, int)
Insert blank lines at a specific position.
 o insertLine(int, int, boolean)
Insert blank lines at a specific position.
 o insets()
The insets of the character display define the border.
 o markLine(int, int)
Mark lines to be updated with redraw().
 o paint(Graphics)
Paint the current screen.
 o preferredSize()
Return the preferred Size of the character display.
 o putChar(int, int, char)
Put a character on the screen with normal font and outline.
 o putChar(int, int, char, int)
Put a character on the screen with specific font and outline.
 o putString(int, int, String)
Put a String at a specific position.
 o putString(int, int, String, int)
Put a String at a specific position giving all characters the same attributes.
 o redraw()
Redraw marked lines.
 o reshape(int, int, int, int)
Reshape character display according to resize strategy.
 o setBorder(int, boolean)
Set the border thickness and the border type.
 o setBottomMargin(int)
Set the bottom scroll margin for the screen.
 o setBufferSize(int)
Set scrollback buffer size.
 o setCursorPos(int, int)
Puts the cursor at the specified position.
 o setResizeStrategy(int)
Set the strategy when window is resized.
 o setScrollbar(String)
Set the scrollbar position.
 o setTopMargin(int)
Set the top scroll margin for the screen.
 o setWindowBase(int)
Set the current window base.
 o setWindowSize(int, int)
Change the size of the screen.
 o size()
Return the real size in points of the character display.
 o update(Graphics)
Update the display.

Variables

 o version
  public String version
If you need the runtime version, just ask this variable.
 o debug
  public final static int debug
Enable debug messages. This is final static to prevent unused code to be compiled.
 o SCROLL_UP
  public final static boolean SCROLL_UP
Scroll up when inserting a line.
 o SCROLL_DOWN
  public final static boolean SCROLL_DOWN
Scroll down when inserting a line.
 o RESIZE_NONE
  public final static int RESIZE_NONE
Do nothing when the container is resized.
 o RESIZE_SCREEN
  public final static int RESIZE_SCREEN
Resize the width and height of the characterscreen.
 o RESIZE_FONT
  public final static int RESIZE_FONT
Resize the font to the new screensize.
 o NORMAL
  public final static int NORMAL
Make character normal.
 o BOLD
  public final static int BOLD
Make character bold.
 o UNDERLINE
  public final static int UNDERLINE
Underline character.
 o INVERT
  public final static int INVERT
Invert character.

Constructors

 o CharDisplay
  public CharDisplay()
Create a character display with size 80x24 and Font "Courier", size 12.
 o CharDisplay
  public CharDisplay(int width,
                     int height)
Create a character display with specific size, Font is "Courier", size 12.
 o CharDisplay
  public CharDisplay(String fname,
                     int fsize)
Create a character display with 80x24 and specific font and font size.
 o CharDisplay
  public CharDisplay(int width,
                     int height,
                     String fname,
                     int fsize)
Create a character display with specific size, font and font size.

Methods

 o putChar
  public void putChar(int c,
                      int l,
                      char ch)
Put a character on the screen with normal font and outline. The character previously on that position will be overwritten. You need to call redraw() to update the screen.
Parameters:
c - x-coordinate (column)
l - y-coordinate (line)
ch - the character to show on the screen
See Also:
insertChar, deleteChar, redraw
 o putChar
  public void putChar(int c,
                      int l,
                      char ch,
                      int attributes)
Put a character on the screen with specific font and outline. The character previously on that position will be overwritten. You need to call redraw() to update the screen.
Parameters:
c - x-coordinate (column)
l - y-coordinate (line)
ch - the character to show on the screen
attributes - the character attributes
See Also:
BOLD, UNDERLINE, INVERT, NORMAL, insertChar, deleteChar, redraw
 o getChar
  public char getChar(int c,
                      int l)
Get the character at the specified position.
Parameters:
c - x-coordinate (column)
l - y-coordinate (line)
See Also:
putChar
 o getAttributes
  public int getAttributes(int c,
                           int l)
Get the attributes for the specified position.
Parameters:
c - x-coordinate (column)
l - y-coordinate (line)
See Also:
putChar
 o insertChar
  public void insertChar(int c,
                         int l,
                         char ch,
                         int attributes)
Insert a character at a specific position on the screen. All character right to from this position will be moved one to the right. You need to call redraw() to update the screen.
Parameters:
c - x-coordinate (column)
l - y-coordinate (line)
ch - the character to insert
attributes - the character attributes
See Also:
BOLD, UNDERLINE, INVERT, NORMAL, putChar, deleteChar, redraw
 o deleteChar
  public void deleteChar(int c,
                         int l)
Delete a character at a given position on the screen. All characters right to the position will be moved one to the left. You need to call redraw() to update the screen.
Parameters:
c - x-coordinate (column)
l - y-coordinate (line)
See Also:
putChar, insertChar, redraw
 o putString
  public void putString(int c,
                        int l,
                        String s)
Put a String at a specific position. Any characters previously on that position will be overwritten. You need to call redraw() for screen update.
Parameters:
c - x-coordinate (column)
l - y-coordinate (line)
s - the string to be shown on the screen
See Also:
BOLD, UNDERLINE, INVERT, NORMAL, putChar, insertLine, deleteLine, redraw
 o putString
  public void putString(int c,
                        int l,
                        String s,
                        int attributes)
Put a String at a specific position giving all characters the same attributes. Any characters previously on that position will be overwritten. You need to call redraw() to update the screen.
Parameters:
c - x-coordinate (column)
l - y-coordinate (line)
s - the string to be shown on the screen
attributes - character attributes
See Also:
BOLD, UNDERLINE, INVERT, NORMAL, putChar, insertLine, deleteLine, redraw
 o insertLine
  public void insertLine(int l)
Insert a blank line at a specific position. The current line and all previous lines are scrolled one line up. The top line is lost. You need to call redraw() to update the screen.
Parameters:
l - the y-coordinate to insert the line
See Also:
deleteLine, redraw
 o insertLine
  public void insertLine(int l,
                         int n)
Insert blank lines at a specific position. You need to call redraw() to update the screen
Parameters:
l - the y-coordinate to insert the line
n - amount of lines to be inserted
See Also:
deleteLine, redraw
 o insertLine
  public void insertLine(int l,
                         boolean scrollDown)
Insert a blank line at a specific position. Scroll text according to the argument. You need to call redraw() to update the screen
Parameters:
l - the y-coordinate to insert the line
scrollDown - scroll down
See Also:
deleteLine, SCROLL_UP, SCROLL_DOWN, redraw
 o insertLine
  public synchronized void insertLine(int l,
                                      int n,
                                      boolean scrollDown)
Insert blank lines at a specific position. The current line and all previous lines are scrolled one line up. The top line is lost. You need to call redraw() to update the screen.
Parameters:
l - the y-coordinate to insert the line
n - number of lines to be inserted
scrollDown - scroll down
See Also:
deleteLine, SCROLL_UP, SCROLL_DOWN, redraw
 o deleteLine
  public void deleteLine(int l)
Delete a line at a specific position. Subsequent lines will be scrolled up to fill the space and a blank line is inserted at the end of the screen.
Parameters:
l - the y-coordinate to insert the line
See Also:
deleteLine
 o deleteArea
  public void deleteArea(int c,
                         int l,
                         int w,
                         int h)
Delete a rectangular portion of the screen. You need to call redraw() to update the screen.
Parameters:
c - x-coordinate (column)
l - y-coordinate (row)
w - with of the area in characters
h - height of the area in characters
See Also:
deleteChar, deleteLine, redraw
 o setCursorPos
  public void setCursorPos(int c,
                           int l)
Puts the cursor at the specified position.
Parameters:
c - column
l - line
 o getCursorPos
  public Dimension getCursorPos()
Get the current cursor position.
See Also:
Dimension
 o setTopMargin
  public void setTopMargin(int l)
Set the top scroll margin for the screen. If the current bottom margin is smaller it will become the top margin and the line will become the bottom margin.
Parameters:
l - line that is the margin
 o getTopMargin
  public int getTopMargin()
Get the top scroll margin.
 o setBottomMargin
  public void setBottomMargin(int l)
Set the bottom scroll margin for the screen. If the current top margin is bigger it will become the bottom margin and the line will become the top margin.
Parameters:
l - line that is the margin
 o getBottomMargin
  public int getBottomMargin()
Get the bottom scroll margin.
 o setBufferSize
  public void setBufferSize(int amount)
Set scrollback buffer size.
Parameters:
amount - new size of the buffer
 o getBufferSize
  public int getBufferSize()
Retrieve current scrollback buffer size.
See Also:
setBufferSize
 o getMaxBufferSize
  public int getMaxBufferSize()
Retrieve maximum buffer Size.
See Also:
getBufferSize
 o setWindowBase
  public void setWindowBase(int line)
Set the current window base. This allows to view the scrollback buffer.
Parameters:
line - the line where the screen window starts
See Also:
setBufferSize, getBufferSize
 o getWindowBase
  public int getWindowBase()
Get the current window base.
See Also:
setWindowBase
 o setWindowSize
  public void setWindowSize(int width,
                            int height)
Change the size of the screen. This will include adjustment of the scrollback buffer.
Parameters:
columns - width of the screen
columns - height of the screen
 o setResizeStrategy
  public void setResizeStrategy(int strategy)
Set the strategy when window is resized. RESIZE_FONT is default.
Parameters:
strategy - the strategy
See Also:
RESIZE_NONE, RESIZE_FONT, RESIZE_SCREEN
 o getRows
  public int getRows()
Get amount of rows on the screen.
 o getColumns
  public int getColumns()
Get amount of columns on the screen.
 o setBorder
  public void setBorder(int thickness,
                        boolean raised)
Set the border thickness and the border type.
Parameters:
thickness - border thickness in pixels, zero means no border
raised - a boolean indicating a raised or embossed border
 o setScrollbar
  public void setScrollbar(String position)
Set the scrollbar position. valid values are "East" or "West".
Parameters:
position - the position of the scrollbar
 o markLine
  public void markLine(int l,
                       int n)
Mark lines to be updated with redraw().
Parameters:
l - starting line
n - amount of lines to be updated
See Also:
redraw
 o redraw
  public void redraw()
Redraw marked lines.
See Also:
markLine
 o update
  public void update(Graphics g)
Update the display. to reduce flashing we have overridden this method.
Overrides:
update in class Component
 o paint
  public synchronized void paint(Graphics g)
Paint the current screen. All painting is done here. Only lines that have changed will be redrawn!
Overrides:
paint in class Component
 o reshape
  public void reshape(int x,
                      int y,
                      int w,
                      int h)
Reshape character display according to resize strategy.
Overrides:
reshape in class Component
See Also:
setResizeStrategy
 o size
  public Dimension size()
Return the real size in points of the character display.
Returns:
Dimension the dimension of the display
Overrides:
size in class Component
See Also:
Dimension
 o preferredSize
  public Dimension preferredSize()
Return the preferred Size of the character display. This turns out to be the actual size.
Returns:
Dimension dimension of the display
Overrides:
preferredSize in class Container
See Also:
size
 o insets
  public Insets insets()
The insets of the character display define the border.
Returns:
Insets border thickness in pixels
Overrides:
insets in class Container
 o handleEvent
  public boolean handleEvent(Event evt)
Handle mouse events for copy & paste
Parameters:
evt - the event that occured
Returns:
boolean true if action was taken
Overrides:
handleEvent in class Component
See Also:
Event

All Packages  Class Hierarchy  This Package  Previous  Next  Index