🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #761

anonymous inner class

#761
From: Alan Shiers
Date: Fri, 17 Dec 2004 17:24
23 lines
1566 bytes
Hi there,

How do I fix this:

static String propertyName = ""; //<<this is set in another method
private static void setProperty(String property, Object o){...}
JTextField textField = new JTextField();
 textField.addActionListener(new ActionListener()
                  {
                     public void actionPerformed(ActionEvent e)
                     {
                       setProperty(propertyName, getText());  //<<<< The
compiler doesn't like the call to getText()
                     }
                  });

What do I have to change to access the getText() method of JTextField?
I've tried: this.getText() and JTextField.this.getText()
Neither one works.

Please advise,

Alan
Technical Details
Message-ID: <41c31757$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,55efd19d4eed5bf0,start
X-Google-Attributes: gid111d45,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Alan Shiers" <ashiers@hfx.eastlink.ca>
Newsgroups: borland.public.jbuilder.java.swing
Subject: anonymous inner class
Date: Fri, 17 Dec 2004 13:24:57 -0400
Lines: 25
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 24.222.101.2
Message-ID: <41c31757$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1103304535 24.222.101.2 (17 Dec 2004 09:28:55 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail