diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/swing/scala/swing/Component.scala | 2 | ||||
-rw-r--r-- | src/swing/scala/swing/TextField.scala | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/swing/scala/swing/Component.scala b/src/swing/scala/swing/Component.scala index 3cbe2dbfd1..b7a93ef448 100644 --- a/src/swing/scala/swing/Component.scala +++ b/src/swing/scala/swing/Component.scala @@ -103,7 +103,7 @@ abstract class Component extends UIElement { def tooltip_=(t: String) = peer.setToolTipText(t) def inputVerifier: Component => Boolean = { a => - peer.getInputVerifier.verify(a.peer) + Option(peer.getInputVerifier) forall (_ verify a.peer) } def inputVerifier_=(v: Component => Boolean) { peer.setInputVerifier(new javax.swing.InputVerifier { diff --git a/src/swing/scala/swing/TextField.scala b/src/swing/scala/swing/TextField.scala index d2a9f150a2..f04e122fb9 100644 --- a/src/swing/scala/swing/TextField.scala +++ b/src/swing/scala/swing/TextField.scala @@ -60,15 +60,15 @@ class TextField(text0: String, columns0: Int) extends TextComponent with TextCom peer.removeActionListener(actionListener) } - def verifier: String => Boolean = s => peer.getInputVerifier.verify(peer) + def verifier: String => Boolean = s => Option(peer.getInputVerifier) forall (_ verify peer) def verifier_=(v: String => Boolean) { peer.setInputVerifier(new InputVerifier { - private val old = peer.getInputVerifier + private val old = Option(peer.getInputVerifier) def verify(c: JComponent) = v(text) - override def shouldYieldFocus(c: JComponent) = old.shouldYieldFocus(c) + override def shouldYieldFocus(c: JComponent) = old forall (_ shouldYieldFocus c) }) } - def shouldYieldFocus: String=>Boolean = s => peer.getInputVerifier.shouldYieldFocus(peer) + def shouldYieldFocus: String => Boolean = s => Option(peer.getInputVerifier) forall (_ shouldYieldFocus peer) def shouldYieldFocus_=(y: String=>Boolean) { peer.setInputVerifier(new InputVerifier { private val old = peer.getInputVerifier |