    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.24 1997/10/30 16:00:11 leo Exp $
Author:
  Matthias L. Jugel, Marcus Meißner

##

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

##

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

##

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

##

version

      public String version

  If you need the runtime version, just ask this variable.

debug

      public final static int debug

  Enable debug messages. This is final static to prevent unused code to be compiled.

SCROLL_UP

      public final static boolean SCROLL_UP

  Scroll up when inserting a line.

SCROLL_DOWN

      public final static boolean SCROLL_DOWN

  Scroll down when inserting a line.

RESIZE_NONE

      public final static int RESIZE_NONE

  Do nothing when the container is resized.

RESIZE_SCREEN

      public final static int RESIZE_SCREEN

  Resize the width and height of the characterscreen.

RESIZE_FONT

      public final static int RESIZE_FONT

  Resize the font to the new screensize.

NORMAL

      public final static int NORMAL

  Make character normal.

BOLD

      public final static int BOLD

  Make character bold.

UNDERLINE

      public final static int UNDERLINE

  Underline character.

INVERT

      public final static int INVERT

  Invert character.

##

CharDisplay

      public CharDisplay()

  Create a character display with size 80x24 and Font "Courier", size 12.

CharDisplay

      public CharDisplay(int width,
                         int height)

  Create a character display with specific size, Font is "Courier", size 12.

CharDisplay

      public CharDisplay(String fname,
                         int fsize)

  Create a character display with 80x24 and specific font and font size.

CharDisplay

      public CharDisplay(int width,
                         int height,
                         String fname,
                         int fsize)

  Create a character display with specific size, font and font size.

##

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

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

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

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

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

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

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

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

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

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

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

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

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

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

setCursorPos

      public void setCursorPos(int c,
                               int l)

  Puts the cursor at the specified position.
  Parameters:
    c - column
    l - line

getCursorPos

      public Dimension getCursorPos()

  Get the current cursor position.
  See Also:
    Dimension

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

getTopMargin

      public int getTopMargin()

  Get the top scroll margin.

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

getBottomMargin

      public int getBottomMargin()

  Get the bottom scroll margin.

setBufferSize

      public void setBufferSize(int amount)

  Set scrollback buffer size.
  Parameters:
    amount - new size of the buffer

getBufferSize

      public int getBufferSize()

  Retrieve current scrollback buffer size.
  See Also:
    setBufferSize

getMaxBufferSize

      public int getMaxBufferSize()

  Retrieve maximum buffer Size.
  See Also:
    getBufferSize

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

getWindowBase

      public int getWindowBase()

  Get the current window base.
  See Also:
    setWindowBase

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

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

getRows

      public int getRows()

  Get amount of rows on the screen.

getColumns

      public int getColumns()

  Get amount of columns on the screen.

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

setScrollbar

      public void setScrollbar(String position)

  Set the scrollbar position. valid values are "East" or "West".
  Parameters:
    position - the position of the scrollbar

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

redraw

      public void redraw()

  Redraw marked lines.
  See Also:
    markLine

update

      public void update(Graphics g)

  Update the display. to reduce flashing we have overridden this method.
  Overrides:
    update in class Component

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

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

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

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

insets

      public Insets insets()

  The insets of the character display define the border.
  Returns:
    Insets border thickness in pixels
  Overrides:
    insets in class Container

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