File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Explicitly throwing events & calling listener methods?

 
ramya narayanan
Ranch Hand
Posts: 338
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
I need a clarification on whether we can manually generate some event & call eventlistener methods.
See in the below program, without clicking the button1 i.e. AnnotationEnabled is it possible to generate ActionEvent & call the actionPerformed(ActionEvent ae) method.



MyBestRegards.
 
Swastik Dey
Rancher
Posts: 1601
5
Android Java Java ME
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its possible, just see the last line of init method.

public void init()
{
text=new JTextField(25);

//pane.setLayout(new FlowLayout());
pane.setLayout(null);
JRadioButton buttonone=new JRadioButton("AnnotationEnabled");
buttonone.setBounds(50,50,200,30); //x,y,width,height
pane.add(buttonone);
buttonone.addActionListener(this);

JRadioButton buttontwo=new JRadioButton("AnnotationDisabled");
buttontwo.setBounds(260,50,200,30);
pane.add(buttontwo);
buttontwo.addActionListener(this);

//add textbox to the container panel
pane.add(text);
text.setBounds(50,90,100,30);
ButtonGroup buttongroup=new ButtonGroup();
buttongroup.add(buttonone);
buttongroup.add(buttontwo);
buttontwo.doClick();

}
 
Campbell Ritchie
Sheriff
Pie
Posts: 47216
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a Swing-related topic. Moving
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic