Javax.The swing package contains lightweight components. The repaint( ) method is used to cause paint( ) to be invoked by the AWT painting thread. The paint( ) method supports painting via a Graphics object. What is the difference between the paint() and repaint( ) methods? How can a GUI component handle its own events?Ī component can handle its own events by implementing the required event-listener interface and adding itself as its own event listener. Window, Frame, Dialog, FileDialog, Panel, Applet, or ScrollPane Name the containers which use Border Layout as their default layout? Also, we can switch from one look and feel to another at runtime in swing which is not possible in AWT. Pluggable look and feel possible using java Swing. For example, button is a heavy-weight component. Heavyweight components depend on the local windowing toolkit. What is the difference between Swing and AWT components?ĪWT components are heavy-weight, whereas Swing components are lightweight. The FontMetrics class is used to define implementation-specific properties, such as ascent and descent, of a Font object. What is the difference between the Font and FontMetrics classes? The peerless components are called lightweight components. All components in Swing, except JApplet, JDialog, JFrame, and JWindow are lightweight components. Which package has lightweight components? Instead, we make it easy to send requests to a component so that the requests run on a single thread. For this reason, we do not require Swing components to support access from multiple threads. In particular, we wanted to make it easy for programmers to build new Swing components, whether from scratch or by extending the components that we provide. The Swing API was designed to be powerful, flexible, and easy to use. List of topic-wise frequently asked java interview questions with the best possible answers for job interviews.
0 Comments
Leave a Reply. |