Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with ActionListener of jTextField

 
netanel weinberg
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
netanel weinberg
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic