SWT JFace

  Home  Java Programing  SWT JFace


“SWT JFace job interview questions and answers guide. The one who provides the best SWT JFace answers with a perfect presentation is the one who wins the interview race. Learn SWT JFace and get preparation for the job of SWT JFace”



14 SWT JFace Questions And Answers

1⟩ What is Action Mechanism?

Actions are tasks for various users operations such as clicks on menus, toolbars, status lines etc. In order to support these actions the action mechanism is implemented. There are listeners and managers for each of these actions.

 134 views

2⟩ What is Wizard?

A wizard can be used to create new java classes, projects, files and folders. Wizards provide step by step process to create these elements. A well defined wizard is targeted to simplify user tasks and increase productivity. Wizard is meant to take out the hassle of creating repetitive and tedious tasks.

 151 views

3⟩ What is Dialog?

Dialogs are used to communicate the information from the user or to the user. The following are the different types of messages:

The MessageDialog displays information to the user

The InputDialog accepts the input from the user in the form of text

The ErrorDialog displays one or more errors to the user.

 164 views

4⟩ What is FontRegistry?

The FontRegistry maps between symbolic font names and SWT fonts. It owns all the fonts registered with it and automatically disposes them when the SWT Display that creates the fonts is disposed.

 162 views

5⟩ What is ImageRegistry?

The mapping between symbolic image names and SWT image objects is maintained by the ImageRegistry class until the SWT image objects are needed. It owns all the images registered with it and automatically disposes them when the SWT Display that creates the images is disposed.

 144 views

6⟩ Explain SWT and JFace?

Standard Widget Toolkit (SWT):

SWT is an open source widget tool kit for developing rich, efficient and portable GUI applications. It was originally developed by IBM and being maintained by Eclipse Foundation along with Eclipse IDE. It is an alternative to AWT and Swing. To display the elements, it implements the operating system GUI libraries by using Java Native Interface. The SWT applications are portable and unique for each platform.

The need of SWT is to provide a common API for accessing different operating system / platform specific widgets. The goal for designing of SWT is high performance, native OS look and feel, and platform integration. Swing on the other hand, designed to allow for a highly customizable look and feel that is common across different platforms.

JFace:

A User Interface project developed by Eclipse to handle most commonly used User Interface tasks. It is window based system independent in both implementation and API. It is designed to work with SWT. JFace is included with images, text, dialog, wizard, images, font registries and progress reporting for long running operations.

JFace has two mechanisms – namely action and viewing.

The mechanism of actions allows the commands to be defined independently by the user from the exactness of whereabouts in the User Interface.

The mechanism of viewing is based on the adapters for certain SWT widgets, which simplifies the application presentation data structured with lists, tables or trees.

Eclipse runtime kernel is connected with few classes that have JFace. It can be a common practice to extract JFace and SWT to be used for stand-alone java applications which is not based on the Eclipse runtime.

 145 views

7⟩ Explain the steps used to deploy SWT/JFace-based application with Java Web Start?

Some of the operating system specific libraries are to be loaded for SWT applications before they can execute. The combination of SWT application with Java Web Start provides powerful tools to deploy the client side applications.

To test a Java Web Start application the following are the prerequisites:

Microsoft Windows XP or Red Hat Linux V8

Java 2 SDK, Standard Edition V1.4 or later

Apache Ant V1.5.3 or later

Apache Jakarta Tomcat V4.1.24 or later

The steps for deploying:

1. Install the application in the required directory

2. Signing the code and security:

SWT is tightly integrated with the operating system's native windowing environment. SWT uses a system libraries to manage the platform independent API and the supporting operating system. All the required JAR files deployed with Java Web Start must be digitally signed. Self-signed test certificate is needed to be created, as the specific application is not going to deploy for wide user base.

2a). Creation of self-signed certificate:

Execute the command in the directory where the application is to be deployed:

keytool -genkey -keystore keystore -alias myself

A prompt message will be displayed stating to enter the password,name, locality etc. During the ANT build process, the actual signing the JAR files will be completed.

2b). To verify that the keystore was properly created, type the following command:

keytool -list-keystore keystore

3. Build the file using the ANT

3a). To clean the environment, type: ant clean

3b). To execute the build process type: ant

4. Give a trial to execute the application using the command: ant run

5. To deploy the application to Apache Tomcat web server:

5a). Place the application’s .war file into webapps directory under Tomcat.

5b). Execute the script to start Apache Tomcat

5c). Open the web browser and type http://localhost:8080/index.html. Now click on Launch application.

6. Click on Start in the displayed dialog box to start the application.

 175 views

8⟩ Explain the 3 MVC framework JFace Text?

The JFace text provides a framework for the creation and manipulation of text documents. IDocument is the major abstraction for the text model. The content management, position management using portion categories, document partition management, and change notification is provided by this text model.

The changes / notifications are identified by mandatorily implementing the IDocumentListener and registering with the document. The position and partition updating actions are implemented by using IDocumentPositionUpdater and IDocumentPartitioner.

 146 views

9⟩ Explain the Java Web Start technology?

Java Web Start (JavaWS) technology is a framework which is used to allow the user to run java platform specific application software directly from the internet. The Java Web Start applications do not run in a browser. Web start application provides a series of classes which provides various services to the applications. These classes are available in the package called javax.jnlp

Web start comes as a part of Java Runtime Environment without having separately installed. It comprises the portability of applets and maintainability of servlets and JSP technologies. Java Web Start allows the java client applications to be launched, updated, and deployed from a standard web server.

The Java Application Manager feature allows the end-users to organize the java applications and also provides different options such as specifying the use of multiple Java Runtime Environments, setting proxy servers for HTTP.

 142 views

10⟩ Explain the 3 MVC framework JFace viewer?

The JFace viewer framework is an independent module for JFace which needs some knowledge of SWT. The abstract base classes for viewers comprise the framework. The base class is the Viewer which is an extension of a structured viewer. The Viewer acts as a widget container. It is the responsibility for the content provider to respond to the various modifications to the model by informing the viewer, what to change (using add () and remove () methods).

Each viewer registers with the label provider for identifying / notifying the changes that would affect the viewers display.

 145 views

11⟩ What are the advantages offered by SWT/JFace?

Advantages of SWT:

Provides backend by providing native look with backend widgets by supporting Swing programming model.

SWT could run Swing native objects which enables SWT to run on any Swing support platform.

SWT based application loads faster compared to Swing applications

The memory usage is smaller in SWT as it uses the shared libraries. The shared library loads only once for all SWT applications.

Provides the exact platform look and feel. Even with the skinned desktop, it looks and feel is also skinned.

Provides different styles for different types of menus

 151 views

12⟩ Explain Editors?

Using JFace Text framework, sophisticated editors such as XML editors and text editors can be developed. Any application needs editors to author the designated code. For example XML file needs tags to be written a flat text file. A program needs editor to author the code. By using different development template these editors can be plugged in and developed

 141 views

13⟩ What is Viewers?

Viewers are used to display objects using different SWT widgets. Types of viewers are as follows:

The ListViewer uses the SWT List widget to display the object. A simple list of elements can be created by using ListViewer.

The CheckboxTableViewer uses the SWT widget to display the objects of checkboxes.

The CheckboxTreeViewer uses the SWT table control with checkboxes on each node.

The CheckboxTreeViewer uses the SWT Tree control with checkboxes on each node.

The TableTreeViewer uses the SWT Table Tree control.

TableViewer, uses the SWT TableViewer control.

TreeViewer, uses the SWT TreeViewer control.

 140 views

14⟩ Define Autoboxing with an example?

The automatic conversion of primitive int type into a wrapper class object is called autoboxing. It does not require to type cast the int value. The modification of primitive wrapper objects is done directly. The following example illustrates autoboxing:

int number;

Integer intObject;

number = 1;

intObject = 2;

number = intObject;

intObject = number;

 138 views