IM269 Coursework 2: MessageField.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 field for read-only message output
public class MessageField extends TextField {
public MessageField() { this(""); }
public MessageField(int cols) { this("", cols); }
public MessageField(String text) { this(text, 0); }
public MessageField(String text, int cols) {
super(text, cols); // Construct TextField
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