The scala.swing package provides a collection of thin wrappers around Java Swing classes.
Questions tagged [scala-swing]
69 questions
1
vote
1 answer
Navigating between panels in scala
I want to know how to navigate between panels in scala swinng. the current code I have is:
val top = new MainFrame {
title = "Predator and Prey Agent simulation"
val buttonExit = new Button {
text = "Exit"
//foo
}
val…

Matthew Kemnetz
- 845
- 1
- 15
- 28
1
vote
2 answers
Discard all messages except the last one in a Scala actor
I have a SwingWorker actor which computes a plot for display from a parameters object it gets send; then draws the plot on the EDT thread. Some GUI elements can tweak parameters for this plot. When they change I generate a new parameter object and…

ziggystar
- 28,410
- 9
- 72
- 124
1
vote
2 answers
How do I update a Scala/Swing programmatically from an external class?
For example the following code shows a simple table
import java.awt.Dimension
import swing._
object SunsetTable extends SimpleSwingApplication {
var model = Array(List("BHP", 1).toArray)
lazy val ui = new BoxPanel(Orientation.Vertical) {
…

deltanovember
- 42,611
- 64
- 162
- 244
1
vote
1 answer
Why scala-swing Button can be assigned to MainFrame's contents?
In scala-swing, I can write this simple code:
import scala.swing._
object HelloWorld2 extends SimpleSwingApplication {
val top = new MainFrame()
top.title = "Hello, World!"
top.contents = new Button("a")
}
it works fine but according to doc…

wang kai
- 1,673
- 3
- 12
- 21
1
vote
2 answers
Multi-lined Label in Scala
Short question, hopefully simple solution:
I've got my own renderer for a ListView, nothing too fancy, it just connects a Label and and Icon. My questions is, so far, the Label ignores my "\n"s. How can I change that? I'd like to have two lines for…

Lanbo
- 15,118
- 16
- 70
- 147
1
vote
0 answers
Scala Swing scrollbar for TextArea
I'm trying to add a scrollbar to a text area component. I could use FlowPanel, but I need to use GridBagPanel for my other components and when I tried to add a flowpanel inside the gridbagpanel it was empty and like 2x2 pixels.
Is there a way to…

Alqio
- 452
- 1
- 5
- 15
1
vote
1 answer
SimpleSwingApplication created a seemingly infinite amount of identical windows
So I have the following simple program in scala:
object CViewerMainWindow extends SimpleSwingApplication {
var i = 0
def top = new MainFrame {
title = "Hello, World!"
preferredSize = new Dimension(320, 240)
//…

Jones
- 1,154
- 1
- 10
- 35
1
vote
1 answer
Scala: Button in Table Cell does not "fire" Action
I've got a little Problem: I want to have Buttons in some of the cells of my Table. As rendering component I return a Button with the following code: (theres application specific and debugging code in this example but you'll get the picture)
class…

Agl
- 469
- 2
- 13
1
vote
1 answer
Is it possible to use absolute component positioning in Scala/Swing?
I am using Swing in Scala "org.scala-lang" % "scala-swing" % "2.11.0-M7".
I want to set position for my components explicitly. It is possible to do in Swing API for Java.
Question: is it possible to set absolute position for components in Swing…

kisileno
- 787
- 9
- 23
1
vote
1 answer
Scala Swing Wait
//Main.scala
/* imports */
object Main extends SimpleSwingApplication {
lazy val ui = new TabbedPane {
/* contents */
}
def top = new MainFrame {
/* contents */
}
override def startup(args: Array[String]) {
val t = top
…

JohanSJA
- 705
- 2
- 9
- 21
1
vote
2 answers
Cannot add scala swing dependency via Gradle in Scala IDE
I am a beginner learning Scala. I am on Windows 8.1, using Scala IDE 4.0.0 and Gradle with scala and eclipse plugins to create a project, in which I want to use scala.swing and javax.media packages. I add both libraries as dependencies in…

asinkxcoswt
- 2,252
- 5
- 29
- 57
1
vote
1 answer
scala, swing : thread issue with the Event Dispatch Thread(actors)
I have a scala class inheriting from SimpleSwingApplication.This class defines a window (with def top = new MainFrame) and instanciates an actor. the actor's code is simple:
class Deselectionneur extends Actor {
def act() {
while (true) {
…

lolveley
- 1,659
- 2
- 18
- 34
1
vote
1 answer
Swing components move as TextArea filled, in Scala
I'm having a basic issue with alignment in a BoxPanel. When either of the TextAreas takes input, the other components in the panel, that aren't the width of the panel, shift along with the characters.
What is my mistake? Thanks!
val exitButton =…

Peter Becich
- 989
- 3
- 14
- 30
1
vote
1 answer
Scala SimpleSwingApplication not repainting
I have a simple swing application in Scala. Work is done by a separate object but progress must be periodically reported to the GUI which launched it. The problem is that the updates are only visible once the Thread has completed its task. I've…

DuncanACoulter
- 2,095
- 2
- 25
- 38
1
vote
1 answer
How to set class name in TextArea in Play2 Framework Scala template?
This is what I have in my scala template where I am creating my textArea
@textarea(Form("content"),args = 'rows -> 10, 'cols -> 80)
I want my textArea to have my custom class name but I failed to figure out how to do that from documentation:…

sadaf2605
- 7,332
- 8
- 60
- 103