java - Set Object's attributes on its creation -


i see code this:

new myjframe().setvisible(true); 

i don't know how works, creates myjframe , sets visible, alternative setting visible on constructor.

what know if there way on jmenuitem or jbutton automatically assign actionlistener without having explicitly declaring first, in:

myjmenu.add(new jmenuitem("item").addactionlistener(myactionlistener)); 

which, far i've tried, doesn't work.

i don't need work, know if possible, save me time.

thanks in advance.

it's called method chaining , put, class either supports or not, depending on how it's written.

the way done simple:

public class bar {     private set<foo> foos;     public bar addfoo( foo foo ) {      this.foos.add( foo );      return this;    } } 

from can see why isn't possible chain methods weren't written way.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -