I am trying to use javafx2 on scala with scalafx.
I wrote a simple application and add a menu and a menu item. When i click the menu and hover on the menu item it some times not highlight the menu and as a result it cannot be clicked. In order to check if i am doing something wrong in my code i run the exactly same code in a windows machine and it just works.
I cannot understand why this is happening. I guess it has something to do with unity or gnome or linux in general.
Have anybody else experienced the same problem? Is there any way to fix it or overcome it?
Thanks i advance
Code example: Only the menu has the strange behaviour
package com.msp.ippokratis.ui
import scalafx.Includes._
import scalafx.collections.ObservableBuffer
import scalafx.collections.ObservableBuffer.observableBuffer2ObservableList
import scalafx.application.JFXApp
import scalafx.application.JFXApp.PrimaryStage
import scalafx.scene.Scene
import scalafx.scene.layout.{BorderPane,FlowPane,Priority}
import scalafx.scene.control.{MenuBar,MenuItem,Menu,Button,ComboBox}
import scalafx.event.ActionEvent
object Exampl extends JFXApp {
stage = new PrimaryStage {
scene = new Scene {
content = new BorderPane {
prefHeight = 400
prefWidth = 400
top = new MenuBar {
menus = Seq(
new Menu {
text = "File"
items = Seq(
new MenuItem {
text = "Println"
onAction = (evt: ActionEvent) => {
println("Clicked Menu Item Println")
}
})
})
}
center = new FlowPane {
hgrow = Priority.ALWAYS
content = Seq(
new Button {
text = "Sample Button"
onAction = (evt: ActionEvent) => {
println("Button Clicked")
}
},
new ComboBox {
val seq = List("Apple", "Orange", "Mango", "Banana").toSeq
items = ObservableBuffer(seq.asInstanceOf[Seq[Nothing]])
onAction = (evt: ActionEvent) => {
println("Combobox")
}
})
}
}
}
}
}
Edit 1 : If i click the menu and navigate with the keyboard and press enter it just works on linux too.