alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (SimpleGUIApplication.scala)

This example Scala source code file (SimpleGUIApplication.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

array, array, frame, gui, guiapplication, simpleguiapplication, simpleguiapplication, simpleswingapplication, string, string, swing, use, use

The Scala SimpleGUIApplication.scala source code

/*                     __                                               *\
**     ________ ___   / /  ___     Scala API                            **
**    / __/ __// _ | / /  / _ |    (c) 2007-2011, LAMP/EPFL             **
**  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **
** /____/\___/_/ |_/____/_/ | |                                         **
**                          |/                                          **
\*                                                                      */



package scala.swing

import javax.swing._

/**
 * Extend this class for most simple UI applications. Clients need to implement the 
 * <code>top method. Framework initialization is done by this class.
 * 
 * In order to conform to Swing's threading policy, never implement top or any additional 
 * member that created Swing components as a value unless component creation happens on 
 * the EDT (see Swing.onEDT and Swing.onEDTWait). Lazy values are okay for the same reason
 * if they are initialized on the EDT always.
 */
@deprecated("Use SimpleSwingApplication instead", "2.8.0") abstract class SimpleGUIApplication extends GUIApplication {
  
  /**
   * A GUI application's version of the main method. Called by the default 
   * main method implementation provided by this class.
   * Implement to return the top-level frame of this application. 
   */
  def top: Frame

  /**
   * Calls top, packs the frame, and displays it.
   */
  def main(args: Array[String]) = run {
    val t = top
    t.pack()
    t.visible = true
  }
  
  def resourceFromClassloader(path: String): java.net.URL =
    this.getClass.getResource(path)
  
  def resourceFromUserDirectory(path: String): java.io.File =
    new java.io.File(util.Properties.userDir, path)
}

Other Scala examples (source code examples)

Here is a short list of links related to this Scala SimpleGUIApplication.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.