diff options
Diffstat (limited to 'NET/worlds/console/FocusPreservingTextField.java')
| -rw-r--r-- | NET/worlds/console/FocusPreservingTextField.java | 898 |
1 files changed, 898 insertions, 0 deletions
diff --git a/NET/worlds/console/FocusPreservingTextField.java b/NET/worlds/console/FocusPreservingTextField.java new file mode 100644 index 0000000..4329155 --- /dev/null +++ b/NET/worlds/console/FocusPreservingTextField.java @@ -0,0 +1,898 @@ +/* */ package NET.worlds.console; +/* */ +/* */ import NET.worlds.scape.EventQueue; +/* */ import NET.worlds.scape.Pilot; +/* */ import java.awt.Event; +/* */ import java.awt.Font; +/* */ import java.awt.TextField; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ class FocusPreservingTextField +/* */ extends TextField +/* */ { +/* */ private static final long serialVersionUID = 7475622191515920214L; +/* */ private static FocusPreservingTextField lostFocus; +/* */ private static FocusPreservingTextField hasFocus; +/* */ private static FocusPreservingTextField chatLine; +/* 782 */ private static Object hasFocusMutex = new Object(); +/* */ +/* */ +/* 785 */ private static Font font = new Font(Console.message("GammaTextFont"), +/* 786 */ 0, 12); +/* */ boolean preserveFocus; +/* */ +/* 789 */ public FocusPreservingTextField() { super(30); +/* 790 */ setFocusable(true); +/* 791 */ setFont(font); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ boolean takeNextFocus; +/* */ +/* */ +/* */ +/* */ public void isChatLine() +/* */ { +/* 804 */ chatLine = this; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void requestFocus() +/* */ { +/* 814 */ if (!this.takeNextFocus) { +/* 815 */ synchronized (hasFocusMutex) { +/* 816 */ this.preserveFocus = (((hasFocus != null) && +/* 817 */ (hasFocus.getText().length() != 0)) || ( +/* 818 */ (chatLine != null) && (chatLine.getText().length() != 0))); +/* */ } +/* */ } +/* 821 */ this.takeNextFocus = false; +/* 822 */ if (!this.preserveFocus) { +/* 823 */ super.requestFocus(); +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ public void takeNextFocus() +/* */ { +/* 831 */ this.preserveFocus = false; +/* 832 */ this.takeNextFocus = true; +/* */ } +/* */ +/* */ @Deprecated +/* */ public boolean handleEvent(Event e) +/* */ { +/* 838 */ synchronized (hasFocusMutex) { +/* 839 */ if (e.id == 1005) +/* */ { +/* */ +/* */ +/* */ +/* */ +/* 845 */ if (hasFocus == this) { +/* 846 */ lostFocus = this; +/* 847 */ hasFocus = null; +/* 848 */ this.preserveFocus = false; +/* */ } +/* 850 */ } else if (e.id == 1004) +/* */ { +/* */ +/* */ +/* */ +/* 855 */ hasFocus = this; +/* 856 */ if ((this.preserveFocus) && (lostFocus != null)) { +/* 857 */ lostFocus.takeNextFocus(); +/* 858 */ lostFocus.requestFocus(); +/* */ } +/* 860 */ lostFocus = null; +/* 861 */ this.preserveFocus = false; +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* 867 */ if (e.id == 401) { +/* 868 */ Console.wake(); +/* 869 */ if (e.key == 27) { +/* 870 */ setText(""); +/* 871 */ return true; } +/* 872 */ if (((e.modifiers & 0x2) != 0) && (e.key >= 1) && +/* 873 */ (e.key <= 26)) +/* */ { +/* */ +/* 876 */ if (e.key != 22) +/* */ { +/* 878 */ Pilot pilot = Pilot.getActive(); +/* 879 */ if (pilot != null) +/* 880 */ pilot.animate("abcdefghijklmnopqrstuvwxyz".substring(e.key - 1, e.key)); +/* 881 */ return true; +/* */ } +/* */ } +/* */ } +/* */ +/* 886 */ if (EventQueue.redirectDrivingKeys(e)) { +/* 887 */ return true; +/* */ } +/* */ +/* 890 */ return super.handleEvent(e); +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\FocusPreservingTextField.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |