Java Swing Question and Answers

25. What is swing?
  Swing is a comprehensive set of user interface components whose look and feel can be defined at runtime. Swing is a set of classes that provide more powerful and flexible components that are possible with the AWT.
 
Your Name Your Email-ID
Your Answer
26. Explain the JTable and TableDateModel interface in Swing?
 
  • JTable is one of the powerful features given by Swing. This class, present in the swing.table package, shows the data in the form of tables, in a much better way. We can also select an entire column or row at a time.
  • JTable (TableDataaModel) is the constructor for a JTable.
  • The method addColumn (JTableColumn) appends a column to the end of the JTable's array of columns and JTableHeader's getTableHeader () method gives a Header to the table.
  • The TableDataModel interface specifies the interface for objects that provides data for cells in a JTable. We can have an object of this interface by creating an object of JTableDataModelAdapter after overriding the methods.
 
Your Name Your Email-ID
Your Answer
27. How different is Swing from AWT?
 
  • In addition to familiar components, such as buttons, check boxes, labels, etc. Swing supplies several exciting additions, including tabbed panes, scroll panes, trees, and tables. Even familiar components, such as buttons, have more capabilities in Swing. For example, a button may have both an image and a text string associated with it. Also, the image can be changed as the state of the button changes.
  • Unlike AWT components, Swing components are not implemented by platform-specific code. Instead, they are written entirely in Java and, therefore, are platform-independent.
  • Swing components can be treated as lightweight components. One of the most important features of Swing components is their pluggable look and feel design, which increases the reliability and consistency of applications and applets deployed across platforms.
 
Your Name Your Email-ID
Your Answer
123456789 Page 7 of 9