Results 1 to 5 of 5

Thread: Bringing a JInternalFrame to front

  1. #1
    gommo
    Guest

    Bringing a JInternalFrame to front

    I have several JInternal Frames in a larger JFrame window and am implementing a window menu in the menubar. However, I have failed to work out how to bring a chosen window to the front??? Anyhelp

  2. #2
    Addicted Member Mrs Kensington's Avatar
    Join Date
    Sep 2001
    Location
    Dorset, UK
    Posts
    144
    This is how i do it. Where index is the index of the frame to select.

    Code:
    JInternalFrame[] allFrames = desktop.getAllFrames();
    desktop.getDesktopManager().activateFrame(allFrames[index]);
    		
    try{allFrames[index].setSelected(true);}
    catch(Exception e){System.out.println(e.getMessage());}
    I've actually created an MDIDesktopManager class which has a createWindowMenu() method which returns the menu. It then deals with changes in the desktop pane and also deals with Tiling and cascading.

    I can post it if you want.

    Mrs Kensington
    Ford? Theres an infinite number of monkeys outside that want to talk to you about a script of hamlet they've produced!

  3. #3
    gommo
    Guest
    I wouldnt mind if you'd post it If it isn't a problem.

    I've written the cascading and tiling etc.. Just was having problems getting the top window to focus

  4. #4
    Addicted Member Mrs Kensington's Avatar
    Join Date
    Sep 2001
    Location
    Dorset, UK
    Posts
    144
    Here you go...

    Just add it to your desktop pane as a DesktopManager


    Stupid forum doesn't allow me uploading a .java file (tho it allows .cpp) so it's been zipped
    Attached Files Attached Files
    Ford? Theres an infinite number of monkeys outside that want to talk to you about a script of hamlet they've produced!

  5. #5
    gommo
    Guest
    Thanks for that.
    I got it working already but I'll check out your source anyway.

Posting Permissions

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



Click Here to Expand Forum to Full Width