All Projects → scala → Scala Swing

scala / Scala Swing

Licence: apache-2.0
Scala wrappers for Java's Swing API for desktop GUIs

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to Scala Swing

Compose Jb
Jetpack Compose for Desktop and Web, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
Stars: ✭ 7,562 (+7101.9%)
Mutual labels:  gui, desktop, swing
Wxwidgets
wxWidgets is a free and open source cross-platform C++ framework for writing advanced GUI applications using native controls.
Stars: ✭ 3,994 (+3703.81%)
Mutual labels:  gui, desktop
Redis Ui
📡 P3X Redis UI is a very functional handy database GUI and works in your pocket on the responsive web or as a desktop app
Stars: ✭ 334 (+218.1%)
Mutual labels:  gui, desktop
Kotlin Libui
Kotlin/Native interop to libui: a portable GUI library
Stars: ✭ 512 (+387.62%)
Mutual labels:  gui, desktop
15 Minute Apps
15 minute (small) desktop apps built with PyQt
Stars: ✭ 3,086 (+2839.05%)
Mutual labels:  gui, desktop
Deepkit Ml
The collaborative real-time open-source machine learning devtool and training suite: Experiment execution, tracking, and debugging. With server and project management tools.
Stars: ✭ 286 (+172.38%)
Mutual labels:  gui, desktop
Azul
Azul is a library for creating graphical user interfaces in Rust and C. It mixes paradigms from functional, reactive and data-oriented programming with an API suitable for developing cross-platform desktop applications. The two core principles of Azul is to not render objects that aren't visible and to use composition of DOM trees over inheritance.
Stars: ✭ 4,937 (+4601.9%)
Mutual labels:  gui, desktop
Java Javafx Swing Projects Desktop Application Gui Software
All projects are based on ☕ Java(Swing.All projects are database(MySql) connected📂 and compatible to run is🖥️ Desktop(with .exe)🖱️.All projects have a Graphical User Interface(GUI)👨🏻‍💻 that user can communicate and understand the application easily).
Stars: ✭ 245 (+133.33%)
Mutual labels:  gui, swing
React Nodegui
Build performant, native and cross-platform desktop applications with native React + powerful CSS like styling.🚀
Stars: ✭ 5,914 (+5532.38%)
Mutual labels:  gui, desktop
Nodegui
A library for building cross-platform native desktop applications with Node.js and CSS 🚀. React NodeGui : https://react.nodegui.org and Vue NodeGui: https://vue.nodegui.org
Stars: ✭ 7,324 (+6875.24%)
Mutual labels:  gui, desktop
Swingtutorials
Tutorials for Java's Swing UI toolkit explaining how to use particular components
Stars: ✭ 67 (-36.19%)
Mutual labels:  gui, swing
Darklaf
Darklaf - A themeable swing Look and Feel based on Darcula-Laf
Stars: ✭ 249 (+137.14%)
Mutual labels:  gui, swing
X11docker
Run GUI applications and desktops in docker and podman containers. Focus on security.
Stars: ✭ 3,797 (+3516.19%)
Mutual labels:  gui, desktop
Fynedesk
A full desktop environment for Linux/Unix using Fyne
Stars: ✭ 286 (+172.38%)
Mutual labels:  gui, desktop
Lagrange
A Beautiful Gemini Client
Stars: ✭ 238 (+126.67%)
Mutual labels:  gui, desktop
Qode
Qode is a lightly modified fork of Node.js that merges Node's event loop with Qt's event loop. It is designed to be used together with @nodegui/nodegui.
Stars: ✭ 84 (-20%)
Mutual labels:  gui, desktop
Wepush
专注批量推送的小而美的工具,目前支持:模板消息-公众号、模板消息-小程序、微信客服消息、微信企业号/企业微信消息、阿里云短信、阿里大于模板短信 、腾讯云短信、云片网短信、E-Mail、HTTP请求、钉钉、华为云短信、百度云短信、又拍云短信、七牛云短信
Stars: ✭ 2,597 (+2373.33%)
Mutual labels:  gui, swing
Tesseract4java
Java GUI and Tools for Tesseract OCR
Stars: ✭ 214 (+103.81%)
Mutual labels:  gui, swing
Vue Nodegui
Build performant, native and cross-platform desktop applications with native Vue + powerful CSS like styling.🚀
Stars: ✭ 575 (+447.62%)
Mutual labels:  gui, desktop
Ariang Native
A better aria2 desktop frontend than AriaNg, containing all features of AriaNg and more features for desktop.
Stars: ✭ 1,176 (+1020%)
Mutual labels:  gui, desktop

scala-swing (mostly-unsupported)

This is now community maintained by @Sciss and @benhutchison. If you are interested in helping then contact them or @adriaanm.

Adding an sbt dependency

To use scala-swing from sbt, add this to your build.sbt:

libraryDependencies += "org.scala-lang.modules" %% "scala-swing" % "3.0.0"

About scala-swing

This is a UI library that wraps most of Java Swing for Scala in a straightforward manner. The widget class hierarchy loosely resembles that of Java Swing. The main differences are:

  • In Java Swing all components are containers per default. This does not make much sense for a number of components, like TextField, CheckBox, RadioButton, and so on. Our guess is that this architecture was chosen because Java lacks multiple inheritance. In scala-swing, components that can have child components extend the Container trait.
  • Layout managers and panels are coupled. There is no way to exchange the layout manager of a panel. As a result, the layout constraints for widgets can be typed. (Note that you gain more type-safety and do not loose much flexibility here. Besides being not a common operation, exchanging the layout manager of a panel in Java Swing almost always leads to exchanging the layout constraints for every of the panel's child component. In the end, it is not more work to move all children to a newly created panel.)
  • Widget hierarchies are built by adding children to their parent container's contents collection. The typical usage style is to create anonymous subclasses of the widgets to customize their properties, and nest children and event reactions.
  • The scala-swing event system follows a different approach than the underlying Java system. Instead of adding event listeners with a particular interface (such as java.awt.ActionListener), a Reactor instance announces the interest in receiving events by calling listenTo for a Publisher. Publishers are also reactors and listen to themselves per default as a convenience. A reactor contains an object reactions which serves as a convenient place to register observers by adding partial functions that pattern match for any event that the observer is interested in. This is shown in the examples section below.
  • For more details see SIP-8

The library comprises two main packages:

  • scala.swing: All widget classes and traits.
  • scala.swing.event: The event hierarchy.

Examples

A number of examples can be found in the examples project. A good place to start is [16] scala.swing.examples.UIDemo. This pulls in the all the other examples into a tabbed window.

$ sbt examples/run

Multiple main classes detected, select one to run:

 [1] scala.swing.examples.ButtonApp
 [2] scala.swing.examples.CelsiusConverter
 [3] scala.swing.examples.CelsiusConverter2
 [4] scala.swing.examples.ColorChooserDemo
 [5] scala.swing.examples.ComboBoxes
 [6] scala.swing.examples.CountButton
 [7] scala.swing.examples.Dialogs
 [8] scala.swing.examples.GridBagDemo
 [9] scala.swing.examples.HelloWorld
 [10] scala.swing.examples.LabelTest
 [11] scala.swing.examples.LinePainting
 [12] scala.swing.examples.ListViewDemo
 [13] scala.swing.examples.PopupDemo
 [14] scala.swing.examples.SwingApp
 [15] scala.swing.examples.TableSelection
 [16] scala.swing.examples.UIDemo

Enter number:

Frame with a Button

The following example shows how to plug components and containers together and react to a mouse click on a button:

import scala.swing._

new Frame {
  title = "Hello world"
  
  contents = new FlowPanel {
    contents += new Label("Launch rainbows:")
    contents += new Button("Click me") {
      reactions += {
        case event.ButtonClicked(_) =>
          println("All the colours!")
      }
    }
  }
  
  pack()
  centerOnScreen()
  open()
}

Versions

  • The 1.0.x branch is compiled with JDK 6 and released for Scala 2.11 and 2.11. The 1.0.x releases can be used with both Scala versions on JDK 6 or newer.
  • The 2.0.x branch is compiled with JDK 8 and released for Scala 2.11 and 2.12.
    • When using Scala 2.11, you can use the Scala swing 2.0.x releases on JDK 6 or newer.
    • Scala 2.12 requires you to use JDK 8 (that has nothing to do with scala-swing).
  • The 2.1.x series adds support for Scala 2.13, while dropping Scala 2.10.
  • The 3.0.x series adds support for Scala 3.0.

The reason to have different major versions is to allow for binary incompatible changes. Also, some java-swing classes were generified in JDK 7 (see SI-3634) and require the scala-swing sources to be adjusted.

API documentation (Scaladoc)

The API documentation for scala-swing can be found at http://www.scala-lang.org/documentation/api.html.

Current Work

Current changes are being made on the work branch. Last published version is found on the main branch.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].