SWT, swing, or AWT: Which is better for you?

Source: Internet
Author: User
Tags abstract

This article compares the SWT of Eclipse with the Java Swing, Abstract Windows Toolkit (AWT) GUI Toolkit to help developers of new applications choose the appropriate tools from them. You can learn about the basic features of each toolkit and the pros and cons of using each toolkit through this article.

Brief introduction

Other authors on DeveloperWorks have shown how to migrate well between Swing and SWT (see Resources). The goal of this article is to help you determine which GUI toolkit you choose to use before you start developing your project.

But first we need to figure out a question: Why are there multiple Java™gui toolkits? The best answer is that a toolkit does not meet all of the requirements and has not recently developed a GUI toolkit that meets all the requirements. Each toolkit has its own pros and cons, which allows you to select the appropriate toolkit based on your needs and target users.

Let's learn more about these toolkits below.

AWT Overview

Abstract Windows Toolkit (AWT) is the most original Java GUI toolkit. The main advantage of AWT is that it becomes a standard configuration on every version of Java technology, including the Java implementation in early Web browsers, and it is also very stable. This means that we don't need to install this kit separately, and we can use it in any Java runtime environment, which is exactly what we want.

AWT is a very simple toolkit with limited GUI components, layout managers, and events (see Listing 1, Listing 2, and listing 3). This is because Sun decided to use a minimum common denominator (LCD) method for AWT. Therefore, it will only use GUI components that are defined for all Java host environments. The end result is very unfortunate, some commonly used components, such as tables, trees, progress bar, etc., are not supported. For applications that require more component types, we need to create these components from scratch. This is a big burden.

Listing 1. Basic AWT Class Tree (all in java.awt package, "*" means abstract)

Object
checkboxgroup
*component
Button
Canvas
CheckBox
Choice
containe    R
Panel
Applet
scrollpane
Window
Dialog
Frame
Label
List
textcomponent
TextArea
TextField
menucomponent
Menui TEM
checkboxmenuitem
Menu
PopupMenu

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.