Jump to content

How do i write a listener for when a JInternalFrame gains focus?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
johnsonk

johnsonk

    Newbie

  • Members
  • PipPip
  • 17 posts
I tried the following :



public class MyUI extends JInternalFrame{

    ...... 


  public MyUI (MyUIController controller,String title) {

          addInternalFrameListener(new InternalFrameAdapter(){


                @Override

                public void internalFrameActivated(ActionEvent e) {

                    manageAddCategory();

                }

            });

    .....

}


However it wouldn't compile.

Any help appreciated

#2
Stu_328

Stu_328

    Learning Programmer

  • Members
  • PipPipPip
  • 92 posts
Whats the error on compile?

And don't put stuff like adding listeners in the constructor - its bad practice.

#3
johnsonk

johnsonk

    Newbie

  • Members
  • PipPip
  • 17 posts
Was just replying and I managed to fix it, I needed to import

javax.swing.event.InternalFrameAdapter;

even though I had imported
javax.swing.event.*;

Edited by johnsonk, 21 March 2010 - 05:05 PM.
typo


#4
johnsonk

johnsonk

    Newbie

  • Members
  • PipPip
  • 17 posts
Oh wait I imported awt.event.* , my bad :rolleyes:

Thanks for your reply though