madkit.utils.graphics
Class GUIReader

java.lang.Object
  extended by java.io.Reader
      extended by madkit.utils.graphics.GUIReader
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Closeable, java.lang.Readable, java.util.EventListener

public class GUIReader
extends java.io.Reader
implements java.awt.event.ActionListener

A character stream whose source is a TextField or JTextField.


Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
GUIReader(javax.swing.JTextField s)
          Create a new string reader.
GUIReader(javax.swing.JTextField s, java.io.Writer w)
          Create a new string reader.
GUIReader(java.awt.TextField s)
          Create a new string reader.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void close()
          Close the stream.
 boolean getDuplicateOnOutput()
          Get the value of duplicateOnOutput.
 boolean markSupported()
          Tell whether this stream supports the mark() operation, which it does.
 int read()
          Read a single character.
 int read(char[] cbuf, int off, int len)
          Read characters into a portion of an array.
 boolean ready()
          Tell whether this stream is ready to be read.
 void reset()
          Reset the stream to the most recent mark, or to the beginning of the string if it has never been marked.
 void setDuplicateOnOutput(boolean v)
          Set the value of duplicateOnOutput.
 long skip(long ns)
          Skip characters.
 
Methods inherited from class java.io.Reader
mark, read, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GUIReader

public GUIReader(java.awt.TextField s)
Create a new string reader.


GUIReader

public GUIReader(javax.swing.JTextField s)
Create a new string reader.


GUIReader

public GUIReader(javax.swing.JTextField s,
                 java.io.Writer w)
Create a new string reader.

Method Detail

getDuplicateOnOutput

public boolean getDuplicateOnOutput()
Get the value of duplicateOnOutput.

Returns:
Value of duplicateOnOutput.

setDuplicateOnOutput

public void setDuplicateOnOutput(boolean v)
Set the value of duplicateOnOutput.

Parameters:
v - Value to assign to duplicateOnOutput.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

read

public int read()
         throws java.io.IOException
Read a single character.

Overrides:
read in class java.io.Reader
Returns:
The character read, or -1 if the end of the stream has been reached
Throws:
java.io.IOException - If an I/O error occurs

read

public int read(char[] cbuf,
                int off,
                int len)
         throws java.io.IOException
Read characters into a portion of an array.

Specified by:
read in class java.io.Reader
Parameters:
cbuf - Destination buffer
off - Offset at which to start writing characters
len - Maximum number of characters to read
Returns:
The number of characters read, or -1 if the end of the stream has been reached
Throws:
java.io.IOException - If an I/O error occurs

skip

public long skip(long ns)
          throws java.io.IOException
Skip characters.

Overrides:
skip in class java.io.Reader
Throws:
java.io.IOException - If an I/O error occurs

ready

public boolean ready()
Tell whether this stream is ready to be read. String readers are always ready to be read.

Overrides:
ready in class java.io.Reader

markSupported

public boolean markSupported()
Tell whether this stream supports the mark() operation, which it does.

Overrides:
markSupported in class java.io.Reader

reset

public void reset()
           throws java.io.IOException
Reset the stream to the most recent mark, or to the beginning of the string if it has never been marked.

Overrides:
reset in class java.io.Reader
Throws:
java.io.IOException - If an I/O error occurs

close

public void close()
Close the stream.

Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Reader


Copyright © Madkit Team (O. Gutknecht, J. Ferber, F. Michel et al.) All Rights Reserved.