Skip to main content

Class JtvTextDevice

public abstract class JtvTextDevice
extends JtvScroller

Abstract base class for text-output views that extend JtvScroller.

JtvTextDevice provides a minimal streaming-text interface on top of a scrollable viewport. Concrete subclasses implement doSputn(String) to store and display the incoming text; JtvTextDevice supplies the higher-level write(String) entry point and the overflow(int) overflow callback.

The primary concrete implementation is JtvTerminal, which maintains a line-oriented ring buffer and redraws itself as text arrives.

org.viktor44.jtvision.views.JtvTextDevice

Summary​

Constructors​

VisibilitySignature
publicJtvTextDevice(JtvRect bounds, JtvScrollBar aHScrollBar, JtvScrollBar aVScrollBar)

Methods​

ModifiersMethod signatureReturn type
public abstractdoSputn(String s)int
publicoverflow(int c)int
publicwrite(String s)int

Constructors​

JtvTextDevice(JtvRect bounds, JtvScrollBar aHScrollBar, JtvScrollBar aVScrollBar)​

Constructs a text device with the given bounds and optional scroll bars. Delegates directly to JtvScroller.TScroller(JtvRect, JtvScrollBar, JtvScrollBar).

Parameters

  • bounds - the bounding rectangle
  • aHScrollBar - the horizontal scroll bar, or null
  • aVScrollBar - the vertical scroll bar, or null

Methods​

doSputn(String s)​

Writes the string s to the underlying text store and updates the display. This is the core output primitive that subclasses must implement.

Parameters

  • s - the string to output

Returns

the number of characters actually written

overflow(int c)​

Overflow callback invoked when the output buffer is full. If c is non-negative it is converted to a character and written via doSputn(String).

Parameters

  • c - the character code to emit, or a negative value to skip output

Returns

1 always

write(String s)​

Writes the string s via doSputn(String). Returns 0 immediately for null or empty input.

Parameters

  • s - the string to write

Returns

the number of characters written, or 0 if s is null or empty