Ask Question
2 October, 01:24

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.

+2
Answers (1)
  1. 2 October, 01:30
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers