`
happmaoo
  • 浏览: 4549378 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

IBM实验室对SWT, Swing 和 AWT 的特征比较

阅读更多
<iframe align="top" marginwidth="0" marginheight="0" src="http://www.zealware.com/csdnblog01.html" frameborder="0" width="728" scrolling="no" height="90"></iframe>
Table 1. SWT vs. AWT and Swing Feature comparison
Function/Role/Aspect AWT Swing SWT (style)
Display static text Label JLabel Label, CLabel
Display multi-line static text Multiple Labels Multiple JLabels or JLabel with HTML content Multiple Labels or Label with newlines
Display multi-line formatted static text Multiple Labels with different fonts JLabel with HTML content Multiple Labels with different fonts
Single-line text entry TextField JTextField Text(SWT.SINGLE)
Multi-line text entry TextArea JTextArea Text(SWT.MULTI)
Display an image N/A JLabel Label
Display text and image N/A JLabel CLabel
ToolTip pop-up help N/A setToolTip on component, subclass JToolTip setToolTip on control
Styled text entry N/A JEditorPane StyledText
Select from list of items List JList List
Simple push button with text Button JButton Button(SWT.PUSH)
Simple push button with text and/or image N/A JButton Button(SWT.PUSH)
Drawing area; possibly for custom controls Canvas JPanel Canvas
On/off check box CheckBox JCheckBox Button(SWT.CHECK)
Radio selection CheckBoxGroup ButtonGroup and menus Group and Menu
Select from a drop-down list Choice JComboBox Combo, CCombo
Enter text or select from a drop-down list N/A JComboBox Combo, CCombo
Scrollable area ScrollPane JScrollPane Create Scrollable subclass
Top level windows Dialog, Frame, Window JDialog, JFrame, JWindow Shell with different styles
Generic window Window JWindow Shell
Frame window Frame JFrame Shell(SWT.SHELL_TRIM)
Dialog window Dialog JDialog Shell(SWT.DIALOG_TRIM)
Menu Menu JMenu Menu
MenuItem MenuItem JMenuItem MenuItem
Menu shortcuts Generic keystrokes same as AWT host dependent mnemonics and accelerators
Pop-up menu PopupMenu JPopupMenu Menu(SWT.POPUP)
Menu bars MenuBar JMenuBar Menu(SWT.BAR)
Display an insertion caret N/A Caret Caret
Web browser N/A JTextPane (HTML 3.2) Browser (via embedded browser)
Embed control in web page Applet JApplet Host control (ex. OLE)
Generic container of other controls Panel JPanel Composite
Generic container of other controls with a border Panel (if drawn manually) JPanel with a Border Composite(SWT.BORDER)
Generic container of other controls with a border and title N/A JPanel with a TitledBorder Group
Radio button (one of set on) Checkbox JRadioButton Button(SWT.RADIO)
Control extent of radio buttons CheckboxGroup RadioButtonGroup Group
Arrow buttons N/A JButton with image Button(SWT.ARROW)
Supports int'l text orientations via ComponentOrientation same as AWT Many components support styles for this
Focus Traversal Policy and Manager objects same as AWT Next on control
Custom dialogs Dialog subclass JDialog subclass Dialog subclass
Access to system events EventQueue services same as AWT Display services (less robust than AWT)
System access dialogs FileDialog JColorChooser, JFileChooser ColorDialog, DirectoryDialog, FileDialog, FontDialog, PrintDialog
Display simple message dialog N/A (must subclass Dialog) JOptionPane static methods MessageBox with numerous styles
Display simple prompting dialog N/A (must subclass Dialog) JOptionPane static methods N/A (classes exist in JFace to do this)
Layout managers BorderLayout, CardLayout, FlowLayout, GridLayout, GridBagLayout AWT plus BoxLayout, CenterLayout, SpringLayout FillLayout, FormLayout, GridLayout, RowLayout, StackLayout
Basic drawing control Canvas JPanel Canvas
Basic drawing Graphics and Graphics2D objects - Basic shapes and text, arbitrary Shapes and Strokes, Bezier, fills, etc. same as AWT GC object - Basic shapes and text
Drawing transforms Affine, composites same as AWT N/A
Off screen drawing BufferedImage, drawImage same as AWT Image, drawImage
Double buffering Manual Automatic or manual Manual unless provided by host control
Printing PrintJob and PrintGraphics same as AWT draw to Printer device
Custom colors Color same as AWT Color
Custom fonts Font, FontMetrics same as AWT Font
Cursors selection Cursor same as AWT Cursor
Image features load from file, create dynamically, extensive edits same as AWT load from file, create dynamically, basic edits
Input automation Robot same as AWT N/A
Display a tool bar N/A JToolBar ToolBar, CoolBar
Display a progress bar N/A JProgressBar ProgressBar
Divide space between areas N/A JSplitPane Sash or SashForm
Display tabbed areas N/A JTabbedPane TabFolder, CTabFolder
Display tabular info N/A JTable Table
Format table columns N/A TableColumn TableColumn
Display hierarchical info N/A JTree Tree
Select from range of values N/A JSlider Slider
Select from discrete range of values N/A JSpinner Scale
Access to the base display Toolkit, GraphicsConfiguration, GraphicsDevice same as AWT Display
Add items to the system tray N/A N/A Tray
Key: N/A - Not available. In many cases, this feature can be created, with varying degrees of difficulty, by creating custom controls or containers of controls or by other custom programming.

作者最后得出的结论是如果你只开发用于某一特性平台(当然,只能是主流平台),SWT就有优势了,它可以集成这些平台的特有的功能。例如在Windows下使用ActiveX控件。



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=610935


分享到:
评论

相关推荐

    浅析Java中Swing与SWT和AWT的区别及实现_王亚南

    Java是一种广泛使用的编程语言,在图形用户界面(GUI)设计领域提供了多种开发包,其中比较著名的有Swing、SWT和AWT。这三种技术各有特点和适用场景,在开发Java图形界面应用时,开发者需要根据实际需求选择最合适的...

    Java图形界面开发-awt、swing、swt

    - **Matisse**:Matisse是一款用于MyEclipse的插件,支持AWT和Swing应用的可视化开发。 - **Jigloo**:Jigloo是另一个插件,主要用于SWT和Swing应用的开发,支持Eclipse环境下的图形界面构建。 #### 6. 实战案例 -...

    使用Eclipse进行SWT编程.pdf

    SWT解决了AWT和Swing框架中的问题,使用JNI访问本地窗口组件(native widgets),并且可以模拟不能获取的窗口组件。SWT应用程序的基础材料包括Display、Shell和Widgets。 1. 为什么要使用SWT? SWT是IBM开发的一套...

    SWT-全接触 IBM

    与AWT和Swing相比,SWT提供了更多接近原生平台外观和行为的控件,从而为开发者提供了更加丰富的用户体验。 SWT之所以受到欢迎,是因为它解决了早期Java GUI开发中的几个关键问题: - **外观与感觉**:AWT的默认...

    SWT.zip_IBM_it

    SWT的设计目标是提供一个高效的、与操作系统紧密集成的Java GUI库,与传统的Java AWT和Swing库相比,它能提供更接近本机平台的用户体验。SWT通过直接操作操作系统提供的API来创建窗口、按钮、文本框等控件,从而实现...

    swing to swt

    尽管尝试过SWT的程序员对其表现出了极大的热情,但该工具包也存在一定的局限性——SWT并不兼容所有Swing的功能。因此,对于希望从Swing迁移到SWT的开发者来说,了解两者之间的差异并掌握迁移过程中的关键步骤至关...

    Eclipse SWT JFace核心应用相关应用及源码.rar

    基于 Java 桌面程序开发的图形库主要有 3 种,它们分别是 AWT、Swing 和 SWT。用前 两种库编写的桌面程序不够美观而且执行效率低,响应速度慢,SWT 恰好克服了 AWT 和 Swing 的缺点,它丰富的组件可以使程序员开发出...

    SWT/JFace的核心应用与实战教程的PDF电子版.rar

    基于 Java 桌面程序开发的图形库主要有 3 种,它们分别是 AWT、Swing 和 SWT。用前 两种库编写的桌面程序不够美观而且执行效率低,响应速度慢,SWT 恰好克服了 AWT 和 Swing 的缺点,它丰富的组件可以使程序员开发出...

    swt实现的日历附带说明使用

    在Java编程领域, SWT(Swing ...这需要对SWT和Swing的交互机制有一定的了解,同时也涉及到事件处理、布局管理和用户交互设计等多个方面。通过学习和实践这个主题,开发者可以提升在混合环境中构建Java桌面应用的能力。

    使用Eclipse进行SWT编程

    IBM认为AWT和Swing都无法满足其对高效、与本地系统深度集成的GUI的需求,因此创造了SWT。SWT通过JNI(Java Native Interface)直接访问本地窗口组件,确保了与操作系统原生界面的高度一致性和性能。如果某个组件在...

    Eclipse之SWT编程

    面对AWT和Swing的局限,IBM开发了SWT,旨在结合两者的优点,摒弃其不足。SWT通过JNI(Java Native Interface)技术直接调用各平台的本地窗口组件,从而确保了应用程序在不同平台上的原生外观和性能。当遇到某些平台...

    Eclipse中使用SWT进行界面设计

    SWT的主要目标是解决AWT(Abstract Windowing Toolkit)和Swing框架存在的问题。AWT虽然使用了原生窗口部件,但在处理跨平台的特性时受限于“最低共同特性”(LCD问题),导致各平台特性的缺失。而Swing则采用仿真...

    swt-extension-win32

    SWT的设计目标是提供一种高效、功能丰富的用户界面工具包,与Java的Abstract Window Toolkit (AWT) 和 Swing 不同,SWT直接与操作系统API交互,因此在性能上通常优于基于AWT和Swing的GUI应用。SWT支持多种操作系统,...

    在Eclipse中用SWT设计界面

    SWT是由IBM开发的一款跨平台GUI工具包,旨在解决AWT和Swing框架存在的问题。AWT使用原生窗口部件,但受到LCD(Least Common Denominator)问题的限制,即只能提供各平台窗口部件的交集,导致功能受限。而Swing通过...

    SWT-Designer

    SWT是IBM推出的开源GUI库,它是Java AWT和Swing之外的一个选择,与操作系统底层更紧密集成,提供了更好的性能和原生外观。 SWT-Designer的主要功能包括: 1. **可视化设计**:SWT-Designer允许开发者通过拖放的...

    swt_designer程序设计教程

    SWT是IBM开发的一个开源库,它是Java AWT和Swing之外的另一种选择。SWT直接绑定到操作系统提供的原生窗口系统,因此它能提供与本地应用程序相似的性能和外观。SWT提供了丰富的控件集合,包括按钮、文本框、列表、树...

    教你使用Eclipse进行SWT编程(普通下载).doc

    总的来说,SWT是为了解决AWT和Swing的不足而诞生的,它通过直接调用本地窗口组件,实现了高效且具有平台特色的GUI编程。在Eclipse中开发SWT应用程序,需要熟悉其基本元素以及环境配置,这样才能充分利用SWT的优势,...

    Eclipse之程序开发之--SWT

    - **AWT**:AWT是最早的Java GUI框架之一,但现在已被Swing和SWT取代。与SWT相比,AWT在性能和功能方面都有所不足。 #### 八、结论 通过本篇文章的学习,我们不仅了解了SWT的基本概念及其与Eclipse的关系,还深入...

    SWTDesigner_v6.9.5_for_Eclipse3.5

    SWT是IBM推出的一种开源GUI(图形用户界面)工具包,它是Java AWT和Swing的替代品,特别是在Windows平台上提供了更接近原生的用户体验。JFace则是建立在SWT之上,提供了一种更高层次的抽象,简化了GUI编程。 SWT...

Global site tag (gtag.js) - Google Analytics