The scala.swing package provides a collection of thin wrappers around Java Swing classes.
Questions tagged [scala-swing]
69 questions
0
votes
1 answer
Automatic update of Button text on change
I'm currently learning scala, and making an encryption program with a basic scala swing UI.
I added 2 swing buttons which text is held by 2 var.
The code looks like this :
var encText = "Encrypt"
var decText = "Decrypt"
def top = new…

Viria
- 47
- 5
0
votes
1 answer
Aligning buttons in a Scala MainFrame using setAlignmentX
I'm having trouble getting the buttons on a simple Scala MainFrame GUI to align at center.
Have tried many combos of buttonname.peer.setAlignmentX and Y with no effect.
The code is listed below:
object CGui extends SimpleSwingApplication
{
…

Rawle Ramkeesoon
- 101
- 5
0
votes
1 answer
swing issues in scala
i'm looking at some example code that is erroring out in scala 2.9.1:
import javax.swing.JFrame
import javax.swing.JMenuBar
import javax.swing.JButton
import javax.swing._
import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel
import…

tipu
- 9,464
- 15
- 65
- 98
0
votes
1 answer
How do you clear a password field in Scala Swing
I can't figure out how to clear a scala.swing.PasswordField. I have tried setting the text(String) method to an empty String...
passwordField.text = ""
but it didn't work. It works on a TextField, but not on a PasswordField. I also can not set a…
user1980875
0
votes
2 answers
While creating Object, setting values to methods or variable without using def or val keyword
I come from a Java background and as expected, am having problem understanding some patterns used in Scala (see below). Every time I feel that I have a good understanding of Scala patterns or programming methodology, something pops up that is beyond…

vikashait
- 499
- 4
- 10
0
votes
1 answer
How to compile scala swing app?
I'm using:
% scalac -version
Scala compiler version 2.9.1 -- Copyright 2002-2011, LAMP/EPFL
on Ubuntu 12.04.
This code is saved in HelloGui.scala:
import scala.swing._
object HelloGui extends SimpleSwingApplication {
def top = new MainFrame {
…

bstpierre
- 30,042
- 15
- 70
- 103
0
votes
1 answer
Scala Swing: how to get child component form Borderpanel
How do I get the child component for a particular position on a Scala Swing BorderPanel? I can place components OK. In this particular case I want to check the component at BorderPanel.Position.Centre. Also am I right that there can only be one…

Rich Oliver
- 6,001
- 4
- 34
- 57
0
votes
1 answer
Scala Swing: verifying Integer input forTextfield
I have a TextField that I wish to get an integer input from. In the previous c# Wpf version, I subscribe to the PreviewTextInput as follows:
private void PrevInp(object sender, TextCompositionEventArgs e)
{
int temp;
if (!(int.TryParse(e.Text,…

Rich Oliver
- 6,001
- 4
- 34
- 57
-3
votes
1 answer
how to access mongodb database in scala?
I would like to know how to access mongodb database from a scala swing application.
I am new to scala.I have created a database named mydb in mongodb and a collection named studen(rollno,name,age,city). I simply want to perform insert, update and…

survi
- 152
- 1
- 5