Skip to content

Commit 29d7685

Browse files
committed
fixes #31
- we add `var text` to `Action`; `title` becomes an alias.
1 parent 37c849a commit 29d7685

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ scalaVersionsByJvm in ThisBuild := Map(
1717
12 -> List("2.11.12", "2.12.8", "2.13.0-RC1").map(_ -> false)
1818
)
1919

20-
scalaVersion in ThisBuild := "2.13.0-RC1" // for testing
20+
scalaVersion in ThisBuild := "2.12.8"
2121

2222
OsgiKeys.exportPackage := Seq(s"scala.swing.*;version=${version.value}")
2323

src/main/scala/scala/swing/Action.scala

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,23 @@ abstract class Action(title0: String) {
8181
def actionPerformed(a: java.awt.event.ActionEvent): Unit = apply()
8282
}
8383

84-
/**
85-
* Title is not optional.
86-
*/
87-
def title: String = ifNull(peer.getValue(javax.swing.Action.NAME),"")
88-
def title_=(t: String): Unit = peer.putValue(javax.swing.Action.NAME, t)
84+
/** Gets the `NAME` property.
85+
*/
86+
def text: String = ifNull(peer.getValue(javax.swing.Action.NAME),"")
87+
88+
/** Sets the `NAME` property.
89+
*/
90+
def text_=(t: String): Unit = peer.putValue(javax.swing.Action.NAME, t)
91+
92+
/** An alias for `text`. This is kept for backwards compatibility.
93+
*
94+
* @see [[text]]
95+
*/
96+
def title: String = text
97+
98+
/** An alias for `text_=`. This is kept for backwards compatibility.
99+
*/
100+
def title_=(t: String): Unit = text = t
89101

90102
/**
91103
* None if large icon and small icon are not equal.

0 commit comments

Comments
 (0)