moreswing.swing.i18n.LRadioMenuItem.scala Maven / Gradle / Ivy
The newest version!
package moreswing.swing.i18n
import scala.swing.RadioMenuItem
/** It's [[scala.swing.RadioMenuItem]] with localization support.
*
* @author myst3r10n
*/
trait LRadioMenuItem extends RadioMenuItem with LocaleListener {
private var textKey = super.text
private var tooltipKey: String = null
/** Add listener to [[scala.swingx.i18n.LocaleManager]]. */
LocaleManager += this
/** Called by [[scala.swingx.i18n.LocaleManager]] if locale changed. */
def localeChanged {
text = textKey
if(tooltipKey != null)
tooltip = tooltipKey
}
/** Set text. */
override def text_= (s: String) {
this.textKey = s
super.text = LocaleManager.text(textKey)
}
/** Set tooltip. */
override def tooltip_= (t: String) {
this.tooltipKey = t
super.tooltip = LocaleManager.text(tooltipKey)
}
}