HOME      BLOG       FORUMS      CONTACT       ABOUT

Swing AWT Interview Questions

July 21st, 2011 Albin Joseph Posted in Swing interview question 2 Comments »

Here you can find a list of interview questions for Java Swing and AWT. These questions are often asked by the interviewer for JFC (Java foundation Classes) or Swing interview. We put our maximum effort to make this section error free. However there might be some errors. If you feel any answer given for any question is wrong, please, please inform us by clicking on report bug button provided at the bottom of the screen. In this section we are offering interview questions for AWT and Swing technologies. This section covers interview questions for applets also. If you need interview questions for any other Java related technologies , please check the relevant sections.
Read the rest of this entry »

Share
AddThis Social Bookmark Button

Java Swing interview questions – Part 4

May 30th, 2011 Albin Joseph Posted in Swing interview question No Comments »

46. What is difference between Swing and JSF?
The key difference is that JSF runs on server. It needs a server like Tomcat or WebLogic or WebSphere. It displays HTML to the client. But Swing program is a stand alone application.
Read the rest of this entry »

Share
AddThis Social Bookmark Button

Swing interview questions – Part 3

May 24th, 2011 Albin Joseph Posted in Swing interview question No Comments »

31. How are the elements of different layouts organized?
The elements of a FlowLayout are organized in a top to bottom, left to right fashion. The elements of a BorderLayout are organized at the borders (North, South, East and West) and the center of a container. The elements of a CardLayout are stacked, on top of the other, like a deck of cards. The elements of a GridLayout are of equal size and are laid out using the square of a grid. The elements of a GridBagLayout are organized according to a grid. However, the elements are of different size and may occupy more than one row or column of the grid. In addition, the rows and columns may have different sizes. It is the most flexible layout.

32. What are types of applets?
There are two different types of applets. Trusted Applets and Untrusted applets. Trusted Applets are applets with predefined security and Untrusted Applets are applets without any security.
Read the rest of this entry »

Share
AddThis Social Bookmark Button

Java Swing interview questions – Part 2

May 23rd, 2011 Albin Joseph Posted in Swing interview question 1 Comment »

Java Swing/AWT interview questions – Part 2

16. What is the difference between invokeAndWait() and invokeLater()?
invokeAndWait is synchronous. It blocks until Runnable task is complete. InvokeLater is asynchronous. It posts an action event to the event queue and returns immediately. It will not wait for the task to complete

17. Why should any swing call back implementation execute quickly?
Callbacks are invoked by the event dispatch thread. Event dispatch thread blocks processing of other events as long as call back method executes.
Read the rest of this entry »

Share
AddThis Social Bookmark Button

Swing/AWT interview questions – 1

May 22nd, 2011 Albin Joseph Posted in Swing interview question 1 Comment »

1 Q What is JFC?
A JFC stands for Java Foundation Classes. The Java Foundation Classes (JFC) are a set of Java class libraries provided as part of Java 2 Platform, Standard Edition (J2SE) to support building graphics user interface (GUI) and graphics functionality for client applications that will run on popular platforms such as Microsoft Windows, Linux, and Mac OSX.

2 Q What is AWT?
A AWT stands for Abstract Window Toolkit. AWT enables programmers to develop Java applications with GUI components, such as windows, and buttons. The Java Virtual Machine (JVM) is responsible for translating the AWT calls into the appropriate calls to the host operating system.

3 Q What are the differences between Swing and AWT?
A AWT is heavy-weight components, but Swing is light-weight components. AWT is OS dependent because it uses native components, But Swing components are OS independent. We can change the look and feel in Swing which is not possible in AWT. Swing takes less memory compared to AWT. For drawing AWT uses screen rendering where Swing uses double buffering.

4 Q What are heavyweight components ?
A A heavyweight component is one that is associated with its own native screen resource (commonly known as a peer).

5 Q What is lightweight component?
A A lightweight component is one that “borrows” the screen resource of an ancestor (which means it has no native resource of its own — so it’s “lighter”).

6 Q What is double buffering ?
A Double buffering is the process of use of two buffers rather than one to temporarily hold data being moved to and from an I/O device. Double buffering increases data transfer speed because one buffer can be filled while the other is being emptied.

7 Q What is an event?
A Changing the state of an object is called an event.

8 Q What is an event handler ?
A An event handler is a part of a computer program created to tell the program how to act in response to a specific event.

9 Q What is a layout manager?
A A layout manager is an object that is used to organize components in a container.

10 Q What is clipping?
A Clipping is the process of confining paint operations to a limited area or shape.

11 Q Which containers use a border Layout as their default layout?
A The window, Frame and Dialog classes use a border layout as their default layout.

12 Q What is the preferred size of a component?
A The preferred size of a component is the minimum component size that will allow the component to display normally.

13 Q What method is used to specify a container’s layout?
A The setLayout() method is used to specify a container’s layout.

14 Q Which containers use a FlowLayout as their default layout?
A The Panel and Applet classes use the FlowLayout as their default layout.

15 Q Which method of the Component class is used to set the position and size of a component?
A setBounds

Share
AddThis Social Bookmark Button