Class AbstractComponentOutputStream<T extends javax.swing.JComponent>
- java.lang.Object
-
- java.io.OutputStream
-
- de.alpharogroup.swing.panels.output.AbstractComponentOutputStream<T>
-
- Type Parameters:
T- the generic type of the component
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
- Direct Known Subclasses:
JLabelOutputStream,JTextAreaOutputStream
public abstract class AbstractComponentOutputStream<T extends javax.swing.JComponent> extends java.io.OutputStreamThe classAbstractComponentOutputStreamis inspired from stackoverflow question and the accepted answer.
-
-
Constructor Summary
Constructors Constructor Description AbstractComponentOutputStream(T component)AbstractComponentOutputStream(T component, int maxLines)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidappend(javax.swing.JComponent swingComponent, java.lang.String text)voidclear()Clear the current console text area.voidclose()voidflush()protected abstract voidreplaceRange(javax.swing.JComponent swingComponent, java.lang.String text, int start, int end)protected abstract voidsetText(javax.swing.JComponent swingComponent, java.lang.String text)Sets the text.voidwrite(byte[] ba)voidwrite(byte[] ba, int str, int len)voidwrite(int val)
-
-
-
Method Detail
-
append
protected abstract void append(javax.swing.JComponent swingComponent, java.lang.String text)
-
clear
public void clear()
Clear the current console text area.
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream
-
flush
public void flush()
- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream
-
replaceRange
protected abstract void replaceRange(javax.swing.JComponent swingComponent, java.lang.String text, int start, int end)
-
setText
protected abstract void setText(javax.swing.JComponent swingComponent, java.lang.String text)Sets the text.- Parameters:
swingComponent- the swing componenttext- the text
-
write
public void write(byte[] ba)
- Overrides:
writein classjava.io.OutputStream
-
write
public void write(byte[] ba, int str, int len)- Overrides:
writein classjava.io.OutputStream
-
write
public void write(int val)
- Specified by:
writein classjava.io.OutputStream
-
-