DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Volker Held Guest

    Re: JFrame / JDialog issue - Info about Threads?

    Hi Kent,

    i already thought of an additional process/thread, too - but frankly iīm
    not too deep into that, so i really canīt give any advise in that field,
    hopefully Swapnil or somebody else can...

    your option 1) live with it...
    Cīmon - we programmerīs just donīt wanna live with a problem, we can
    solve it so can you ( btw - anybody has life experience with threads? )

    Sorry that i couldnīt help you out...

    Volker

    Kent wrote:
    > Hi Volker / Swapnil,
    >
    > No, a non-modal dialog wouldn't suit my needs. I really don't want the user
    > to interact with the frame that opens the dialog - just the frame that doesn't.
    > Also Volker, your suggestion of disabling controls in the opening frame would
    > be feasible for a smaller application but unfortunately my app is just too
    > big - dialogs being opened from dialogs etc.
    >
    > By the sounds of it it's simply not possible (single thread for UI). So I
    > guess my options are:
    >
    > 1. live with it
    > 2. open second frame in a second process
    >
    > Option 1 is probably what I'll go with but I'm also interested in option
    > 2. My question would be how I can get the two processes to communicate with
    > each other.
    >
    > I know I can start the second process via one of the Runtime.exec() methods
    > but how can I easily communicate between processes? Using the input / output
    > streams of the processes somehow?
    >
    > Thanks,
    > Kent
    >
    >
    > Volker Held <vheld@gwdg.de> wrote:
    >
    >>Hi Kent, Hi Swapnil,
    >>
    >>@ Swapney:
    >>I think kentīs idea was that he blocks one frame but still has access to
    >>

    >
    >>the other - problem is, you have make a modal dialog - i think non-modal
    >>

    >
    >>wouldnīt suit his needs....
    >>
    >>@ Kent:
    >>Iīm using 1.3.1_02 - maybe this issue is adressed in 1.4 but i cannot
    >>tell yet. ( If you have any knowledge about that Swapnil, please tell us.
    >>

    > )
    >
    >>One way to simulate window modal dialogs might be to set all components
    >>

    >
    >>on the "calling" window/frame to enabled = false and when the dialog
    >>closes you have to re-enabled them...
    >>Dunno if thatīs a reasonable idea, but it may be worth a try....
    >>
    >>Volker
    >>
    >>Swapnil wrote:
    >>
    >>>Hi,
    >>>
    >>>It seems you have set the JDialog to Modal using setModal(boolean). Once
    >>>a Modal JDialog is visible it blocks all user events for other windows.
    >>>

    > Swing
    >
    >>>events are dispatched on single thread i.e. Swing is Single Threaded.
    >>>

    > That
    >
    >>>is why once the Modal JDialog captures all events you cannot do anything
    >>>in that particular JVM itself.
    >>> You may try using Non-Modal JDialog if it suits your requirement.
    >>>

    > As
    >
    >>>of JDK 1.3 Non-Modal JDialog allow user to do something in other windows
    >>>but it stays on top always.
    >>>
    >>>Cheers,Swapnil
    >>>
    >>>

    >>

    >




  2. #2
    Swapnil Guest

    Re: JFrame / JDialog issue - Info about Threads?


    Hi Kent,Volker,

    Refered Java version:JDK 1.3.1_02

    I am clear about Kents requirement:
    "No Access to a JFrame if it has a JDialog as a child window."

    I hope you are specifying the JFrame as parent in constructor of your JDialog.

    Some possible solutions/workarounds:
    1. Surely u cannot use Modal JDialog.
    2. Use Non-modal JDialog and consume all events whose source is the Parent
    JFrame or it's sub-components.

    Regards,Swapnil


    Volker Held <vheld@gwdg.de> wrote:
    >Hi Kent,
    >
    >i already thought of an additional process/thread, too - but frankly iīm


    >not too deep into that, so i really canīt give any advise in that field,


    >hopefully Swapnil or somebody else can...
    >
    >your option 1) live with it...
    >Cīmon - we programmerīs just donīt wanna live with a problem, we can
    >solve it so can you ( btw - anybody has life experience with threads?

    )
    >
    >Sorry that i couldnīt help you out...
    >
    >Volker
    >
    >Kent wrote:
    >> Hi Volker / Swapnil,
    >>
    >> No, a non-modal dialog wouldn't suit my needs. I really don't want the

    user
    >> to interact with the frame that opens the dialog - just the frame that

    doesn't.
    >> Also Volker, your suggestion of disabling controls in the opening frame

    would
    >> be feasible for a smaller application but unfortunately my app is just

    too
    >> big - dialogs being opened from dialogs etc.
    >>
    >> By the sounds of it it's simply not possible (single thread for UI). So

    I
    >> guess my options are:
    >>
    >> 1. live with it
    >> 2. open second frame in a second process
    >>
    >> Option 1 is probably what I'll go with but I'm also interested in option
    >> 2. My question would be how I can get the two processes to communicate

    with
    >> each other.
    >>
    >> I know I can start the second process via one of the Runtime.exec() methods
    >> but how can I easily communicate between processes? Using the input /

    output
    >> streams of the processes somehow?
    >>
    >> Thanks,
    >> Kent
    >>
    >>
    >> Volker Held <vheld@gwdg.de> wrote:
    >>
    >>>Hi Kent, Hi Swapnil,
    >>>
    >>>@ Swapney:
    >>>I think kentīs idea was that he blocks one frame but still has access

    to
    >>>

    >>
    >>>the other - problem is, you have make a modal dialog - i think non-modal
    >>>

    >>
    >>>wouldnīt suit his needs....
    >>>
    >>>@ Kent:
    >>>Iīm using 1.3.1_02 - maybe this issue is adressed in 1.4 but i cannot


    >>>tell yet. ( If you have any knowledge about that Swapnil, please tell

    us.
    >>>

    >> )
    >>
    >>>One way to simulate window modal dialogs might be to set all components
    >>>

    >>
    >>>on the "calling" window/frame to enabled = false and when the dialog
    >>>closes you have to re-enabled them...
    >>>Dunno if thatīs a reasonable idea, but it may be worth a try....
    >>>
    >>>Volker
    >>>
    >>>Swapnil wrote:
    >>>
    >>>>Hi,
    >>>>
    >>>>It seems you have set the JDialog to Modal using setModal(boolean). Once
    >>>>a Modal JDialog is visible it blocks all user events for other windows.
    >>>>

    >> Swing
    >>
    >>>>events are dispatched on single thread i.e. Swing is Single Threaded.
    >>>>

    >> That
    >>
    >>>>is why once the Modal JDialog captures all events you cannot do anything
    >>>>in that particular JVM itself.
    >>>> You may try using Non-Modal JDialog if it suits your requirement.
    >>>>

    >> As
    >>
    >>>>of JDK 1.3 Non-Modal JDialog allow user to do something in other windows
    >>>>but it stays on top always.
    >>>>
    >>>>Cheers,Swapnil
    >>>>
    >>>>
    >>>

    >>

    >
    >



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
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links