Java Desktop Application Design: SWT Introduction

Source: Internet
Author: User
Java Desktop Application Design: SWT introduction-Linux general technology-Linux programming and kernel information, the following is a detailed description. The reputation of Java is obviously very different from what it has achieved in desktop applications (GUI programs). So far, it is rare to see very successful Java Desktop programs. Although there are large software such as JBuilder, Netbean, and JProbe, this still cannot prove that the Java GUI program is successful: their appearance is always incompatible with other software on the same operating system platform. There seems to be endless demands for machine configuration, which can only be tolerated by programmers who always have the highest-performance PC, or those who don't care about money and time. For most computer users, AWT or SWING represents a weird interface and an unacceptable speed. Standard Widget Toolkit (SWT) may be the terminator of Java's nightmare. Java programmers can finally develop highly efficient GUI programs with a Standard appearance, almost no one can see that your program is written in Java. More importantly, these programs are cross-platform.
  
SWT itself is only a set of underlying GUI APIs compiled by Eclipse to develop the Eclipse IDE environment. It may be unintentional or intentional. So far, SWT has surpassed AWT and SWING provided by SUN in terms of performance and appearance. Currently, Eclipse IDE has been developed to version 2.1, and SWT is very stable. The stability here should contain two meanings:
  
First, it refers to the stability of performance. The key is the design concept of SWT. SWT maximizes the image component API of the operating system. That is to say, as long as the operating system provides the corresponding image components, SWT simply uses the JNI technology to call them, only those components that are not provided in the operating system can SWT perform a simulation on its own. It can be seen that the stability of SWT performance mostly depends on the stability of the graphic components of the corresponding operating system.
  
The other stability means that the name and structure of classes and methods in the swt api package have rarely changed, programmers don't have to worry about the rapid development progress of Eclipse Organization (Eclipse IDE has a daily release of the Nightly version), which leads to excessive changes in their program code. Update the SWT from one version to another. Generally, you only need to replace the SWT package.
  
   The first SWT Program
Let's start a SWT program. (Note: The following examples and descriptions are mainly applicable to the Windows platform. Other operating systems should be similar ). First, find the SWT package in the Eclipse installation file. The Eclipse organization does not provide a separate SWT package to download. You must download the complete Eclipse development environment to obtain the SWT package. SWT exists as a plug-in the Eclipse development environment. You can search for SWT in many subdirectories under $ {Your eclipse installation path} \ plugins path. JAR file. The JAR file found contains all the Java class files of SWT. Because SWT applies the JNI technology, it also needs to find the corresponding JNI localization library file. Due to the different versions and operating platforms, the name of the localization library file may be different, for example, the SWT-WIN32-2116.DLL is the dynamic library of Eclipse Build 2116 under the Window platform, and the extension of the Library file in the corresponding version of the Unix platform should be. so, and so on. Note that Eclipse is an open-source project, so you can find the source code of SWT in these directories. I believe this will be very helpful for development. Below is a piece of code to open an empty window (only the main method ).
  
  
QUOTE:

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.