The scala.swing package provides a collection of thin wrappers around Java Swing classes.
Questions tagged [scala-swing]
69 questions
                    
                    23
                    
            votes
                
                5 answers
            
        Are there a good examples of using 'scala.swing'?
I don't know Java or Swing, but I'm quite familiar with Scala, and I have no problems using it for my purposes. But when I try to implement a GUI, I get a lot of problems/bugs that documentation can't easily solve. I guess scala.swing examples could…
         
    
    
        Łukasz Lew
        
- 48,526
- 41
- 139
- 208
                    10
                    
            votes
                
                2 answers
            
        How to set only the preferred width of Panel with flow layout?
I have a panel with flow layout, and it can contain a variable number of items - from 1 to 2000. I want to put it inside a scroll pane, scrollable in vertical direction, and with fixed width. The problem is, when I set preferred size of panel to…
         
    
    
        Rogach
        
- 26,050
- 21
- 93
- 172
                    8
                    
            votes
                
                5 answers
            
        How do I extend scala.swing?
In response to a previous question on how to achieve a certain effect with Swing, I was directed to JDesktopPane and JInternalFrame. Unfortunately, scala.swing doesn't seem to have any wrapper for either class, so I'm left with extending it.
What do…
         
    
    
        Daniel C. Sobral
        
- 295,120
- 86
- 501
- 681
                    7
                    
            votes
                
                2 answers
            
        Why is this reference ambiguous?
import swing._
object PeerTest extends SimpleSwingApplication {
  def top = new MainFrame {
    val p = peer.getMousePosition 
  }
}
gives
error: ambiguous reference to overloaded definition,
both method getMousePosition in class Container of type…
         
    
    
        Luigi Plinge
        
- 50,650
- 20
- 113
- 180
                    6
                    
            votes
                
                1 answer
            
        Scala Swing event framework - where do I add my reactors?
I'm trying to catch a mouse-click even on a Table (which should cause a popup to be shown). The table is inside a ScrollPane which is (in turn) inside a Panel. I have added reactions to all the classes, but I can never seem to actually get a click…
         
    
    
        oxbow_lakes
        
- 133,303
- 56
- 317
- 449
                    5
                    
            votes
                
                1 answer
            
        Scala Swing: missing JComponent methods on Component
I want to use the setComponentPopupMenu(). But Scala.Swing.Component doesn't seem to have all the JComponent methods although javax.swing.JComponent is referenced in the documentation. So I'm a bit confused.
         
    
    
        Rich Oliver
        
- 6,001
- 4
- 34
- 57
                    4
                    
            votes
                
                2 answers
            
        Scala swing panel disappears when trying to change contents (only when running a Thread)
So I'm writing a boid simulation program as a project for school. My program supports multiple different groups of these boids that don't flock with other groups, they all have different settings which I do by adding a BoxPanel to the main GUI of…
         
    
    
        RusinaRange
        
- 341
- 1
- 4
- 18
                    4
                    
            votes
                
                4 answers
            
        How do I use Swing with Scala 2.11 in Eclipse?
I just upgraded Scala to 2.11, and now I can't import scala.swing. How do I recover from this? Can I just download a jar file, or something simple like that? I hope I don't have to build anything.
Edit: the solution should be usable in Eclipse…
         
    
    
        David Matuszek
        
- 1,263
- 1
- 16
- 30
                    3
                    
            votes
                
                2 answers
            
        Table headers disappear without ScrollPane
I wrote the following simple code to test scala.swing.Table:
// java version "1.7.0_01"
// Scala code runner version 2.9.1.final
// Windows 7 Ultimate 64-bit
import scala.swing._
object TableHeaderVisible extends SimpleSwingApplication {
   …
         
    
    
        J Camphor
        
- 303
- 1
- 7
                    3
                    
            votes
                
                0 answers
            
        How can I create collapsible text using Scala Swing
I simply need to have collapsible text in my Scala application. I am already using the Swing wrapper. Each block of text is stored in it's own object. I just need help finding out how to add the collapsible icons and features via Swing. 
Thanks in…
         
    
    
        user947871
        
- 339
- 6
- 17
                    3
                    
            votes
                
                1 answer
            
        Scala Swing Newbie
Im trying to create an login window for an app im doing. I have searched all day for an example but I cant seem to find anything that helps. My basic structure is as follows:
// App.scala
object App extends SimpleSwingApplication {
  val ui = new…
         
    
    
        Ray Goodwin
        
- 183
- 1
- 3
- 9
                    3
                    
            votes
                
                2 answers
            
        In scala.swing, how do I remove a component from a Container?
In scala.swing, I can add a component to a container like so:
new Frame {
  contents += label
}
but sometimes I'd like to clear the contents of a container and replace them with new components. Based on the docs, I should be able to…
         
    
    
        Bill
        
- 44,502
- 24
- 122
- 213
                    3
                    
            votes
                
                1 answer
            
        How To Detect Keyboard Shortcuts like CTRL+S in Scala
I would like to detect keyboard shortcuts like CTRL+S in Scala. It is easy if only one key is pressed, but it seems to be difficult if two or more keys are pressed. Is there any better solution than the following?
reactions += {
  case c @…
         
    
    
        Simon
        
- 4,103
- 7
- 28
- 53
                    3
                    
            votes
                
                3 answers
            
        Return a value from a Scala + Swing app
I have a very simple scala swing app and I want to return a value to the command line app from  where the Swing app was triggered.
If I select value "b", I want the GUI to return value "b" to me as soon as the button is pressed.
How do I make the…
         
    
    
        nemoo
        
- 3,269
- 4
- 38
- 51
                    3
                    
            votes
                
                1 answer
            
        Scala Swing Component Alignment
I'm learning how to build GUI using the standard Swing widget on Scala. Here's what I want to do:
I've had success in creating the components, but failed on aligning it. All of my components are aligned centered, not like what I want (Button1 on…
         
    
    
        bertzzie
        
- 3,558
- 5
- 30
- 41