This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Why doesn't FormattedTextField extend TextField?

No replies
Alex Hvostov
Joined: 2010-06-15,
User offline. Last seen 42 years 45 weeks ago.

Why doesn't scala.swing.FormattedTextField extend scala.swing.TextField?

I can't see any reason for this. A FormattedTextField conceptually is
also a TextField, and javax.swing.JFormattedTextField does extend
javax.swing.JTextField. Moreover, some properties are missing from
scala.swing.FormattedTextField, like 'columns' and
'horizontalAlignment', so I have to call into the peer in order to use
them.

By the way, I noticed that, for the properties where
scala.swing.TextField takes a function and wraps it in one of Java
Swing's interfaces (like InputVerifier), scala.swing.TextField is both
wrapping the function in a Java Swing interface in the setter method AND
wrapping the Java Swing interface with a function in the getter method.
This appears to have an unpleasant potential for wasting memory.

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland