home *** CD-ROM | disk | FTP | other *** search
- package sun.awt;
-
- import java.awt.Event;
- import java.awt.TextComponent;
- import java.awt.TextField;
-
- public class FocusingTextField extends TextField {
- TextField next;
- boolean willSelect;
-
- public FocusingTextField(int var1) {
- super("", var1);
- }
-
- public FocusingTextField(int var1, boolean var2) {
- this(var1);
- this.willSelect = var2;
- }
-
- public void setWillSelect(boolean var1) {
- this.willSelect = var1;
- }
-
- public boolean getWillSelect() {
- return this.willSelect;
- }
-
- public void setNextField(TextField var1) {
- this.next = var1;
- }
-
- public boolean gotFocus(Event var1, Object var2) {
- if (this.willSelect) {
- ((TextComponent)this).select(0, ((TextComponent)this).getText().length());
- }
-
- return true;
- }
-
- public boolean lostFocus(Event var1, Object var2) {
- if (this.willSelect) {
- ((TextComponent)this).select(0, 0);
- }
-
- return true;
- }
-
- public void nextFocus() {
- if (this.next != null) {
- this.next.requestFocus();
- }
-
- super.nextFocus();
- }
- }
-