Results 1 to 3 of 3

Thread: subclases

  1. #1
    xtoneekilla is offline Member
    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0

    Default subclases

    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.

    *****it keeps telling me i have to add something before the instance variable, here is my code.

    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;
    }
    }

    can anyone tell me whats wrong with it?

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    786
    Rep Power
    5

    Default Re: subclases

    Looks fine to me. Maybe the import is missing? Which window class is meant?

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: subclases

    Please go through Guide For New Members and BB Code List - Java Programming Forum and edit your post accordingly.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •