Swing EditorPane Scala size not working -
i have created below editorpane scala.swing
import scala.swing.{font, color, editorpane} val textarea = new editorpane() { font = new font("monospaced", java.awt.font.plain , 20 ) background = color.darkgray foreground = color.magenta size = new java.awt.dimension(30,50) }
running above code generates error:
value size_= not member of scala.swing.editorpane
in scala.swing editorpane api (http://www.scala-lang.org/api/2.10.4/index.html#scala.swing.editorpane) refers size being java.awt.dimension
can not see why code wrong. tried size.setsize(30,50)
, compiles editorpane has 1 line means size not being set correctly.
what problem here?
ps : have latest scala version.
editorpane
inherits components uielement
.
uielement
provides related setter methods like:
minimumsize_=(x: dimension) maximumsize_=(x: dimension) preferredsize_=(x: dimension)
there size
method, no setter it. explains error.
my personal interpretation:
in end, layoutmanager deal sizes of components , should not manually interfere. can state wishes minimum, maximum , preferred size.
the classes can directly set size windows , frames.
new mainframe() { size = new dimension(30,50) }
Comments
Post a Comment