Skip to content

Commit 6fdfcc6

Browse files
committed
converted DragMode to an Enumeration
1 parent 827e393 commit 6fdfcc6

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/main/scala/scala/swing/DesktopPane.scala

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,33 @@ class DesktopPane extends Component with SequentialContainer.Wrapper {
3939
/**
4040
* Specifies how dragged frames will be animated.
4141
*
42-
* @param newMode either `LiveDragMode` or `OutlineDragMode`.
42+
* @param newMode either `DragMode.Live` or `DragMode.Outline`.
4343
*/
44-
def dragMode_= (newMode : DragMode) : Unit = peer.setDragMode(newMode.intValue)
44+
def dragMode_= (newMode : DragMode) : Unit = peer.setDragMode(newMode.id)
4545
}
4646

4747

4848
object DesktopPane {
4949

5050
/**
51-
* Indicates how an internal frame will be animated as it is dragged.
51+
* Supported types of drag modes for internal frames.
5252
*/
53-
final case class DragMode(intValue : Int)
53+
//noinspection TypeAnnotation
54+
object DragMode extends Enumeration {
55+
/**
56+
* Renders the contents of the frame while dragging.
57+
*/
58+
val Live = Value(JDesktopPane.LIVE_DRAG_MODE)
5459

55-
/**
56-
* Indicates that a dragged internal frame will be animated with its contents.
57-
*/
58-
val LiveDragMode: DragMode = DragMode(JDesktopPane.LIVE_DRAG_MODE)
60+
/**
61+
* Renders only the outline of the frame while dragging.
62+
*/
63+
val Outline = Value(JDesktopPane.OUTLINE_DRAG_MODE)
64+
}
5965

6066
/**
61-
* Indicates that a dragged internal frame will only render as an outline.
67+
* Type indicating a type of mode for dragging internal frames.
6268
*/
63-
val OutlineDragMode: DragMode = DragMode(JDesktopPane.OUTLINE_DRAG_MODE)
69+
type DragMode = DragMode.Value
70+
6471
}

0 commit comments

Comments
 (0)