X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fswingjs%2Fj2s%2Fjavax%2Fswing%2FJPasswordField.js;fp=site%2Fswingjs%2Fj2s%2Fjavax%2Fswing%2FJPasswordField.js;h=be2e1a6578380588d1cc054f06b581528e2b4c4a;hp=3e661929be21c76ba8e2057050185186d1107c0e;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/site/swingjs/j2s/javax/swing/JPasswordField.js b/site/swingjs/j2s/javax/swing/JPasswordField.js index 3e66192..be2e1a6 100644 --- a/site/swingjs/j2s/javax/swing/JPasswordField.js +++ b/site/swingjs/j2s/javax/swing/JPasswordField.js @@ -1,87 +1,87 @@ -Clazz.declarePackage ("javax.swing"); -Clazz.load (["javax.swing.JTextField"], "javax.swing.JPasswordField", ["javax.swing.text.Segment"], function () { -c$ = Clazz.decorateAsClass (function () { -this.echoChar = '\0'; -this.echoCharSet = false; -Clazz.instantialize (this, arguments); -}, javax.swing, "JPasswordField", javax.swing.JTextField); -Clazz.makeConstructor (c$, -function () { -this.construct (null, null, 0); -}); -Clazz.makeConstructor (c$, -function (text) { -this.construct (null, text, 0); -}, "~S"); -Clazz.makeConstructor (c$, -function (columns) { -this.construct (null, null, columns); -}, "~N"); -Clazz.makeConstructor (c$, -function (text, columns) { -this.construct (null, text, columns); -}, "~S,~N"); -Clazz.overrideMethod (c$, "getUIClassID", -function () { -return "PasswordFieldUI"; -}); -Clazz.defineMethod (c$, "updateUI", -function () { -if (!this.echoCharSet) { -this.echoChar = '*'; -}Clazz.superCall (this, javax.swing.JPasswordField, "updateUI", []); -}); -Clazz.defineMethod (c$, "getEchoChar", -function () { -return this.echoChar; -}); -Clazz.defineMethod (c$, "setEchoChar", -function (c) { -this.echoChar = c; -this.echoCharSet = true; -this.repaint (); -this.revalidate (); -}, "~S"); -Clazz.defineMethod (c$, "echoCharIsSet", -function () { -return this.echoChar.charCodeAt (0) != 0; -}); -Clazz.overrideMethod (c$, "cut", -function () { -}); -Clazz.overrideMethod (c$, "copy", -function () { -}); -Clazz.defineMethod (c$, "getPassword", -function () { -var doc = this.getDocument (); -var txt = new javax.swing.text.Segment (); -try { -doc.getText (0, doc.getLength (), txt); -} catch (e) { -if (Clazz.exceptionOf (e, javax.swing.text.BadLocationException)) { -return null; -} else { -throw e; -} -} -var retValue = Clazz.newCharArray (txt.count, '\0'); -System.arraycopy (txt.array, txt.offset, retValue, 0, txt.count); -return retValue; -}); -Clazz.defineMethod (c$, "paramString", -function () { -return Clazz.superCall (this, javax.swing.JPasswordField, "paramString", []) + ",echoChar=" + this.echoChar; -}); -Clazz.defineMethod (c$, "customSetUIProperty", -function (propertyName, value) { -if (propertyName === "echoChar") { -if (!this.echoCharSet) { -this.setEchoChar ((value).charValue ()); -this.echoCharSet = false; -}return true; -}return false; -}, "~S,~O"); -Clazz.defineStatics (c$, -"$$uiClassID", "PasswordFieldUI"); -}); +Clazz.declarePackage ("javax.swing"); +Clazz.load (["javax.swing.JTextField"], "javax.swing.JPasswordField", ["javax.swing.text.Segment"], function () { +c$ = Clazz.decorateAsClass (function () { +this.echoChar = '\0'; +this.echoCharSet = false; +Clazz.instantialize (this, arguments); +}, javax.swing, "JPasswordField", javax.swing.JTextField); +Clazz.makeConstructor (c$, +function () { +this.construct (null, null, 0); +}); +Clazz.makeConstructor (c$, +function (text) { +this.construct (null, text, 0); +}, "~S"); +Clazz.makeConstructor (c$, +function (columns) { +this.construct (null, null, columns); +}, "~N"); +Clazz.makeConstructor (c$, +function (text, columns) { +this.construct (null, text, columns); +}, "~S,~N"); +Clazz.overrideMethod (c$, "getUIClassID", +function () { +return "PasswordFieldUI"; +}); +Clazz.defineMethod (c$, "updateUI", +function () { +if (!this.echoCharSet) { +this.echoChar = '*'; +}Clazz.superCall (this, javax.swing.JPasswordField, "updateUI", []); +}); +Clazz.defineMethod (c$, "getEchoChar", +function () { +return this.echoChar; +}); +Clazz.defineMethod (c$, "setEchoChar", +function (c) { +this.echoChar = c; +this.echoCharSet = true; +this.repaint (); +this.revalidate (); +}, "~S"); +Clazz.defineMethod (c$, "echoCharIsSet", +function () { +return this.echoChar.charCodeAt (0) != 0; +}); +Clazz.overrideMethod (c$, "cut", +function () { +}); +Clazz.overrideMethod (c$, "copy", +function () { +}); +Clazz.defineMethod (c$, "getPassword", +function () { +var doc = this.getDocument (); +var txt = new javax.swing.text.Segment (); +try { +doc.getText (0, doc.getLength (), txt); +} catch (e) { +if (Clazz.exceptionOf (e, javax.swing.text.BadLocationException)) { +return null; +} else { +throw e; +} +} +var retValue = Clazz.newCharArray (txt.count, '\0'); +System.arraycopy (txt.array, txt.offset, retValue, 0, txt.count); +return retValue; +}); +Clazz.defineMethod (c$, "paramString", +function () { +return Clazz.superCall (this, javax.swing.JPasswordField, "paramString", []) + ",echoChar=" + this.echoChar; +}); +Clazz.defineMethod (c$, "customSetUIProperty", +function (propertyName, value) { +if (propertyName === "echoChar") { +if (!this.echoCharSet) { +this.setEchoChar ((value).charValue ()); +this.echoCharSet = false; +}return true; +}return false; +}, "~S,~O"); +Clazz.defineStatics (c$, +"$$uiClassID", "PasswordFieldUI"); +});