Java Swing Interview Questions and Answers - 1
Question: 1
What is a layout manager and what are different types of layout managers available in Java Swing?
A layout manager is an object that is used to organize components in a container.
The different layouts available are FlowLayout, BorderLayout, CardLayout, GridLayout and GridBagLayout.
FlowLayout: The elements of a FlowLayout are organized in a top to bottom, left to right fashion.
BorderLayout: The elements of a BorderLayout are organized at the borders(North, South East and West) and the center of a container.
CardLayout: The elements of a CardLayout are stacked, on top of the other, like a deck of cards.
GridLayout: The elements of a GridLayout are of equal size and laid out using the square of a grid.
GridBagLayout: The elements of a GridBagLayout are organized according to a grid. However, the elements may be different sizes and may occupy more than one row or column of the grid. In addition, the rows and columns may have different sizes.
Question: 2
What is a container in a GUI?
A container contains and arranges other components (including other container) through the use of layout managers, which use specific layout policies to determine where components should go as a function of the size of the container.
Question: 3
What advantage do Java’s layout managers provide over traditional windowing systems?
Java uses layout managers to lay out components in a consistent manner across all windowing platforms.
Since Java’s layout managers aren’t tied to absolute sizing and positioning, they are able to accommodate platform specific differences among windowing systems.
Question: 4
Why Swing components are called lightweight component?
AWT component are associated with native screen resource and called heavyweight component while Swing components is uses the screen resource of an ancestor instead of having their own and that’s why called lightweight or lighter component.
Question: 5
What are peerless components?
The peerless components are called light weight components.
Gross Domestic Product and Its Growth Class 10 Questions Pdf More
Industrial Cluster in Tamil Nadu TNPSC Questions Pdf More
Food and Security TNPSC Questions Pdf More
Economics Food Security and Nutrition Class 10 Questions Pdf More
Class 10th Social Indian Constitution Pdf More
Top 200+ Advanced C++ Interview Questions 2020-2021 More
7000+ TNPSC Botany & Zoology Previous Year Question Papers More
1000+ Capgemini Aptitude Questions with Answers Pdf More
Top 1000+ Computer Aptitude Notes for Bank Exams Pdf More
7000+ Analog Circuits MCQ Questions and Answers Pdf More