Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » embedded method
embedded method [message #794395] Thu, 09 February 2012 08:30 Go to next message
auger pierre is currently offline auger pierreFriend
Messages: 2
Registered: January 2012
Junior Member
Hi;
i don't understand the code
Quote:
play= new AbstractAction() {

public void actionPerformed(ActionEvent arg0) {

player.init();
audioPlayerThread = new Thread(player);
audioPlayerThread.start();

player.getLine().addLineListener(new LineListener(){

public void update(LineEvent le) {
if(le.getType()==LineEvent.Type.STOP){
play.setEnabled(true);
stop.setEnabled(false);


}
if(le.getType()==LineEvent.Type.START){
play.setEnabled(false);
stop.setEnabled(true);

}
}
});

}
};

and i don't find in the java books :the definition of the method actionPerformed is inside the method AbstractAction with a semicolonat its end in the AbstractAction ,
i am newcommer to java but i never saw such a programming
thank you for help
Re: embedded method [message #794600 is a reply to message #794395] Thu, 09 February 2012 13:35 Go to previous message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

You might get an answer here from someone, however, this isn't a Java
forum. Academically, you're better off asking such questions in another
such as javaranch.com or jguru.com.

I think your thing falls in the area of what's termed in Java "anonymous
classes", but I'm not very academic in Java.

On 2012.02.09 1:30, auger pierre wrote:
> Hi;
> i don't understand the code
> Quote:
>> play= new AbstractAction() {
>>
>> public void actionPerformed(ActionEvent arg0) {
>>
>> player.init();
>> audioPlayerThread = new Thread(player);
>> audioPlayerThread.start();
>> player.getLine().addLineListener(new LineListener(){
>>
>> public void update(LineEvent le) {
>> if(le.getType()==LineEvent.Type.STOP){
>> play.setEnabled(true);
>> stop.setEnabled(false);
>>
>>
>> }
>> if(le.getType()==LineEvent.Type.START){
>> play.setEnabled(false);
>> stop.setEnabled(true);
>>
>> }
>> }
>> });
>>
>> }
>> };
>
> and i don't find in the java books :the definition of the method
> actionPerformed is inside the method AbstractAction with a semicolonat
> its end in the AbstractAction ,
> i am newcommer to java but i never saw such a programming
> thank you for help
Previous Topic:Bursting
Next Topic:Require-Bundle
Goto Forum:
  


Current Time: Thu Sep 26 06:45:51 GMT 2024

Powered by FUDForum. Page generated in 0.29153 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top