• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem with ActionListener of jTextField

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
netanel weinberg
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
}
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic