Questions tagged [scala-swing]

The scala.swing package provides a collection of thin wrappers around Java Swing classes.

69 questions
2
votes
3 answers

Closing a Scala swing frame

I am having a problem closing my Scala swing frame. Here is the code for my exit button val buttonExit = new Button { text = "Exit" action = Action("Exit") { WorldActor.run(false) closer } } The closer function is defined as: def…
Matthew Kemnetz
  • 845
  • 1
  • 15
  • 28
2
votes
2 answers

Image files and relative paths in scala

I am trying to access some images for from image panel using a relative path. In the Eclipse project I have a folder named images with on image inside. Here is my code: val top = new MainFrame { title = "Predator and Prey Agent…
Matthew Kemnetz
  • 845
  • 1
  • 15
  • 28
2
votes
1 answer

Scala Swing Components

I have a collection of ComboBox declared as below. val cmbAll = for (i <- 0 to 4) yield new ComboBox(List("---", "Single", "Double")) And I try to listen to one of it via listenTo(cmbAll(0).selection) However, I can't actually perform the…
JohanSJA
  • 705
  • 2
  • 9
  • 21
2
votes
1 answer

Changing Scala Swing ComboBox Items

I tried to implement a date selection using three ComboBox as shown below. contents += new Label("Selected Date:") val dayBox = new ComboBox(1 to 31) contents += dayBox val monthBox = new ComboBox(List("Jan", "Feb", "Mar", "Apr", "May", "Jun",…
JohanSJA
  • 705
  • 2
  • 9
  • 21
2
votes
2 answers

How to add ComboBox as a cell editor in scala.swing.Table?

I'm trying to add ComboBox as a Column Cell Editor for each cell in a second column in Scala Swing application and struggle to do. Following code shows what I have tried so far, please help me to change the code to achieve the task. import…
e_z
  • 60
  • 6
2
votes
0 answers

ReactiveX in scala-swing doesn't work?

I'm newbie to reactivex, and try to use it with scala-swing. My code is quite simple, but it doesn't work: import rx.lang.scala.Observable import scala.swing.{Frame, MainFrame, SimpleSwingApplication, TextField} object HelloReactiveX extends…
Freewind
  • 193,756
  • 157
  • 432
  • 708
2
votes
1 answer

Problems with Scala Swing library

Hello I am having problems when using the Scala Swing library in version 2.8 Beta1-prerelease. I have a situation where I want to show a table in GUI, and update it as results are returned from a SQL request. Which way could this be done in Scala,…
Stefan
  • 725
  • 2
  • 9
  • 16
2
votes
2 answers

How to create an Option dialog in Scala

I've been trying to create an Option dialog that isn't limited to two or three choices (Option.YesNo or Option.YesNoCancel), but I've been unable to find a way to use anything but these built-in options. Specifically, the following refuses to accept…
David Matuszek
  • 1,263
  • 1
  • 16
  • 30
2
votes
1 answer

Can I create GUI without "extends"

I start to learn Scala and I confused. Can I create GUI without "extends SimpleSwingApplication" or "SimpleGUIApplication" or may be something yet? I try to do it so: import scala.swing._ object Main { def main(args:Array[String]): Unit = { val…
Bersano
  • 23
  • 4
2
votes
2 answers

Periodic repaint of scala.swing.SimpleSwingApplication

If I run this example code class ExampleGUIElement extends Panel { preferredSize = new Dimension(100, 100) val rand : Random = Random override def paintComponent(g: Graphics2D) = g.drawLine(rand.nextInt(10),rand.nextInt(10),rand.nextInt(90) +…
user2329125
2
votes
1 answer

Problems with KeyEvents

I'm wondering why the following code doesn't work: object Main extends SimpleSwingApplication { val dim = new Dimension(500, 110) def top = new MainFrame { contents = new FlowPanel{ listenTo(keys, mouse.clicks) reactions += { …
SHildebrandt
  • 306
  • 1
  • 8
2
votes
1 answer

Scala Swing ComboBox Editable

A simple question (but can't find any answer nonetheless :(). Java's Swing has an editable property for the ComboBox so user can type to find the value. I check Scala's ComboBox implementation, and there is an editable property. So the question is,…
bertzzie
  • 3,558
  • 5
  • 30
  • 41
2
votes
1 answer

How to make own Scala UI Events

I am currently developing my first bigger Scala Swing project, and I have written my own component as a part of the tile map editor, in which the user chooses the tiles. Just as a combo box emits some sort of event when another element is selected,…
Lanbo
  • 15,118
  • 16
  • 70
  • 147
2
votes
1 answer

Scala Swing: setting relative dividerlocation on SplitPane

It seems almost impossible to set the relative (Double) dividerlocation on a Scala Swing SplitPane at the time of creation of the splitpane to the desired value. The splitter nearly always appears at the top of its parent Component. I've tried using…
Rich Oliver
  • 6,001
  • 4
  • 34
  • 57
2
votes
1 answer

Scala Swing: Changing BorderPanel central component new Component not visible

I'm changing the centre area on a Scala Swing Border Panel. The old component disappears, but the new component does not appear, until I resize the window manually with the mouse. I've tried using different components and repainting, but nothing…
Rich Oliver
  • 6,001
  • 4
  • 34
  • 57