I have a GUI ive created in Scala. Its very simple but I would like to modify the DSLOutput object from outside of DSLGUI. Does anyone know how I can call DSLOutput.append() from outside of the DSLGUI? Ive tried importing DSLGUI but I cant seems to figure out how to access DSLOutput.
package api
import swing._
import event._
object DSLGUI extends SimpleSwingApplication{
def top = new MainFrame{
title = "Computer Repair Advisory System"
object Commands extends TextField(columns = 50)
object DSLOutput extends TextArea(rows = 15, columns = 50)
object SendCommand extends Button("Send")
val CommandPanel = new FlowPanel{
contents += Commands
contents += SendCommand
}
contents = new BoxPanel(Orientation.Vertical){
contents +=CommandPanel
contents += DSLOutput
}
listenTo(SendCommand)
reactions += {
case ButtonClicked(SendCommand) =>
DSLOutput append "Test "
}
}
}
You would have to declare it in the scope of
DSLGUI, rather than as a local object within yourtopmethod. Then you can access it withDSLGUI.DSLOutput.i.e.