Plugin fails to display modal dialog with ActiveX'ed bean

I have first posted this in the ActiveX bridge group, and have gotten no response. Since the plugin group also has posts on modal dialogs, thought this is also correct to post here. Both plugin and ActiveX'ed beans use beans.ocx for display.
I have a bean wrapped as ActiveX with sun.beans.ole.Packager. The bean provides a method, which ultimately will pop up a modal confirm dialog (JOptionPane.showConfirmDialog(.)).
If the method is triggered solely from within the bean, say via a click on a bean's button, all is well.
If the method is triggered from its host (VB form), the
- the call is done on the main thread. The confirm dialog shows, but when I click on one of its buttons, the app hangs.
- If I try to pass the call into the event dispatch thread (SwingUtilities.invokeAndWait(.)), the confirm dialog somewhat pops up, but does not paint completely and the app hangs.
- If I try to pass the call into the event dispatch thread with SwingUtilities.invokeLater(.) all is well, the confirm dialog pops up, I can click on its buttons, etc. but the function returns to VB too early, which is not what I want since I need the answer.
- I have tried the following:
entry method determines it is not on the event dispatch thread.
Tries itself with invokeLater(.), yields the current thread and calls wait(.).
The method invoked later will execute in the event dispatch thread, popup the confirm dialog and when finished will do a notifyAll(.).
Unfortunately, what happens is that the entry thread (the main thread) puts the invokeLater into the event dispatch queue, yields itself and wait()'s. And waits and waits. In the meantime, the dispatch thread will get to the point where it wants to show the confirm dialog, but will then hang. If I time out the wait in the main thread, then the confirm dialog is popped up immediately after the wait finishes with the time-out.
Sooo, this tells me that there is some strange synchronization going on which causes something like a deadlock. Is there any good approach to triggering modal dialogs from a native app hosting the ActiveX'ed bean??
I have found many entries on probs with modal dialogs in the plug-in, which relate to applets. But no solution yet.
Some keywords that I have came across are:
- the event dispatch queue can be flushed and "empty events" can be posted into it. Also, the invokeAndWait(.) will register a "conditional" message pump on the event queue that seems to work until the locking condition is no longer valid. Any experience with these? Any way to manipulate (a) main thread, (b) event dispatch queue, (c) event dispatch thread to resolve the apparent deadlock?
- There seems to be some difference in locking when the parent process is VB/COM as when it is Java. I have the impression that the main thread has some lock until the call made from VB/COM is fully completed and the call stack cleaned up. Can anyone confirm this? And/or suggest a way around it?
Sylvia

Sylvia - I found your posting because I have a similar problem in which a JavaBean wrapped using the Packager needs to call a Visual Basic event subroutine from a thread other than the main thread.
This, I have discovered, is not supported in VB unless you use special thread marshalling calls (not available to the Java bean) or event queuing calls (ditto, afaik).
My point is that this may be related to your problem. Check this Microsnot document on their public support site:
Q196026

Similar Messages

  • Display a MFC Modal Dialog with CListBox in TestStand

    I want to display a MFC Modal Dialog with a CListBox element, but I can't fill the listbox with data.
    Here are some commands of my program:
    SequenceContext seqContext;
    Engine engine;
    seqContext.AttachDispatch(seqContextDisp, FALSE);
    engine.AttachDispatch(seqContext.GetEngine());
    HWND parentHwnd = (HWND)engine.GetAppMainHwnd();
    CSearch_Line_Window_Dialog dlg(CWnd::FromHandle(parentHwnd));
    dlg.m_SearchLineWindow_Listbox.m_hWnd = parentHwnd;
    (without this command I get the error "Debug Assertion Failed", because of ASSERT(::IsWindow(m_hWnd)))
    dlg.m_SearchLineWindow_Listbox.AddString("Hallo");
    dlg.DoModal();
    seqContext = NULL;
    engine = NULL;
    The dialog with the emtpy listbox appears, b
    ut without any text. I tried the same by using NotifyStartOfModalDialogEx and NotifyEndOfModalDialog. The example "MFC_Modal_Dialog" opens only a dialog without elements.
    I hope you can help me to solve my problem.
    Thank you.

    I've about the same problem and tried to implement your solution but can't get it to run. I always receive an assertion failure.
    I try to fill the ComboBox in a dialog with items at runtime. (use VC++ and MFC-DLL)
    the header of my dialog:
    class DlgSelectECU : public CDialog
    public:
    DlgSelectECU(CWnd* pParent = NULL);
    BOOL OnInitDialog();
    //{{AFX_DATA(DlgSelectECU)
    enum { IDD = IDD_DLGSELECTECU_DIALOG };
    CComboBox m_ECUList;
    CStringList m_StringList;
    //}}AFX_DATA
    //{{AFX_VIRTUAL(DlgSelectECU)
    protected:
    virtual void DoDataExchange(CDataExchange*pDX);
    //}}AFX_VIRTUAL
    protected:
    DECLARE_MESSAGE_MAP()
    the implementation of my dialog:
    DlgSelectECU:lgSelectECU(CWnd* pParent /*=NULL*/)
    : CDialog(DlgSelec
    tECU::IDD, pParent)
    //{{AFX_DATA_INIT(DlgSelectECU)
    //}}AFX_DATA_INIT
    BOOL DlgSelectECU:nInitDialog()
    POSITION pos = m_StringList.GetHeadPosition();
    while (pos)
    m_ECUList.AddString(m_StringList.GetNext(pos));
    return true;
    void DlgSelectECU:oDataExchange(CDataExchange* pDX)
    CDialog:oDataExchange(pDX);
    //{{AFX_DATA_MAP(DlgSelectECU)
    DDX_Control(pDX, IDC_COMBO_ECU, m_ECUList);
    //}}AFX_DATA_MAP
    my dll function TestStand calls looks like that:
    EXPORT CALLBACK SelectECU(char ECUs[1024])
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    DlgSelectECU Dlg;
    Dlg.m_StringList.AddTail("ITEM 1");
    if (Dlg.DoModal() == IDOK)
    // do something
    Running the sequence file in TestStand and calling the dll function descriped above causes an assertion failure each time I try to add anything to the StringList. Why? And what am I doing wrong? Is there
    a documentation about how to write dlls with MFC elements
    for use with TestStand using other tools than LabWindows/CVI? Everything I found so far is rather crude.
    Thanks!

  • Trying to make up a Modal Dialog with customized event dispatcher

    Hello everyone.
    I try to make up a ModalDialog class with customized event dispatcher in order to wait an invoker.
    But it fails :-(
    import javafx.event.ActionEvent;
    import javafx.event.Event;
    import javafx.event.EventDispatchChain;
    import javafx.event.EventHandler;
    import javafx.event.EventTarget;
    import javafx.event.EventType;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.layout.BorderPane;
    import javafx.scene.layout.HBox;
    import javafx.stage.Modality;
    import javafx.stage.Stage;
    import javafx.stage.StageStyle;
    import javafx.stage.Window;
    import javafx.stage.WindowEvent;
    import com.sun.javafx.stage.WindowEventDispatcher;
    import java.util.ArrayList;
    public class ModalDialog extends Stage {
      ArrayList<Button> buttons;
      int rc;
      Stage stage;
      Event event;
      EventDispatchChain tail;
      public ModalDialog( Window owner, String title ){
        initModality( Modality.APPLICATION_MODAL );
        initOwner( owner );
        initStyle( StageStyle.UTILITY );
        setTitle( title );
        stage = this;
      public void setContents( Group group, ArrayList<Button> buttons ){
        BorderPane root = new BorderPane();
        Scene scene = new Scene(root);
        setScene(scene);
        root.setCenter( group );
        this.buttons = buttons;
        HBox buttonPane = new HBox();
        buttonPane.setSpacing(10);
        for( int i=0 ; i<buttons.size() ; i++ ){
          buttons.get(i).setOnAction( actionHandler );
        buttonPane.getChildren().setAll( buttons );
        root.setBottom( buttonPane );
      public int show( double screenX, double screenY ){
        setX( screenX ); setY( screenY );
        show();
        MyWindowEventDispatcher dispatcher =  new MyWindowEventDispatcher( stage );
        setEventDispatcher( dispatcher );
        while(true){
          event = dispatcher.dispatchEvent( event, tail );
          EventType<? extends Event> type = event.getEventType();
          if( type==WindowEvent.WINDOW_HIDDEN ){
            break;
        return( rc );
      EventHandler<ActionEvent> actionHandler = new EventHandler<ActionEvent>() {
        public void handle( ActionEvent e ){
          EventTarget src = e.getTarget();
          rc = buttons.indexOf( src );
          stage.hide();
      class MyWindowEventDispatcher extends WindowEventDispatcher {
        public MyWindowEventDispatcher( Window window ){
          super( window );
        public Event dispatchEvent( Event event, EventDispatchChain tail) {
          ModalDialog.this.event = dispatchCapturingEvent( event );
          ModalDialog.this.tail = tail;
          return( event );
    }A sample code to invoke ModalDialog
    import java.util.ArrayList;
    import javax.swing.JOptionPane;
    import javafx.application.Application;
    import javafx.event.EventHandler;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.Label;
    import javafx.stage.Stage;
    import javafx.stage.WindowEvent;
    public class WindowEvent06 extends Application {
      Stage mainStage;
      public void start(Stage stage) throws Exception {
        Group root = new Group();
        Scene scene = new Scene(root);
        stage.setScene(scene);
        stage.setTitle("WindowEvent06");
        mainStage = stage;
        stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
          public void handle(WindowEvent e){
            ModalDialog dialog = new ModalDialog( mainStage, "Question" );
            Button yes = new Button( "Yes" );
            Button no  = new Button( "No" );
            ArrayList<Button> buttons = new ArrayList<>();
            buttons.add(yes); buttons.add(no);
            Label msg = new Label( "Really Exit ?" );
            Group groupInDialog = new Group();
            groupInDialog.getChildren().add( msg );
            dialog.setContents( groupInDialog, buttons );
            int ans = dialog.show( 300, 300 );
            System.out.println("returned from a modal dialog");
            if( ans == 1 ){
              e.consume(); // this blocks window closing
        stage.show();
      public static void main(String[] args) {
        launch(args);
    }

    Hi,
    The logic what you follows is some what in the right direction but need to have some changes.
    What I would say is, first consume the windowClose event. Then open the dialog box and close the parent accordingly.
    So after refactoring your code.
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.Label;
    import javafx.scene.layout.BorderPane;
    import javafx.scene.layout.HBox;
    import javafx.stage.Modality;
    import javafx.stage.Stage;
    import javafx.stage.StageStyle;
    public class ModalDialog extends Stage {
         Stage owner;
         Stage stage;
         BorderPane root;
      public ModalDialog( Stage owner, String title){
        root = new BorderPane();
        stage = this;
        this.owner = owner;
        initModality( Modality.APPLICATION_MODAL );
        initOwner( owner );
        initStyle( StageStyle.UTILITY );
        setTitle( title );
        setContents();
      public void setContents(){
        Scene scene = new Scene(root,150,150);
        setScene(scene);
        Group groupInDialog = new Group();
        groupInDialog.getChildren().add( new Label("Really Exit ?") );
        root.setCenter( groupInDialog );
        Button yes = new Button( "Yes" );
        yes.setOnAction(new EventHandler<ActionEvent>() {
              @Override
              public void handle(ActionEvent paramT) {
                   stage.close(); // Closing the pop up.
                   owner.close(); // Closing the parent stage also.
        Button no  = new Button( "No" );
        no.setOnAction(new EventHandler<ActionEvent>() {
              @Override
              public void handle(ActionEvent paramT) {
                   stage.close(); // Closing the pop up only
        HBox buttonPane = new HBox();
        buttonPane.setSpacing(10);
        buttonPane.getChildren().addAll(yes,no);
        root.setBottom(buttonPane);
        stage.show();
    }And the main class to check this implementation is
    import javafx.application.Application;
    import javafx.event.EventHandler;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.stage.Stage;
    import javafx.stage.WindowEvent;
    public class WindowEvent06 extends Application {
      public void start(final Stage stage) throws Exception {
        Group root = new Group();
        Scene scene = new Scene(root);
        stage.setScene(scene);
        stage.setTitle("WindowEvent06");
        stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
          public void handle(final WindowEvent e){
             e.consume(); // Consuming the event by default.
             new ModalDialog( stage, "Question");
        stage.show();
      public static void main(String[] args) {
        launch(args);
    }I hope the above code will give you some idea what i mean. :)
    Happy Coding !!
    Regards,
    Sai Pradeep Dandem.
    Edited by: Sai Pradeep Dandem on Jan 20, 2012 4:03 AM

  • Java help dialog invoked from modal dialog with webstart

    Hi,
    we have an application where we invoke a Help window from a modal dialog. It works fine if ran from IDE but doesn't work if ran from a webstart loader. The problem is to be able to set decorations (exit/minimize) for this help window but since this window is null (from printouts) it never goes to lines where decorations are set. The help dialog is displayed by calling super.setDisplayed(true) but it is not setting variables "frame" or "dialog" of DefaultHelpBroker class.
    I am sure it doesn't sound very clear but if you had a similar problem with web start messing up something please let me know.
    thanks.
    private static void initHelp()
        ClassLoader loader = HelpFactory.class.getClassLoader();
        try
          URL url = HelpSet.findHelpSet(loader, HELPSETNAME);
          helpSet = new HelpSet(loader, url);
          helpBroker = new DefaultHelpBroker(helpSet)
            public void setActivationWindow(Window window)
              if (window instanceof Dialog)
                Dialog d = (Dialog) window;
                if (d.isModal())
                  super.setActivationWindow(window);
                  return;
              super.setActivationWindow(null);
            public void setDisplayed(boolean b)
              //no exception here and shows dialog with no decorations
              super.setDisplayed(b);
              System.out.println("d: " + dialog);//prints null here
              System.out.println("d: " + frame); //prints null here
              if (b)
                if (dialog != null)//since this is true, it never sets decorations
                  dialog.hide();             
                  dialog.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
                  dialog.show();
          helpBroker.setFont(new Font("Verdana", Font.PLAIN, 12));
          helpListener = new HelpListener(helpBroker);
        catch (HelpSetException e)
          e.printStackTrace();
      }

    sorry guys, i should've posted it either in the web-start or on javahelp forums. I'll do it right now.
    never mind :-)

  • Media Encoder Fails to display file dialog

    PP CS3 3.2
    I have some video and I get media encoder to load properly.
    No matter what settings I select, when I click OK to encode the video the window disappears for a moment, then reappears with no messages and the file and folder dialog never appears.
    I have a fully registered version of CS3 on Windows XP SP2.
    This is awfully frustrating since I am a long time PP 1.5 user and wanted to load up some video and jump right into getting it ready for the web.
    Anyone with a similar problem or advice?

    First thanks to everyone who has gone before me on this issue. I just ran into this problem for the first time.
    I prepared a sequence named "Welcome/Intro" when I tried to use the media encoder I had the same problem discussed here. I do think that at least an error message would have been appropriate here. For the screen to just flicker and return rather than display the "File Dialogue" is really difficult to trouble-shoot. If I hadn't found this post I'd still be baffled. I have used PP for years and have never seen this issue before - I don't recall if I ever read about "forbidden" characters in Sequence Names.
    Additionally because you can re-name the files you are exporting once you get the "File Dialogue" it seem that Adobe PP could allow you to progress to the dialogue screen and then allow the windows "invalid file name" error to handle the issue. Well, thanks to everyone again. I have not up-graded to CS4 - yet. I really would be interested to know how it is handled there - not that I'll ever use the "/" in a sequence name again.

  • Cannot display Crystal Report with ActiveX Viewer

    I am using SmartViewerActivex.asp in a classic ASP website to display Crystal Reports and the report will not load. 
    I get a blank grey screen with only the toolbar showing but able to export out with data intact.
    I am  using CR9, running in Windows Server 2012 R2 IIS 8.5.
    I've already spent about 2 weeks and have not found an answer. Please HELP!

    Unfortunately, no help available. I suspect when CR 9 released in 2002, Win Server 2012 was not even a twinkle in Bill's eye. E.g.; you are looking for CR 9 to be 10+ years forward compatible. In other words, it is not supported on WIN server 2012.
    Possible option is to upgrade to CR XI R2 (v. 11.5). There you have a weak prayer and hope. With luck it may work. Note that CR XI r2 was the last version of CR to include the AcitiveX viewer. And CR XI R2 has been out of support for over 2 years now.
    Best bet: CR SDK for VS .NET or CR SDK for Java. This would mean a new app...
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • Barcode failed to display in PDF with XFDF

    Hi,
    I am a newbie in this forum and if you found my topic should not be posted here,
    please kindly let me know.
    I have a question about online filling data to a PDF and hope someone can help me.
    I am having a XFDF and PDF and data will be filled into PDF online. One of the fields
    on the PDF is a code 3 of 9 (code39) barcode. The PDF has embedded the code39
    font in it but the PDF does not format the text values into barcode form.
    I found an article in web showing how to show barcode on PDF with XFDF
    <field name="Barcode" type="barcode" symbology="pdf417" >
            <value>
                PDF-417 is a "stacked linear" symbology invented by
                Symbol.  The iText library makes it very easy to embed this
                symbology in a PDF file.
            </value>
    </field>
    Must I specify this format in the XFDF file such that the PDF knows the text field is
    a barcode format?
    Should I change the 'symbology="pdf417"'  into 'symbology="code39"' ?
    If you have any experience on this issue, please kindly share it with me.
    Thanks a lot,
    Raymond

    That sounds like an old nVidia display driver bug.
    Is there any possibility you took a Windows Update or something that ''updated'' your display driver to an older WHQL version?
    Perhaps completely removing the driver and getting the very latest one from nVidia.com might be in order.
    -Noel

  • BO fails to display cloned reports with DATE_TIME data in View mode

    Problem: We create a table using Rebean API. The table contains cells displaying DATE_TIME data (Detail). The cellu2019s formula is correct and the Applet shows the data alright. But when in view mode, there stand u201CINPUT_DATE_TIMEu201D text. If we open the report in the Applet and just click the cellu2019s formula without changing anything, the report starts to draw itself properly in view mode too.
    We have to manually touch cloned reports with DATE_TIME values.  Didn't find anything same in the search..
    Can anyone help with this problem?
    Great thanks,
    Oleg

    Hi Oleg,
    It may help if you post the code that you are using to create the block (table) with the DATE_TIME data.
    Please include the code from when you open/create the WebI document up to the point when you save the WebI document.
    Regards,
    Dan

  • Why does Firefox 4 (safe mode) fail to display a gadget with the message "User not signed in", when Firefox 3.6 (including lastest version) does so successfully?

    I attempted to access a Google Docs spreadsheet gadget (Piles of Money) in Firefox 4, both normally and in safe mode. In both cases I get a message saying "User not logged in", a link to log in, and a "throbber" that continues without end.
    I can successfully view this same gadget using Firefox 3.6 without problem (and have done so for over a year on various, latest versions of Firefox).
    I tested both with Firefox 4 and Firefox 3.6 in safe mode (to rule out extensions and other changes). In both cases, this was on Windows XP; I have also had the same behavior (albeit without testing in safe mode) on Windows 7.
    The same behavior occurs when creating a new gadget of this type, although I've not tested this as thoroughly.
    Is this a bug in Google Docs, Firefox 4, or both?
    Note the troubleshooting information is from XP, running Firefox 4 in normal mode.

    *Firefox 4 and later require at least OS X 10.5 and an Intel Mac.
    * http://www.mozilla.com/firefox/4.0/system-requirements/
    * http://www.mozilla.com/firefox/5.0/system-requirements/
    For an unofficial Firefox 4 compatible version (TenFourFox) that runs on PowerPC Macs with OS X 10.4.11 or OS X 10.5.8 you can look at:
    * http://www.floodgap.com/software/tenfourfox/
    If you have an Intel processor then you are out of luck with OS X 10.4
    Firefox 3.6.x (Mac OS X 10.4 and later) can be found here:
    * http://www.mozilla.com/en-US/firefox/all-older.html
    * http://www.mozilla.com/firefox/3.6/system-requirements/

  • Open Modal Dialog in Photoshop (Mac)

    I can't seem to open a modal dialog in Photoshop on the Mac with the CS SDK. The code works fine in InDesign. In Photoshop, the modality is there (the application responds to mouse clicks with a bell) but the window is not visible. Here is my mx:WindowedApplication:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
         <mx:Script>
              <![CDATA[
                   import com.adobe.csxs.types.CSXSWindowType;
                   import mx.core.Window;
                   protected function onClick(event:MouseEvent):void
                        var w:Window = new TestDialog();
                        if (w) {
                             w.type = CSXSWindowType.MODAL_DIALOG;
                             w.resizable = false;
                             w.open();
              ]]>
         </mx:Script>
         <mx:Button x="10" y="10" label="Open Popup" click="onClick(event)"/>
    </mx:WindowedApplication>
    The Window itself is more or less copied from the "MakeSideHeads" sample project:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Window xmlns:mx="http://www.adobe.com/2006/mxml"
                 title="Test"
                 titleAlignment="center"
                 layout="absolute"
                 width="300"
                 height="100"
                 showStatusBar="false">
         <mx:Script>
              <![CDATA[
                   private function myCloseWindow():void{
                        this.close();
              ]]>
         </mx:Script>
         <mx:Canvas width="100%" height="100%" id="TestPanel" backgroundColor="#D2D2D2">
              <mx:VBox verticalAlign="middle" horizontalAlign="center" height="100%" width="100%">
                   <mx:HBox height ="90%" width="100%">
                        <mx:Text width="100%" height="100%" text="Some Text"/>
                   </mx:HBox>
                   <mx:HBox  height = "10%" horizontalAlign="center">
                        <mx:Button id="CloseButton" label="Close" click="myCloseWindow()" />
                   </mx:HBox>
              </mx:VBox>
         </mx:Canvas>
    </mx:Window>
    This seems like quite a significant bug. Or am I missing something?

    Hello,
    I've tested this one and it works.
    main.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <csxs:CSXSWindowedApplication xmlns:csxs="com.adobe.csxs.core.*"
         xmlns:mx="http://www.adobe.com/2006/mxml"
         historyManagementEnabled="false">
         <mx:Script>
              <![CDATA[
                   import com.adobe.csxs.types.CSXSWindowType;
                   import mx.core.Window;
                   import ModalDialog;
                   public function showModal():void
                        var window:Window = new ModalDialog;
                        window.type = CSXSWindowType.MODAL_DIALOG;
                        window.resizable = false;
                        window.open();
              ]]>
         </mx:Script>     
              <mx:Button label="Display Modal Dialog" click="showModal()"/>          
    </csxs:CSXSWindowedApplication>
    The following is the ModalDialog.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Window
         xmlns:mx="http://www.adobe.com/2006/mxml"
         layout="absolute"
         width="300"
         height="200"
         creationComplete="onCreationComplete()"
         title="Modal Dialog"
         >
         <mx:Script>
              <![CDATA[
                   private function onCreationComplete():void
                        //Center the window on the screen
                        var screenBounds:Rectangle = Screen.mainScreen.bounds;
                        nativeWindow.x = (screenBounds.width - nativeWindow.width) / 2;
                        nativeWindow.y = (screenBounds.height - nativeWindow.height) / 2;
              ]]>
         </mx:Script>
         <mx:VBox verticalAlign="middle" textAlign="center" horizontalAlign="center">
              <mx:HBox horizontalAlign="center">
                   <mx:Label text = "This is an example of a modal dialog box."/>
              </mx:HBox>
              <mx:HBox horizontalAlign="center">
                   <mx:Button label = "Close" click="close()"/>
              </mx:HBox>
         </mx:VBox>
    </mx:Window>

  • Displaying a Dialog Without Hiding its Frame

    Hello,
    I'm sure this question has been asked before, but I could not find it using the search engine...
    How can I display a JDialog window without hiding its JFrame?
    Thanks.

    This is a contstructor of the JDialog. I got it from the API. I am not sure if it hides the parent frame but it creates a non-modal JDialog object.
    public JDialog(Frame owner, String title)
    throws HeadlessExceptionCreates
    a non-modal dialog with the specified title and with the specified owner frame. If owner is null, a shared, hidden frame will be set as the owner of the dialog.
    This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale.
    Parameters:
    owner - the Frame from which the dialog is displayed
    title - the String to display in the dialog's title bar

  • How to create modal dialog to suspend menu activity until process completes

    I have a Swing application with several tabs, buttons, and menu items.
    When the user pushes some of the buttons, a background process is kicked off that may take some time to complete.
    When the process is finished, I get notification from a socket that the process has completed.
    I then display a dialog that notifies the user that the process has completed.
    All this is in place.
    What I need to do is to block the user from pushing any other buttons, selecting tabs or menu items while the process is in progress.
    My thought was to display a modal dialog with a message and no buttons to remove it,
    and then have the application dispose the dialog when I get the completion response.
    Is there a way to do this with a JOptionPane or some variant or do I need to create a modal dialog from scratch?
    Any suggestions?

    I was playing around with this a bit and I think it can be done.
    In the main class of my application, I have a variable
    public JFrame mainFrame;
    mainFrame = this.getFrame():
    In the page where I want to disable the application, I have the following:
    parent.mainFrame.setEnabled(false);
    (parent is a reference to the main class)
    When I get a response back from the socket, I can set
    parent.mainFrame.setEnabled(true);
    This seems to do what I want, but the fly in the ointment is that it disables the entire application.
    If I don't get a response, then the application is hung.
    Can't use the "X" button to close the application.
    I think I can work on some refinements from the clues given to make it work.
    Thanks for the feedback.

  • Clicking a frame in the taskbar that has an open modal dialog

    hi guys,
    ive written a small application which openes several dialogs. since i need to pass it to less experienced users who dont know how to use alt+tab (on windows) i have a question:
    if there is an open modal dialog with my frame as owner and it isnt activated / on top of the screen a click onto the taskbar icon (the frame) should bring up the dialog with the frame in the background.
    testing this results in a behaviour i didnt expect - not the modal dialog with the frame in the background pops up but the frame without showing up the dialog.
    since dialogs dont get an entry in the taskbar the 0815-user doesnt know how to get back the dialog. and even worse - he cant do anything anymore (modal dialog..).
    how can i fix that problem?
    thanks in advance

    lol
    got the problem
    i added the owner of the dialog - but in a different class ;)
    my test case was still null

  • Can't have multiple modal dialogs?  What am I doing wrong?

    The following applet is a VERY stripped down version of what I am writing. I have an applet which creates modal dialog in which a user will enter data, then if the user tries to close without saving, I pop up another modal dialog to ask the user to save. Everything is fine that far, then, when the user dismisses that dialog, for example (with Cancel) or pressing the X, things look fine, it goes back to the first modal dialog, but that dialog is no longer modal! I can access the underlying applet. Here is a VERY stripped down version. What am I doing wrong? Help! Thanks!
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.lang.*;
    import java.net.*;
    import javax.help.*;
    import javax.swing.*;
    import java.util.*;
    public class SherlockApplet extends JApplet
         public void init()
         // get root frame of applet
    Component component = this;
    while (component.getParent() != null)
    component = component.getParent();
    Frame appletFrame = (Frame) component;
    // create a modal dialog with the root frame as the parent
    JDialog firstModalDialog = new JDialog(appletFrame);
         firstModalDialog.setModal(true);
         firstModalDialog.setSize(200, 200);
         // create another modal dialog with the first dialog as the parent
         final JDialog secondModalDialog = new JDialog(firstModalDialog);
         secondModalDialog.setModal(true);
         secondModalDialog.setSize(100, 100);
         // add a listener to pop up the second modal dialog when we try to close the first
         firstModalDialog.addWindowListener(
    new WindowAdapter()
    public void windowClosing(WindowEvent e)
    secondModalDialog.show();
    // make sure not to close the first dialog if the user clicks the X
    firstModalDialog.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
         // show the first dialog
         firstModalDialog.show();
    }

    Good call dchsw, I tried 1.4.1_01 jre and it worked. If you run it with 1.3.0_01 jre you will see my problem. The problem for us is, we are stuck with 1.3.0_01 for our next release at least, due to Sun's decision to change event handling for java 1.4 jre and not make it backward compatible. I might have to hack my way around this one. Any other suggestions?
    Thanks

  • Maximize button in a modal dialog

    Dear All,
         I have requirement. I want to show a maximize button in a modal dialog which has the same maximizing functionality of a frame. I find the JDialog which is a secondary window and doesn't have API to add/remove buttons directly to the title bar as in JInternalFrame. I show a table in a popup modal dialog. But when the no of columns is more, the user might find difficult to traverse the table. Instead if the maximize button is there he can maximize the dialog to see all the columns in one shot. So, what all i need is a modal dialog with a maximize button in the title bar. This is quite urgent!. Thanks for any thoughts, ideas or code snippets.
    wbr,
    Srinivasan Samivelu

    Hi Srinivasan,
    Have you got any solution for this.
    If so,please let me know.I am facing similar problem.
    Thanks in advance

Maybe you are looking for