Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: class extending

  1. #1
    Junior Member
    Join Date
    Oct 2010
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default class extending

    I need my class to extend JFrame and ApplicationFrame. Is that possible? How?


  2. #2
    Member
    Join Date
    May 2010
    Posts
    39
    Thanks
    4
    Thanked 3 Times in 3 Posts

    Default Re: class extending

    A class cannot extent two classes, however if the ApplicationFrame is a Interface implement the AplicationFrame after Exending the JFrame:

    public class Main extends JFrame implements ApplicationFrame {

    The class main is a child of JFrame, and Application frame,

    @another question ,what is this ApplicationFrame you speak of is it one of your own classes, you need to give more info :s

  3. The Following User Says Thank You to Time For This Useful Post:

    Reem (November 15th, 2010)

  4. #3
    Junior Member
    Join Date
    Nov 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: class extending

    you can simply write Maiin extends JFrame implements ActionListener{

  5. #4
    Member Darryl.Burke's Avatar
    Join Date
    Mar 2010
    Location
    Madgaon, Goa, India
    Posts
    494
    Thanks
    8
    Thanked 48 Times in 46 Posts

    Default Re: class extending

    Quote Originally Posted by talha07 View Post
    you can simply write Maiin extends JFrame implements ActionListener{
    Irrelevant to the question asked here and poor GUI programming practice to boot.

    Please don't post garbage here.

    db

  6. #5
    Member
    Join Date
    Oct 2010
    Posts
    40
    Thanks
    0
    Thanked 2 Times in 1 Post

    Default Re: class extending

    isn't your application frame a subclass of jframe? if it is not u can do this then:

    public class ApplicationFrame extends JFrame{

    }

    public YourClass extends ApplicationFrame{

    }

    that way you can have the attributes of both JFrame and ApplicationFrame.

Similar Threads

  1. Replies: 0
    Last Post: April 11th, 2010, 08:56 AM
  2. problem with data access when a class call another class
    By ea09530 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 4th, 2010, 05:20 PM
  3. Accessing a method of one class in another class
    By Sai in forum What's Wrong With My Code?
    Replies: 6
    Last Post: March 23rd, 2010, 04:06 PM
  4. how to load a class and type cast to that class?
    By chinni in forum Object Oriented Programming
    Replies: 2
    Last Post: November 9th, 2009, 10:18 AM
  5. adding get mothods to a class extending thread
    By aliaa2a in forum Object Oriented Programming
    Replies: 6
    Last Post: August 3rd, 2009, 06:41 AM