@@ -21,21 +21,21 @@ object Action {
2121 * instead of from its action.
2222 * In Java Swing, one would use `null` instead of a designated action.
2323 */
24- case object NoAction extends Action (" " ) { def apply () {} }
24+ case object NoAction extends Action (" " ) { def apply (): Unit = () }
2525
2626 object Trigger {
2727 trait Wrapper extends Action .Trigger {
2828 def peer : javax.swing.JComponent {
29- def addActionListener (a : ActionListener )
30- def removeActionListener (a : ActionListener )
31- def setAction (a : javax.swing.Action )
29+ def addActionListener (a : ActionListener ): Unit
30+ def removeActionListener (a : ActionListener ): Unit
31+ def setAction (a : javax.swing.Action ): Unit
3232 def getAction (): javax.swing.Action
3333 }
3434
3535 // TODO: we need an action cache
3636 private var _action : Action = Action .NoAction
3737 def action : Action = _action
38- def action_= (a : Action ) { _action = a; peer.setAction(a.peer) }
38+ def action_= (a : Action ): Unit = { _action = a; peer.setAction(a.peer) }
3939
4040 // 1.6: def hideActionText: Boolean = peer.getHideActionText
4141 // def hideActionText_=(b: Boolean) = peer.setHideActionText(b)
@@ -47,7 +47,7 @@ object Action {
4747 */
4848 trait Trigger {
4949 def action : Action
50- def action_= (a : Action )
50+ def action_= (a : Action ): Unit
5151
5252 // 1.6: def hideActionText: Boolean
5353 // def hideActionText_=(b: Boolean)
@@ -56,8 +56,8 @@ object Action {
5656 /**
5757 * Convenience method to create an action with a given title and body to run.
5858 */
59- def apply (title : String )(body : => Unit ) = new Action (title) {
60- def apply () { body }
59+ def apply (title : String )(body : => Unit ): Action = new Action (title) {
60+ def apply (): Unit = body
6161 }
6262}
6363
@@ -75,49 +75,48 @@ abstract class Action(title0: String) {
7575 import Swing ._
7676
7777 lazy val peer : javax.swing.Action = new javax.swing.AbstractAction (title0) {
78- def actionPerformed (a : java.awt.event.ActionEvent ) = apply()
78+ def actionPerformed (a : java.awt.event.ActionEvent ): Unit = apply()
7979 }
8080
8181 /**
8282 * Title is not optional.
8383 */
8484 def title : String = ifNull(peer.getValue(javax.swing.Action .NAME )," " )
85- def title_= (t : String ) { peer.putValue(javax.swing.Action .NAME , t) }
85+ def title_= (t : String ): Unit = peer.putValue(javax.swing.Action .NAME , t)
8686
8787 /**
8888 * None if large icon and small icon are not equal.
8989 */
9090 def icon : Icon = smallIcon // if(largeIcon == smallIcon) largeIcon else None
91- def icon_= (i : Icon ) { /* largeIcon = i;*/ smallIcon = i }
91+ def icon_= (i : Icon ): Unit = /* largeIcon = i;*/ smallIcon = i
9292 // 1.6: def largeIcon: Icon = toNoIcon(peer.getValue(javax.swing.Action.LARGE_ICON_KEY).asInstanceOf[Icon])
9393 // def largeIcon_=(i: Icon) { peer.putValue(javax.swing.Action.LARGE_ICON_KEY, toNullIcon(i)) }
9494 def smallIcon : Icon = toNoIcon(peer.getValue(javax.swing.Action .SMALL_ICON ).asInstanceOf [Icon ])
95- def smallIcon_= (i : Icon ) { peer.putValue(javax.swing.Action .SMALL_ICON , toNullIcon(i)) }
95+ def smallIcon_= (i : Icon ): Unit = peer.putValue(javax.swing.Action .SMALL_ICON , toNullIcon(i))
9696
9797 /**
9898 * For all components.
9999 */
100100 def toolTip : String =
101101 ifNull(peer.getValue(javax.swing.Action .SHORT_DESCRIPTION ), " " )
102- def toolTip_= (t : String ) {
102+ def toolTip_= (t : String ): Unit =
103103 peer.putValue(javax.swing.Action .SHORT_DESCRIPTION , t)
104- }
104+
105105 /**
106106 * Can be used for status bars, for example.
107107 */
108108 def longDescription : String =
109109 ifNull(peer.getValue(javax.swing.Action .LONG_DESCRIPTION ), " " )
110- def longDescription_= (t : String ) {
110+ def longDescription_= (t : String ): Unit =
111111 peer.putValue(javax.swing.Action .LONG_DESCRIPTION , t)
112- }
113112
114113 /**
115114 * Default: java.awt.event.KeyEvent.VK_UNDEFINED, i.e., no mnemonic key.
116115 * For all buttons and thus menu items.
117116 */
118117 def mnemonic : Int = ifNull(peer.getValue(javax.swing.Action .MNEMONIC_KEY ),
119118 java.awt.event.KeyEvent .VK_UNDEFINED )
120- def mnemonic_= (m : Int ) { peer.putValue(javax.swing.Action .MNEMONIC_KEY , m) }
119+ def mnemonic_= (m : Int ): Unit = peer.putValue(javax.swing.Action .MNEMONIC_KEY , m)
121120
122121 /* /* *
123122 * Indicates which character of the title should be underlined to indicate the mnemonic key.
@@ -134,15 +133,14 @@ abstract class Action(title0: String) {
134133 */
135134 def accelerator : Option [KeyStroke ] =
136135 toOption(peer.getValue(javax.swing.Action .ACCELERATOR_KEY ))
137- def accelerator_= (k : Option [KeyStroke ]) {
136+ def accelerator_= (k : Option [KeyStroke ]): Unit =
138137 peer.putValue(javax.swing.Action .ACCELERATOR_KEY , k.orNull)
139- }
140138
141139 /**
142140 * For all components.
143141 */
144142 def enabled : Boolean = peer.isEnabled
145- def enabled_= (b : Boolean ) { peer.setEnabled(b) }
143+ def enabled_= (b : Boolean ): Unit = peer.setEnabled(b)
146144
147145 /* /* *
148146 * Only honored if not <code>None</code>. For various buttons.
@@ -153,5 +151,5 @@ abstract class Action(title0: String) {
153151 if (b == None) null else new java.lang.Boolean(b.get))
154152 }*/
155153
156- def apply ()
154+ def apply (): Unit
157155}
0 commit comments