Results 1 to 5 of 5
  1. #1
    Robert_85 is offline Member
    Join Date
    Mar 2009
    Posts
    27
    Rep Power
    0

    Exclamation How to make a Jframe un-focusable when another Jframe is active?

    Hi,

    Basically I've got a GUI window from which I am creating and calling another GUI window, I want this second GUI to be Always on top AND I want other GUI's to be Un-focusable while this GUI is active...

    an example of what I am trying to do is when you want to save a file(say Microsoft word document), as long as the "saving window" is showing, you cannot type any word or do anything in Microsoft word. and if you try to do anything you'll get a beep noise..


    Can anyone help?

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    6

    Default

    The normal approach would be to use a modal JDialog for the second window,

  3. #3
    Robert_85 is offline Member
    Join Date
    Mar 2009
    Posts
    27
    Rep Power
    0

    Default

    would you please elaborate on that?
    do you mean I have to create a JDialog and then add the GUI frame to it?

    if that is what you mean, I sort of tried it but its not working.

  4. #4
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    6

    Default

    No, you have your JFrame as the first window, the parent. The second window, the child, which blocks the JFrame is a modal JDialog.
    The JDialog, which takes a reference to the JFrame to the constructor as the parent parameter blocks the JFrame.

    Read this tutorial:
    java.sun.com/docs/books/tutorial/uiswing/components/dialog.html

    add the http part. I'm not allowedv to post links,

  5. #5
    Robert_85 is offline Member
    Join Date
    Mar 2009
    Posts
    27
    Rep Power
    0

Similar Threads

  1. how to make a loading bar in jframe
    By arunkumarinfo in forum NetBeans
    Replies: 3
    Last Post: 12-28-2013, 05:45 PM
  2. How to make a modal JFrame?
    By surot in forum New To Java
    Replies: 20
    Last Post: 06-11-2011, 11:31 PM
  3. Help in JFrame
    By kirtesh4u in forum New To Java
    Replies: 2
    Last Post: 11-18-2008, 12:40 AM
  4. help in JFrame
    By kirtesh4u in forum AWT / Swing
    Replies: 1
    Last Post: 11-18-2008, 12:26 AM
  5. jframe
    By amith in forum AWT / Swing
    Replies: 1
    Last Post: 05-15-2008, 10:03 AM

Posting Permissions

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