Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

setText() in actionListener (button press)

807597Mar 18 2005 — edited Mar 20 2005
Hi,

Im very new to Java and i've been putting together a pretty simple script. I have a JButton (start), which enables me to a range of processes when someone hits it:
start.addActionListener(
    new ActionListener() {
        public void actionPerformed(ActionEvent e) {

//code for button goes here

}
}
};
This works fine. Although if I try and update a JLabel when the button is hit, using labelname.setText() it doesnt seem to do it? However all my other processes when the button is hit work perfectly and the setText() works if I use it outside the code above.

Any help greatly appretiated...let me know if you need more code snippets :)

-Ross
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 17 2005
Added on Mar 18 2005
12 comments
385 views