Closed Thread
Results 1 to 4 of 4

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

  1. #1
    johnsonk is offline Newbie
    Join Date
    Oct 2009
    Posts
    17
    Rep Power
    0

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

    I tried the following :

    Code:
    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. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Stu_328 is offline Learning Programmer
    Join Date
    Dec 2008
    Posts
    92
    Rep Power
    12

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

    Whats the error on compile?

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

  4. #3
    johnsonk is offline Newbie
    Join Date
    Oct 2009
    Posts
    17
    Rep Power
    0

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

    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.*;
    Last edited by johnsonk; 03-21-2010 at 06:05 PM. Reason: typo

  5. #4
    johnsonk is offline Newbie
    Join Date
    Oct 2009
    Posts
    17
    Rep Power
    0

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

    Oh wait I imported awt.event.* , my bad

    Thanks for your reply though

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. JInternalFrame event listeners
    By gregwarner in forum Java Help
    Replies: 1
    Last Post: 03-17-2011, 10:00 AM
  2. JInternalFrame looks .... ugly
    By Shaddix in forum Java Help
    Replies: 1
    Last Post: 04-06-2010, 04:55 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts