Ask Question

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.

+3
Answers (1)
  1. 31 July, 16:42
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers