Java Applet Interview Questions and Answers
Ques 26. What is the base class for all swing components?
JComponent (except top-level containers)
Ques 27. What is Difference between AWT and Swing?
Swing provides a richer set of components than AWT. They are 100% Java-based. AWT on the other hand was developed with the mind set that if a component or capability of a component werent available on one platform, it wouldnt be available on any platform. Due to the peer-based nature of AWT, what might work on one implementation might not work on another, as the peer-integration might not be as robust. There are a few other advantages to Swing over AWT:
► Swing provides both additional components and added functionality to AWT-replacement components
► Swing components can change their appearance based on the current "look and feel" library that's being used.
► Swing components follow the Model-View-Controller (MVC) paradigm, and thus can provide a much more flexible UI.
► Swing provides "extras" for components, such as:
► Icons on many components
► Decorative borders for components
► Tool tips for components
► Swing components are lightweight (less resource intensive than AWT)
► Swing provides built-in double buffering
► Swing provides paint debugging support for when you build your own components
Swing also has a few disadvantages:
► It requires Java 2 or a separate JAR file
► If you're not very careful when programming, it can be slower than AWT (all components are drawn)
► Swing components that look like native components might not act exactly like native components.
Ques 28. Why do you Canvas?
The Canvas class of java.awt is used to provide custom drawing and event handling. It provides a general GUI component for drawing images and text on the screen. It does not support any drawing methods of its own, but provides access to a Graphics object through its paint() method. The paint() method is invoked upon the creation and update of a canvas so that the Graphics object associated with a Canvas object can be updated.
Ques 29. What type of sound file formats can I use for the applets?
Java v1.02 only supports the "voice format" of the .au sound files. This is also know as "-law, 8/16-bit, mono, 8000hz sample rate"
Most helpful rated by users:
- What is an applet?
- What is the difference between an Applet and an Application?
- How will you establish the connection between the servlet and an applet?
- What is an Applet? Should applets have constructors?
- How will you initialize an Applet?