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: Interaction between components.

  1. #1
    Junior Member
    Join Date
    Feb 2011
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Interaction between components.

    problem solved.
    Last edited by SyntheticD; February 10th, 2011 at 04:24 PM.


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Interaction between components.

    Hello SyntheticD.

    Welcome to the Java Programming Forums.

    What is the issue with the code you posted? Does it produce errors? Please be as descriptive as possible.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  3. #3
    Member DanBrown's Avatar
    Join Date
    Jan 2011
    Posts
    134
    My Mood
    Confused
    Thanks
    1
    Thanked 12 Times in 12 Posts

    Default Re: Interaction between components.

    Drawable drawable = new Drawable(Color.GREEN);
    btnOne.addActionListener(new Drawable());
    You are creating two instances of Drawable , one with default color and other with no color
    thats why its not showing effect , you are looking.

    make this

    btnOne.addActionListener(drawable);
    use object of drawable you had created earlier.
    Thanks and Regards
    Dan Brown

    Common Java Mistakes

  4. The Following User Says Thank You to DanBrown For This Useful Post:

    SyntheticD (February 9th, 2011)

  5. #4
    Junior Member
    Join Date
    Feb 2011
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Interaction between components.

    Quote Originally Posted by DanBrown View Post
    You are creating two instances of Drawable , one with default color and other with no color
    thats why its not showing effect , you are looking.

    make this



    use object of drawable you had created earlier.
    What you told me, gives me expected behaviour.. but.. when the button is clicked, another button pops up, and I now have two buttons. Why is that ?

  6. #5
    Junior Member
    Join Date
    Feb 2011
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Interaction between components.

    Wrong post.
    Last edited by SyntheticD; February 9th, 2011 at 09:45 PM.

Similar Threads

  1. State Variables interaction with outside classes?
    By Ace Coder in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 24th, 2010, 03:52 PM
  2. Interaction with external application
    By righi in forum What's Wrong With My Code?
    Replies: 8
    Last Post: October 2nd, 2010, 08:37 AM
  3. Getting Size of Components
    By aussiemcgr in forum AWT / Java Swing
    Replies: 3
    Last Post: July 26th, 2010, 03:41 PM
  4. Components that interact with eachother
    By Flamespewer in forum AWT / Java Swing
    Replies: 2
    Last Post: February 25th, 2010, 09:27 PM
  5. How to link two classes in java to use it method
    By Sterzerkmode in forum Object Oriented Programming
    Replies: 3
    Last Post: May 13th, 2009, 06:52 AM