Ask Question
17 September, 21:54

Write the class definition for the subclass of class Window named TiteldWindow. A title window is a window with a title bar. TitledWindow maintains the text appearing on the title bar (string) in a variable named text and the height of the title bar (int) in a variable named barHeight. The constructor for TitledWindow accepts (in the following order) : a width and height, that are passed up to the Window superclass, and a title text and bar height, that are used to initialize its own instance variables.

+4
Answers (1)
  1. 18 September, 01:53
    0
    public class TitledWindow extends Window {

    String text;

    private int barHeight;

    public TitledWindow (int width, int height, String text, int barHeight) {

    super (width, height);

    this. text=text;

    this. barHeight=barHeight;

    }

    }

    Explanation:

    * The solution is written in Java.

    - Create a class TitledWindow, since it is a subclass of the Window class, we need to use extends keyword

    - Declare the variables, text and barHeight

    - Create the constructor with its parameters, since width and height variables are passed from Window class, we can use the super keyword to set the values
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write the class definition for the subclass of class Window named TiteldWindow. A title window is a window with a title bar. TitledWindow ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers