The Artima Developer Community
Sponsored Link

Java Answers Forum
Making Events work from different classes

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Max Lyn

Posts: 11
Nickname: techrolla
Registered: Feb, 2003

Making Events work from different classes Posted: Apr 24, 2003 8:58 PM
Reply to this message Reply
Advertisement
How do I have a button in another class and have its action in that class too, but make it clear a text field that is in another class?? Ive had this problem for about every project Ive started and I just cant make it do anything or make a change in the other class.

Heres the code thats giving me a problem:

	
BankEntryPanel bep; // contains nameT text field
public BankToolBar()
	{
		
		for(int i = 0; i < buttons.length; i++)
		{
			add(buttons[i]);
                        buttons[i].addActionListener(this);
 
		}
		
	}
	
	public void actionPerformed(ActionEvent e)
	{
		if(e.getSource() == newPatron)
		{
			
			bep.nameT.setText(""); // wont change anything
			System.out.println("hello");// works
		}
	}
}

Topic: Question about thread simulation Previous Topic   Next Topic Topic: Is it Synchronized?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use