SwingPlus
statement
SwingPlus tries to fill in the holes left behind by Scala-Swing. From missing .width and .height methods to
missing components such as Spinner to additional components such GroupPanel.
SwingPlus is (C)opyright 2013–2020 Hanns Holger Rutz and released under
the GNU Lesser General Public License v2.1+ and comes
with absolutely no warranties. To contact the author, send an email to contact at sciss.de.
It contains some classes (e.g. ComboBox) derived from the original Scala-Swing package, (C)opyright 2007-2013,
LAMP/EPFL, which was released under a BSD style license.
requirements / installation
This project builds with sbt against Scala 2.13, 2.12, Dotty.
To use the library in your project:
"de.sciss" %% "swingplus" % v
The current version v is "0.5.0"
contributing
Please see the file CONTRIBUTING.md
documentation
All classes and methods reside in package de.sciss.swingplus.
additional standard components
GroupPanelis a panel with a group-layout. I departed from Andreas Flierl's approach and simplified or changed the API, reducing the amount of complex conversions. I think I have arrived at a reasonable simple to use component.OverlayPanelis a panel with an overlay-layout.ToolBarwraps the corresponding javax component.Separatorwraps the corresponding javax component.Spinnerwraps the corresponding javax component. Currently it still relies on javax'sSpinnerModel. A future version might seem a more Scala'ish wrapper for the model, too.PopupMenuwraps the corresponding javax component. Note that Scala 2.11 does have a popup menu now, but you can use this one for compatibility between Scala 2.10 and 2.11.ComboBoxdoes away with the Scala-Swing version that has problems compiling under JDK 7 due to the retrofitting of generics in Swing. It achieves this by hiding the peer type, at the same time adding a few missing methods and therefore making it usually unnecessary to gain access to theJComboBoxpeer type. I have also added a properModelwrapper.ListViewhas the same problem asComboBoxin standard Scala-Swing. The version provided here is also usable in project that want to allows compilation both in JDK 6 and 7. It also has a properModelwrapper. Note that it fires events inswingplus.eventinstead ofscala.swing.event.ScrollBarfixes the Scala-Swing version by dispatchingValueChangedevents.DropModeis a type-safe enumeration wrapping the javax constants. It is currently used for theListView.
additional utility components
DoClickActionis an action that causes a visual button pressLabeledis a useful class for presenting fully typed objects in a combo-box, providing an alternative string representationPaddedIconadds an extra margin to an existingIconSpinningProgressBaris a small indefinite progress bar that can be hidden. Some look-and-feels (e.g. Aqua) support rendering a spinning icon instead of a bar.SpinnerComboBoxis a combo-box with aSpinnerfor editing numbers.
extension methods
They are imported through swingplus.Implicits._.
UIElement. Methodswidthandheightare provided, so one does not have to create aDimensionviasizefirst.Component. Methodbaselineis provided. This is currently using theInttype of javax. A future version might use a type-safe enumeration instead. MethodclientPropscreates a lightweight wrapper for the component's client properties, providing a subset of methods familiar from Scala'scollection.mutable.Map.Frame. MethoddefaultCloseOperationis provided with the type-safe enumeration typeCloseOperation.Action.wrapallows one to wrap a javaxActionas a Scala-SwingAction.
related
Please also check out the ScalaSwingContrib project which has similar goals.
Also check out the TreeTable project which provides a very powerful component, combining tree and table. Ideally this will also go into the mix, but API needs to be properly developed and should negotiate common interface with Ken Scambler's tree implementation.
Finally, there is Desktop, which aims rather at an application framework based on Swing.