Created
November 23, 2012 11:28
-
-
Save fnumatic/4135213 to your computer and use it in GitHub Desktop.
Simple Swing Application with scala.react * github.com/ingoem/scala-react
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is based on the scala.react library. | |
There should be an output on the console on every button click. | |
But nothing happens. Any clue? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MySwingDomain._ | |
object Gui extends ReactiveSwingApp { | |
val button = new MyButton("test") | |
def top = new MainFrame { | |
contents = new FlowPanel { | |
contents += button | |
} | |
} | |
schedule { ConsoleObserver().obs } | |
} | |
case class ConsoleObserver() extends Observing { | |
def obs { | |
observe(Gui.button.actionPerformed)(_ => println("click")) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object MySwingDomain extends SwingDomain { | |
self:Domain => | |
val scheduler = new SwingScheduler() | |
val engine = new Engine | |
} | |
abstract class SwingDomain extends Domain { | |
trait ReactiveSwingApp extends SimpleSwingApplication { | |
override def main(args: Array[String]) { | |
schedule { startup(args) } | |
start() | |
} | |
} | |
} |
Hi again,
after digging and debugging through the code I found the culprit (see my fork of your gist)
source emit getAction
needs to be a
source << getAction
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi fnumatic, I am currently also experimenting with Scala.React (see https://github.com/nightscape/scala-react).
I haven't gotten Scala.React to work in my Android project, but I ran the benchmarks to see how a correct call stack looks like:
Hope this helps a little. I try to keep you up-to-date with my findings.