Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / January 2004

Tip: Looking for answers? Try searching our database.

many JFrames and JDialog modal only for one of them (not all)

Thread view: 
Lukasz Indyk - 22 Jan 2004 21:01 GMT
 I have a swing application that has many frames and dialogs. Is it
possible to make a dialog modal for some frames and non-modal for the
others frames? (the frames are displayed at the same time).
Steve W. Jackson - 22 Jan 2004 21:59 GMT
>:  I have a swing application that has many frames and dialogs. Is it
>:possible to make a dialog modal for some frames and non-modal for the
>:others frames? (the frames are displayed at the same time).

The API docs on Dialog include a description of modeless vs modal at the
top there, which indicates that a modal dialog prevents access to all
other toplevel windows in the application.  This behavior is inherited
by JDialog.  In the Macintosh community, this is known as "application
modal", whereas what you're asking for is known as "document modal."  I
sure would like to see it changed in some way.

= Steve =
Signature

Steve W. Jackson
Montgomery, Alabama

Lee Weiner - 22 Jan 2004 22:58 GMT
>  I have a swing application that has many frames and dialogs. Is it
>possible to make a dialog modal for some frames and non-modal for the
>others frames? (the frames are displayed at the same time).

JDialog inherits a setModal(boolean) method from its superclass.  When you
want to display it modally, use setModal(true).  When you want to display it
non-modally, use setModal(false).

Lee Weiner
lee AT leeweiner DOT org
Lukasz Indyk - 22 Jan 2004 23:36 GMT
>> I have a swing application that has many frames and dialogs. Is it
>>possible to make a dialog modal for some frames and non-modal for the
[quoted text clipped - 6 lines]
> Lee Weiner
> lee AT leeweiner DOT org
but i want to have all frames displayed in the same time and have the
dialog modal for one of them and no modal for the others.
and your solutions works well only when only one frame is displayed.
Andrew Thompson - 22 Jan 2004 23:39 GMT
| >> I have a swing application that has many frames and dialogs.
...
| > JDialog inherits a setModal(boolean) method from its superclass.  When you
| > want to display it modally, use setModal(true).  When you want to display it
| > non-modally, use setModal(false).
...
| but i want to have all frames displayed in the same time and have the
| dialog modal for one of them and no modal for the others.
| and your solutions works well only when only one frame is displayed.

He is correct Lee, try PhySci, you can open
any one of 7 apps, but if you open a modal
dialog in _any one_m then _all_ are locked.

Lukasz.  Look at Steve's answer more closely..

--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
Lukasz Indyk - 23 Jan 2004 00:10 GMT
> | > In article <bupd8r$run$1@flis.man.torun.pl>, Lukasz Indyk
> <dyzma@mat.uni.torun.pl> wrote:
[quoted text clipped - 22 lines]
> * http://www.1point1C.org/ 1.1C - Superluminal!
> * http://www.AThompson.info/andrew/ personal site

from steve's answer i know that the only standard way of displaying
dialog in swing are: system-modal, application-modal and no-modal, and
there is no standard way to get document-modal behaviour.

but i think that it must be possible to use no-modal dialog and force it
to behave like "document-modal" dialog by writing suitable event
listeners or something else. i guess that it should be written using
approach similar to the one used in "Creating Modal Internal Frames"
(http://java.sun.com/developer/JDCTechTips/2001/tt1220.html)

and i don't believe that anybody has never done it in java;)
Andrew Thompson - 23 Jan 2004 01:08 GMT
....
| > ..try PhySci, you can open
| > any one of 7 apps, but if you open a modal
| > dialog in _any one_m then _all_ are locked.
...
| from steve's answer i know that the only standard way of displaying
| dialog in swing are:

Just because something is 'standard',
does not mean it cannot be changed,
or overridden.

| but i think that it must be possible to use no-modal dialog and force it
.....
| (http://java.sun.com/developer/JDCTechTips/2001/tt1220.html)
|
| and i don't believe that anybody has never done it in java;)

Well, so far as I can see, nobody besides
you has suggested it _cannot_ be done,

I was going to put forward that each app
started in an entirely different Thread
might have the ablility to become modally
'blocked' without affecting other apps.

I am less of an expert on threading, so I
will cede to the threading experts if it
would change anything, or you might
have a look into it yourself..

Does the article you linked to give you
any ideas, threaded or otherwise?

I do not have time to look over it
at the moment, but perhaps Steve
or others can advise further..

--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
Steve W. Jackson - 23 Jan 2004 14:58 GMT
>:| Andrew Thompson wrote:
>:....
[quoted text clipped - 40 lines]
>:* http://www.1point1C.org/ 1.1C - Superluminal!
>:* http://www.AThompson.info/andrew/ personal site

It's not going to be solved by threading, that's for certain.  The
information in my earlier response that addressed the "Macintosh
community" was mainly informational, pointing out that Mac developers
lose one form of modality they have in native apps.

If you read the text at the top of the java.awt.Dialog class in the API
docs, it says that modal dialogs block "input to all other toplevel
windows in the application, except for any windows created with the
dialog as their owner."  Putting each JFrame into a separate thread
would still have them in the same application.  In fact, I believe that
each already exists in its own thread (not positive).

= Steve =
Signature

Steve W. Jackson
Montgomery, Alabama

ak - 23 Jan 2004 02:28 GMT
>   I have a swing application that has many frames and dialogs. Is it
> possible to make a dialog modal for some frames and non-modal for the
> others frames? (the frames are displayed at the same time).

look here:
http://www.javaworld.com/javaworld/javatips/jw-javatip89.html

____________

http://reader.imagero.com the best java image reader.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.