The scala.swing package provides a collection of thin wrappers around Java Swing classes.
Questions tagged [scala-swing]
69 questions
1
vote
1 answer
Scala: Equivalent of WPF Canvas and Polygon
I'm developing a Hex based Game. Having wrestled with the limitations of the C# type system, on discovering Scala I knew I had to rewrite the application in Scala. I need a basic GUI to be able to develop the main functionality. I've been using a…

Rich Oliver
- 6,001
- 4
- 34
- 57
0
votes
0 answers
Align button horizontally in top of frame and table bottom vertically
I get in trouble with the fact of after clicking on a button : I would like my table is set at bottom of my button but it's not that
I've managed to get it without after clicking a button but without, I've tested many things and nothing.
Here is the…

Kev74
- 103
- 7
0
votes
1 answer
How to reset a table
It's possible to reset a table scala swing or remove it from the container after clicking on a button ?
I've tried to create a val with that table but I have always a new table stacked under the old
Here is the code :
// here is the most crucial…

Kev74
- 103
- 7
0
votes
1 answer
How is the property assignment in scala swing implemented
In scala swing I can do something like the following:
val field = new TextField("", 4)
field.text = "Hello"
And the assignment is implemented thus:
def text_=(t: String): Unit = peer.setText(t)
But if I try my own implementation such as:
case…

user79074
- 4,937
- 5
- 29
- 57
0
votes
3 answers
JInternalFrame with scala.swing
scala swing looks interesting, but somehow it is incomplete, and sometimes I still need to use the old java classes, but I have no clue how I have to wrap them correctly.
So how do I wrap javax.swing.JInternalFrame correctly so that I can use it as…

Arne
- 7,921
- 9
- 48
- 66
0
votes
0 answers
Type mismatch in Scala using MVC format
I'm creating a game in Scala using ScalaSwing, where I've refactored the code into MVC format.
The problem arises when I try to "set" Player 1 strategy to the power strategy, when it throws
type mismatch;found _16.Player required _2.model.Player…

Michael
- 21
- 2
0
votes
1 answer
scala.swing NoClassDefFoundError
I have a very simple project that consists of a .scala file, a build.sbt file, and a /lib folder with a single .jar in it. My scalaVersion is set to 2.10.5 (for backwards compatibility) and I ran sbt compile, and sbt downloads .jars for scala-2.10…

Xianny
- 107
- 1
- 7
0
votes
2 answers
Trying to get a hang of creating larger multiple source file programs, need help [Scala]
So I'm fairly new to programming, right now I'm trying to get a better understanding of how to program across multiple files.
How better to do this, than to try.
I'm also using an IDE for pretty much the first time, so that might be what's tripping…

Jones
- 1,154
- 1
- 10
- 35
0
votes
1 answer
Can't change swing window location dynamically
I want to change scala-swing window location.
I found setting location works correctly when initialization but can't change location dynamically
import java.awt.Point
import scala.swing._
import scala.swing.event.ButtonClicked
object TestWindow…

Loran
- 223
- 2
- 15
0
votes
1 answer
Scala; Expression of type (X)=>X doesn't conform to type SupX
I'm a scala newbie who play with scala-swing. And want to translate a given scala.swing.Point on a scala.swing.event.MousEvent :
I would like to send mouse event to a class responsible to handle shapes selections. But because a shape has a location…

gervais.b
- 2,294
- 2
- 22
- 46
0
votes
2 answers
Scala.swing freezes when updating
So I'm actually not sure of what the problem really is. It propably relates to the way I'm handling my threads but I don't know how to fix this.
The program is a simple boid simulation with different "tribed" boids, and I want to have it so that…

RusinaRange
- 341
- 1
- 4
- 18
0
votes
1 answer
Fill the MainFrame with the BorderPanel
I basically want to fill my MainFrame with a SplitPanel that would take all space available in the MainFrame. I read that a way to do that is to add a BorderPanel to the MainFrame, and add the SplitPane to the center of the BorderPanel.
object…

Atol
- 569
- 4
- 12
0
votes
0 answers
Scala ListViewSelectionChange event outputs unexpected range
I'm currently trying to use a scala.swing.ListView in a Scala application.
I basically want to get the selected item of a ListView, as soon as the selection changes.
Here a sample which can be pasted into the Scala prompt.
import…

Emiswelt
- 3,909
- 1
- 38
- 56
0
votes
2 answers
Scala: if statement returning Any instead of Unit in a closure
I have the following code in a method:
aSides.foreach(as => as.side.terr match
{
case r: TerrSRiver => paintSeq :+= ((g: Graphics2D) =>
{
g.setPaintColour(ColourInt.blue)
g.fill(Polygon(as.paintStd(0.2)))
}
case _: TerrSCoast =>…

Rich Oliver
- 6,001
- 4
- 34
- 57
0
votes
1 answer
Scala swing repaint
So I am very, very new to scala. I am implementing Conways's Game of Life with a GUI. I can not figure out how to get my panel to update when the 2D array changes. Could someone please point me in the right direction? My entire code follows:
import…