aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes problem with ActionListener of jTextField Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "problem with ActionListener of jTextField" Watch "problem with ActionListener of jTextField" New topic
Author

problem with ActionListener of jTextField

netanel weinberg
Greenhorn

Joined: May 10, 2004
Posts: 27
Hello,
i've written some code in my webapp but i've got a problem with the ActionListener of the jTextfields components? here is some of my code:
//method fo awbnumber
private javax.swing.JTextField getAwbnumber() {
if(awbnumber == null) {
awbnumber = new javax.swing.JTextField();
awbnumber.setPreferredSize(new java.awt.Dimension(100,25));
awbnumber.setColumns(6);
awbnumber.addActionListener(this);
}
return awbnumber;
}
//part of the actionPerformed method
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == awbnumber)
{
if (awbnumber.getText()!=null)
if(awbnumber.getText().compareTo("")!=0)
{
awbObj.setAwbnumber(awbnumber.getText());
}
else
awbObj.resetAwbnumber();
}
....
if someone can find the problem i will appreciate it very much
the code doesn't work... never calls the actionPerformed() method...
10x ahead,
netanel
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
netanel weinberg
Greenhorn

Joined: May 10, 2004
Posts: 27
you haven't solved my problem... i want the change in the jTextfield field
will call the actionperfomed method and i can't do that...
Lalit Kumar
Greenhorn

Joined: Jan 29, 2004
Posts: 2
it seems that u r implementing the "ActionListener" interface.

Add the line "implements ActionListener" at your start of program.

class XYZ implements ActionListener
{
//Code of particular class
}
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by netanel weinberg:
you haven't solved my problem...


First of all, we're not here to "solve your problem". We are here to help you solve your problem.

Secondly, i've written some code in my webapp...

A webapp? And you are using Swing?

Thirdly, since this is a Swing question, I am going to move it to the appropriate forum, um, the Swing forum. Yeah, that one sounds close to what you are working with.


GenRocket - Experts at Building Test Data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with ActionListener of jTextField