Results 1 to 12 of 12
  1. #1
    fatabass is offline Senior Member
    Join Date
    Nov 2011
    Location
    Turkey
    Posts
    380
    Blog Entries
    24
    Rep Power
    4

    Default Is javax.swings.JFrame class a subclass of java.awt.Frame ?

    Quoting from the book: Java, Java, Java, Object-Oriented Problem Solving (3rd Edition)

    "For example, the javax.swing.JFrame class, which represents a top-level window, is a subclass of java.awt.Frame."

    Is this true ?

    Link to the book is:
    Amazon.com: Java, Java, Java, Object-Oriented Problem Solving (3rd Edition) (9780131474345): Ralph Morelli, Ralph Walde: Books


    ( I have not touched a single character on the text I have quoted. )

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,773
    Rep Power
    25

    Default Re: Is javax.swings.JFrame class a subclass of java.awt.Frame ?

    First and one of the best places to look:
    Java Platform SE 6

  3. #3
    fatabass is offline Senior Member
    Join Date
    Nov 2011
    Location
    Turkey
    Posts
    380
    Blog Entries
    24
    Rep Power
    4

    Default Re: Is javax.swings.JFrame class a subclass of java.awt.Frame ?

    Well it looks like it is not, I just wanted to make sure since I am a beginner.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default Re: Is javax.swings.JFrame class a subclass of java.awt.Frame ?

    Too much trouble to look up the API, huh?

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

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,013
    Rep Power
    10

    Default Re: Is javax.swings.JFrame class a subclass of java.awt.Frame ?

    Quote Originally Posted by fatabass View Post
    Well it looks like it is not, I just wanted to make sure since I am a beginner.
    What makes you think it is not? From the API:

    Java Code:
    java.lang.Object
      extended by java.awt.Component
          extended by java.awt.Container
              extended by java.awt.Window
                  extended by java.awt.Frame
                      extended by javax.swing.JFrame
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  6. #6
    fatabass is offline Senior Member
    Join Date
    Nov 2011
    Location
    Turkey
    Posts
    380
    Blog Entries
    24
    Rep Power
    4

    Default Re: Is javax.swings.JFrame class a subclass of java.awt.Frame ?

    I am really not lazy.
    I just cant be sure since that looks like a serious book.

    So if you are here to judge, save your thoughts please.

    All I require is simple Yes or No answer. I am a beginner, and I do not have anyone experienced around me to consult.

    Thanks.

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,773
    Rep Power
    25

    Default Re: Is javax.swings.JFrame class a subclass of java.awt.Frame ?

    Did you bookmark the link to the API doc so you can find it easily for future questions like this one?

  8. #8
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,013
    Rep Power
    10

    Default Re: Is javax.swings.JFrame class a subclass of java.awt.Frame ?

    Nobody has judged you. Have you looked at the API? It's not a book, so since you're calling it one, the answer must be no. Looking at the API is a very important skill to learn, especially if you do not have other programmers to consult.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  9. #9
    fatabass is offline Senior Member
    Join Date
    Nov 2011
    Location
    Turkey
    Posts
    380
    Blog Entries
    24
    Rep Power
    4

    Default Re: Is javax.swings.JFrame class a subclass of java.awt.Frame ?

    I am not calling the API a book.

    The book I am quoting from is a book.

    And I was clearly mistaken that because they were different packages, I thought somehow it was wrong information.

    I thought a class could only extend a class from the same package.

    java.lang.Object
    java.awt.Component
    java.awt.Container
    java.awt.Window
    java.awt.Frame
    javax.swing.JFrame

    So I was confused in this last step where javax.swing.JFrame extends java.awt.Frame, because it is a different package.

    Thanks.

  10. #10
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,013
    Rep Power
    10

    Default Re: Is javax.swings.JFrame class a subclass of java.awt.Frame ?

    Quote Originally Posted by fatabass View Post
    I thought a class could only extend a class from the same package.
    If that was the case, you couldn't get very far. How would anything outside of java.lang extend Object? How would you write your own classes that extend existing ones?

    Lesson learned: test all of your assumptions! The best way to do this is to write small programs and consult the API.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  11. #11
    fatabass is offline Senior Member
    Join Date
    Nov 2011
    Location
    Turkey
    Posts
    380
    Blog Entries
    24
    Rep Power
    4

    Default Re: Is javax.swings.JFrame class a subclass of java.awt.Frame ?

    Yes I was confused with awt and swing, I remember reading something like AWT was old and Swing was something completely new and different.

    I was clearly mistaken and confused. Sorry if the question was way too silly.

    Anyway thanks, although it was a bit harsh, I learned that classes can extend classes from different packages.

    Thanks again.

  12. #12
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,013
    Rep Power
    10

    Default Re: Is javax.swings.JFrame class a subclass of java.awt.Frame ?

    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Help with creating new class as a subclass in Java
    By Monkeeboy in forum New To Java
    Replies: 3
    Last Post: 01-22-2011, 04:06 PM
  2. weird insets change in JFrame subclass
    By sowilo in forum AWT / Swing
    Replies: 4
    Last Post: 11-18-2009, 01:27 AM
  3. Super class refering to subclass
    By sujith123 in forum New To Java
    Replies: 3
    Last Post: 10-05-2009, 10:00 AM
  4. subclass vs inner class
    By bugger in forum New To Java
    Replies: 1
    Last Post: 01-13-2008, 08:31 PM
  5. which class is superclass and subclass?
    By java_fun2007 in forum New To Java
    Replies: 0
    Last Post: 12-11-2007, 09:55 PM

Posting Permissions

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