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.

Page 2 of 2 FirstFirst 12
Results 26 to 27 of 27

Thread: Object-oriented applet

  1. #26
    Member
    Join Date
    Jun 2010
    Posts
    75
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: Object-oriented applet

    Quote Originally Posted by Norm View Post
    You need to pass a reference to one class to the other. For example in Buttons pass a reference to itself (this) in the constructor of the Pushed class.
    Pushed pushed = new Pushed(this);
    and in the Pushed class, receive the reference in a constructor:
    Pushed(Buttons b) {
    I understand what what you recommended I do: create a class whose constructor class the constructor of another class using the object created by the first constructor call as an argument to create an instance of the second class. However, when I try to run the applet now it still doesn't perform the action as written.

  2. #27
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,137
    Thanks
    48
    Thanked 2,156 Times in 2,129 Posts

    Default Re: Object-oriented applet

    when I try to run the applet now it still doesn't perform the action
    Time for more debugging. Add a print out of the event passed to the actionPerformed method to see that it is called and to show what it is getting.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. 2D Object makes my object smaller, Why?
    By MassiveResponse in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 15th, 2010, 02:33 PM
  2. TCP Client Server: Object Oriented
    By nffc luke in forum Object Oriented Programming
    Replies: 2
    Last Post: April 28th, 2010, 06:39 PM
  3. applet img
    By wolfgar in forum Java Theory & Questions
    Replies: 5
    Last Post: April 7th, 2010, 09:14 PM
  4. Object Oriented Programming request please helpp...
    By dini-x in forum Object Oriented Programming
    Replies: 3
    Last Post: April 1st, 2010, 12:57 AM
  5. Object Oriented program, no output
    By boardbreaker in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 17th, 2009, 10:11 PM