70th: Scala interface GUI programming practical explanation

Source: Internet
Author: User

Today I studied Liaoliang's Scala learning lecture 70th, about Scala's interface programming, so let's take a preliminary look at the process of programming in Scala.

Information from DT Big Data Dream Factory public account: Dt_spark

Follow the account to learn more about the Liaoliang Teacher's course content

Teacher Wang qq:1740415547
No.: 18610086859

First of all, the interface programming in Scala is to encapsulate and improve the Java interface programming of the Swing library, of course, when we are using Scala interface programming, we should first introduce such a library, let us start from the code in combat.

Import Scala.swing._

Object Hello_gui extends simpleswingapplication{
def top = new mainframe{
title = "Hello GUI"
Contents = new button{
Text = "Scala = Spark!!!"
}
}
}

Simpleswingapplication defines some preliminary settings for the interface, which contains the main method, so in the above program, there is no main method, our program can also run.

The top method here is actually the simpleswingapplication of the top method, which is the type of frame.

Mainframe is a main framework of the method class, is an easy, containing elements such as title,contents, so we override the top method, set the corresponding components of the various properties:

title = "Hello GUI"
Contents = new button{
Text = "Scala = Spark!!!"
}

70th: Scala interface GUI programming practical explanation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.