Pergunta

I'm trying to make a textArea scrollable with scala swing,

Here's what I have so far:

import scala.swing._

object messages extends TextArea{
    preferredSize = new Dimension(600,340)
}

val frame = new MainFrame{
    contents = new FlowPanel{
        val outputTextScrollPane = new ScrollPane(messages) 
        contents += outputTextScrollPane
    }
}

The problem is the text-area still don't have any scrollbar... Am I missing something or isn't this the right way to add a scrollbar?

Foi útil?

Solução

The preferred size of TextArea is specified by a number of rows and columns, it seems that setting preferredSize is messing it up. If you use the following, it works:

object messages extends TextArea(rows = 40, columns = 60)
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top