Why does JComponent have add() and remove() methods but Component does not?
Answer / Meena Verma
JComponent is a subclass of Component in Swing, which is designed to provide common functionality for visual components. As such, it inherits some methods from its superclass (Component), including add() and remove(). However, Component itself does not have these methods because they are not relevant for all types of components. The add() method allows components to be added to a container, while the remove() method removes them. These methods are necessary for managing the hierarchy and layout of components within containers.
| Is This Answer Correct ? | 0 Yes | 0 No |
Is swing still used?
what are the root classes of all classes?
How to add and delete nodes in Jtree?
What are heavyweight components? What is lightweight component?
Why swings are used in java?
How to link two forms in java swing?
please any one explain this project: Minimizing recovery state in geographic ad hoc routing
In what context should the value of swing components be updated directly?
What are the differences between Swing and AWT?
What is the default look and feel of a Swing Component?
How to perform action on button in java swing?
How to reload a jframe in java swing?