Developing GUIs With the Eclipse Visual Editor, SWT Edition David Gallardo.

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming
Advertisements

Wir schaffen Wissen – heute für morgen A.C.Mezger, Paul Scherrer Institut, Switzerland caQtDM, an EPICS display manager with Qt Paul Scherrer Institut.
Java Graphical User Interface (GUI) using Visual Editor in eclipse CSI 1390 – Java Programming Instructor: Saeid Nourian University.
Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
 Copyright 2005 Digital Enterprise Research Institute. All rights reserved. The Web Services Modeling Toolkit Mick Kerrigan.
Goals Give you a feeling of what Eclipse is.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
NetBeans IDE Tal Maoz Na’ama Zahavi.
Automating Tasks With Macros
Java Integrated Development Environments: ECLIPSE Part1 Installation.
Android: Hello World Frank Xu Gannon University. Steps Configuration ▫Android SDK ▫Android Development Tools (ADT)  Eclipse plug-in ▫Android SDK and.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Automating Tasks With Macros. 2 Design a switchboard and dialog box for a graphical user interface Database developers interact directly with Access.
Eclipse Introduction Dwight Deugo Nesa Matic
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of Creating Eclipse plug-ins.
1 Standard Widget Toolkit. 2 SWT l a widget toolkit for Java developers l provides a portable API and tight integration with the underlying native OS.
Fundamentals of Programming in Visual Basic 3.1 Visual basic Objects Visual Basic programs display a Windows style screen (called a form) with boxes into.
NetBeans IDE Vishnuvardhan.M Dept. of Computer Science - SSBN.
Eclipse IDE. 2 IDE Overview An IDE is an Interactive Development Environment Different IDEs meet different needs BlueJ and DrJava are designed as teaching.
03 Using Eclipse. 2 IDE Overview An IDE is an Interactive Development Environment Different IDEs meet different needs BlueJ and DrJava are designed as.
Programming with App Inventor Computing Institute for K-12 Teachers Summer 2012 Workshop.
Access Tutorial 10 Automating Tasks with Macros
Introduction to Java Swing “We are the sultans of swing” – Mark Knopfler.
McGraw-Hill© 2007 The McGraw-Hill Companies, Inc. All rights reserved. 1-1.
What is Web Authoring? Web Authoring Tools Use Text Editors HTML Editors Web-based Authoring Tools Integrated Web Authoring Tools 8Basic Understanding.
Introduction to Eclipse and Eclipse RCP Kenneth Evans, Jr. Presented at the EPICS Collaboration Meeting June 13, 2006 Argonne National Laboratory, Argonne,
Deutsches Elektronen-Synchrotron DESY Helmholtz Association of German Research Centres Hamburg, Germany The European X-Ray Laser Project.
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
© 2012 Google, Inc. 1 Building GUIs with WindowBuilder EclipseCon 2012 March 28, 2012 Eric Clayberg Software Engineering Manager Google, Inc.
Capture and Replay Often used for regression test development –Tool used to capture interactions with the system under test. –Inputs must be captured;
Using the Netbeans GUI Builder. The Netbeans IDE provides a utility called the GUI Builder that assists you with creating Windows applications. The Netbeans.
Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse.
The Eclipse Ecosystem: Exploring Tools and Plug-ins David Gallardo.
INTRODUCTION TO ANDROID. Slide 2 Application Components An Android application is made of up one or more of the following components Activities We will.
ICALEPCS, “jddd” a Java DOOCS Data Display for the XFEL Editor for a Graphical User Interface of DOOCS & TINE and Runtime Engine Elke Sombrowski.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Introducing the Eclipse Visual Editor David Gallardo.
Pasewark & Pasewark 1 Access Lesson 5 Creating and Modifying Reports Microsoft Office 2007: Introductory.
Selected Topics in Software Engineering - Distributed Software Development.
Graphical User Interfaces Tonga Institute of Higher Education.
Graphics and Event-Driven Programming in Java John C. Ramirez Department of Computer Science University of Pittsburgh.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
1 Chapter Nine Using GUI Objects and the Visual Studio IDE.
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
Return to Outline Copyright © 2011 by Maribeth H. Price 3-1 Labeling and annotation.
Java GUI building approaches Aleksandar Kartelj Faculty of Mathematics, Belgrade 11 th Workshop “Software Engineering Education and.
First Venture into the Android World Chapter 1 Part 2.
The Abstract Window Toolkit (AWT) supports Graphical User Interface (GUI) programming. AWT features include: a rich set of user interface components; a.
Graphical Enablement In this presentation… –What is graphical enablement? –Introduction to newlook dialogs and tools used to graphical enable System i.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 10 1 Microsoft Office Access 2003 Tutorial 10 – Automating Tasks With Macros.
Pasewark & Pasewark 1 Access Lesson 5 Creating and Modifying Reports Microsoft Office 2007: Introductory.
® IBM Software Group © 2007 IBM Corporation Module 1: Getting Started with Rational Software Architect Essentials of Modeling with IBM Rational Software.
Introduction 1 Lars Vogel 4/22/2009.  Who am I?  Eclipse as a platform  What is Eclipse RCP?  Extension Points / Extensions  Equinox  SWT & JFace.
Intoduction to Andriod studio Environment With a hello world program.
Past Computing Environments: Swing Ian Smith UI Toolkits (History Lesson) 4 Programming tools for building interfaces 4 Originally in Java you had AWT.
Developing GUIs With the Eclipse Visual Editor, Swing/AWT Edition David Gallardo.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
CIS 270—Application Development II Chapter 11—GUI Components: Part I.
CSC 222: Object-Oriented Programming
Java FX: Scene Builder.
Goals Give you a feeling of what Eclipse is.
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
COSC-4840 Software Engineering
Creating a Windows Forms User Interface
Electronics II Physics 3620 / 6620
Chapter 4 Enhancing the Graphical User Interface
Presentation transcript:

Developing GUIs With the Eclipse Visual Editor, SWT Edition David Gallardo

My books Java Oracle Database Development Eclipse in Action, (lead author) Eclipse in Action, 2 nd edition due out in December Preview article, Introducing the Eclipse Visual Editor available at:

Presentation and source available at:

The Visual Editor is Eclipse’s long-awaited GUI Builder for Swing/AWT and SWT

What’s a GUI builder good for? Coding graphical user interfaces is tedious and requires verbose code Visualizing the effects of code and code changes isn’t intuitive for most people The flexible, powerful layouts that give professional results can be especially difficult to program A GUI builder lets you use graphical design tools in a WYSIWYG environment to design the GUI and generates code for you

The Eclipse Visual Editor It’s been a long time coming… –Difficult to develop –Hard to make one that generates good code and that doesn’t require proprietary artifacts like format files –Visual Age for Java had one of the few good ones –Little incentive for IBM to contribute this to Eclipse? The lack of a GUI build was one of the chief complaints about Eclipse, vis-à-vis competitors

Introducing the Eclipse Visual Editor IBM eventually relented and contributed their Visual Editor in Fall 2003 Initial version, 0.5, was Swing/AWT only Version 1.0, released Fall 2004, introduced limited support for SWT—the Standard Widget toolkit Version 1.1, released July 2005, adds more SWT support and support for RCP views

Why SWT? IBM created SWT as a replacement for Swing/AWT –AWT controls were native, but took lowest-common denominator approach to achieve cross-platform compatability –Swing emulated controls don’t always match platform –Swing controls performed poorly relative to native controls SWT took a hybrid approach –Thin layer over native controls –Emulated controls where native controls for a particular platform aren’t available SWT applications have the look & responsiveness of native applications SWT is relatively simple and easy to use

Installing VE VE is an independent component that plugs into Eclipse JDT Install using Eclipse Update feature. This will install VE and the following dependencies: –Graphical Editing Framework (GEF) –Eclipse Modeling Framework (EMF) Versions of Eclipse, VE, GEF and EMF must be compatible—Update will make sure that dependency requirements are met

Principal VE features Wizard for creating Visual Classes—classes that include an SWT Shell or Composite Visual editor with palette of controls and two views in usual editor location: –Design view –Source view Java Beans View Properties View Indicator and tool buttons for controlling synchronization between views No support for JFace

Visual class wizard SWT options: –Composite –Shell SWT controls are not intended to be subclassed: SWT favors re-use through composition rather than inheritance. The generated visual class, by default, only subclasses Object. VE generates the code for declaring and instantiating the selected type

SWT palette selections The VE palette organizes SWT controls in folders: SWT controls: Button, CheckBox, RadioButton, Label, Link, Text… SWT containers: Shell, Composite, Group, TabFolder, CoolBar…

Working with controls Drag and drop from palette to design view or Java Beans view Adjust size or position in design view (if layout manager permits) Modify properties in Properties View Add event handlers in design view or Java Beans view Modify source directly By default, changes in one view will be reflected automatically in the rest Synchronization can be turned off or on with toolbutton; indicator appears in status bar

Working with layouts There is no default layout manager for a SWT containers. (Or to put it another way, the default is the null layout manager.) Null layout lets you modify controls’ sizes and placement arbitrarily, but will not adjust automatically well when window is re-sized or UI is localized for different languages. To select a layout manager, make sure the container is selected in the design view or Java Beans view, then change the layout manager in Properties view

VE supported SWT layouts VE allows the following layouts: Null Layout FillLayout FormLayout GridLayout RowLayout …but offers no support for FormLayout

VE layout customizers Different sets of tools tailored for each type of layout –Layout tools –Components Most complete support for null layout –Display grid –Tools for aligning controls, matching size, spacing evenly Good support for GridLayout—a powerful and flexible layout manager Layout conversion is imperfect

Adding listeners To make a GUI work, you need to add listeners to wire controls together Listeners can be added by right-clicking on a control in design view or Java Beans view and selecting Events-> Handlers specific to a control can be selected directly Other events can be selected by selecting Add Events… Dialog box will show applicable listeners and adapters

Listeners and adapters SWT often offers a choice between a listener—which is an interface—and an adapter which is a class –An interface requires that you implement all the methods it defines –Most SWT interfaces have a corresponding adapter—a class that implements the interfaces methods with stubs –You subclass the adapter and only need to implement the methods you care about –The only disadvantage of adapters is that your event handler can’t subclass anything else VE will create all the code needed in either case, including method stubs for the listener interface, so using a listener is not much of an inconvenience

Running an SWT application Can run as a Java Bean in Eclipse environment To run as a Java app requires a native library (DLL on Windows). There are four options: –Use a -Djava.library.path VM argument in the launch configuration to tell the application where the library is. –Put the library in the root directory of your project. –Add the location of the library the path the OS uses to locate libraries. On Windows, this is PATH environment variable; on Mac OS X and Linux, this is LD_LIBRARY_PATH. –Move the library to a place that is already on the path, such as the %SystemRoot%\SYSTEM32 directory on Windows, or /usr/local/lib on Linux and Mac.

Demo Building a click-counter application: Layout with GridLayout (see next slide) Change control names with refactoring Add listeners Add listener code Run as Java Bean and as a Java app

Planning the GridLayout