Question: Is it a requirement to use inheritance for frames, as described in Section 20.1.3? (Consider Special Topic 20.1.) Data from special topic 20.1 Special Topic
Is it a requirement to use inheritance for frames, as described in Section 20.1.3?
(Consider Special Topic 20.1.)
Data from special topic 20.1

Special Topic 20.1 Adding the main Method to the Frame Class Have another look at the FilledFrame and Filled FrameViewer2 classes. Some programmers prefer to combine these two classes, by adding the main method to the frame class: public class Filled Frame extends JFrame { public static void main(String[] args) { } JFrame frame = new Filled Frame(); frame.setTitle("A frame with two components"); frame.setDefaultCloseOperation (JFrame. EXIT_ON_CLOSE); frame.setVisible(true); public FilledFrame() { createComponents(); setSize(FRAME_WIDTH, FRAME_HEIGHT); } } This is a convenient shortcut that you will find in many programs, but it does not separate the responsibilities between the frame class and the program.
Step by Step Solution
3.39 Rating (168 Votes )
There are 3 Steps involved in it
The data from Special Topic 201 discusses the technique of combining the main method and JFrame into ... View full answer
Get step-by-step solutions from verified subject matter experts
