IM269 Coursework 2: MessageArea.java


// IM269 - Coursework 2: Echo Client/Server
// Semester A, 2nd November 1998
// Eamonn Martin (BSc Computing)
// Student ID: 96/D59682
// efm001@unl.ac.uk

import java.awt.*;
import java.awt.event.*;

// Text area for read-only message output
public class MessageArea extends TextArea {
	public MessageArea() { this(""); }
	public MessageArea(int r, int c) { this("", r, c); }
	public MessageArea(String text) { this(text, 0, 0); }
	public MessageArea(String text, int r, int c) { this(text, r, c, SCROLLBARS_BOTH); }
	public MessageArea(String text, int scrollbars) { this(text, 0, 0, scrollbars); }
	public MessageArea(String text, int r, int c, int scrollbars) {
		super(text, r, c, scrollbars);		// Construct TextArea
		addFocusListener(new FocusAdapter() {	// Pass the buck
			public void focusGained(FocusEvent e) { transferFocus(); }
		});
	}
	public boolean isFocusTraversable() { return false; }
	public boolean isEditable() { return false; }
}

Go To: IM269: Programming The Internet