//================================================================================================== // G r a p h i c Java // T e x t A r e a S t r e a m // By Bruno Bachelet //================================================================================================== // Copyright (c) 1999-2016 // Bruno Bachelet - bruno@nawouak.net - http://www.nawouak.net // // This file is part of the B++ Library. This library is free software; you can redistribute it // and/or modify it under the terms of the GNU Library General Public License as published by the // Free Software Foundation; either version 2 of the License, or (at your option) any later // version. // // This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See // the GNU Library General Public License for more details (http://www.gnu.org).
/*DESCRIPTION*/ /* This module provides a class to create a stream that writes in a text area. */
// Package //--------------------------------------------------------------------------------------- package bpp.graphic;
// Importation //----------------------------------------------------------------------------------- import java.io.OutputStream; import java.awt.TextArea;
// T e x t A r e a S t r e a m Class //------------------------------------------------------------ /*CLASS TextAreaStream */ /* Represents a stream that writes in a text area. All the bytes that are transferred through this stream are written in the associated text area. */ public class TextAreaStream extends OutputStream { //---------------------------------------------------------------------------------------Attributes protected TextArea atTextArea; // Text area where the text will be written. //--------------------------------------------------------------------------------------Constructor /*METHOD TextAreaStream */ /* Builds a stream for a given text area. */ public TextAreaStream(TextArea agTextArea) { atTextArea=agTextArea; } //--------------------------------------------------------------------------------------------Write /*METHOD TextAreaStream */ /* Writes a byte into the stream. */ public void write(int agByte) { atTextArea.append(""+(char)agByte); } }
// End //------------------------------------------------------------------------------------------- |
|