How to finish several modal dialogs by  "OK"-labeled Buttons ?

Hello community !
In my Applet I use some modal dialogs . Each of them should be finished by pressing the "OK"-labeled Button . In my ActionListener class there would be statements like that:
if(labeltest.equals("OK"))
dialog1.dispose();
if(labeltest.equals("OK"))
dialog2.dispose();
if(labeltest.equals("OK"))
dialog3.dispose();
But how to distinguish them ? Is this possible or not ?

Your description of JOptionPane.ShowXxxDialog-Methods is interesting . I haven't known before . My question was how to finish ...I think , I did show it to abstract , why I want to solve the problem this way , but it works . Here are the code sequences for those 3 "OK"-Buttons:
     Button okbutton = new Button();
     Button ok2button = new Button();
     Button ok3button = new Button();
// --------------- create Info-Window (Dialog) -------------------------
// *use okbutton*
     dialog.setSize(600,600);
     dialog.addWindowListener(
            new WindowAdapter()
               public void windowClosing(WindowEvent e)
                dialog.setVisible(false);
     dialog.setVisible(false);
     JPanel p = new JPanel();
     p.setLayout(new BoxLayout(p,BoxLayout.Y_AXIS));
     Label lprodukt = new Label("Product :  ...");
     Label lversion = new Label("Version : ...");
     Label lautor = new Label("Author     :  ...");
     Label llabor = new Label("Department: ...");
     Label lcopyright = new Label("Copyright (c) ...");
     lprodukt.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 18));
     lversion.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 18));
     lautor.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 18));
     llabor.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 18));
     lcopyright.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 18));
//     Button okbutton = new Button();
     okbutton.setFont(new Font("Arial", Font.PLAIN, 20));
     okbutton.setLabel("OK");
     okbutton.addActionListener(new CMeinActionLauscher());
     p.add(lprodukt);
     p.add(lversion);
     p.add(lautor);
     p.add(llabor);
     p.add(lcopyright);
     Panel panel2 = new Panel();
     panel2.setLayout(new FlowLayout());
     panel2.add(okbutton);
     dialog.setLayout(new BorderLayout());
     dialog.add(p,BorderLayout.CENTER);
     dialog.add(panel2,BorderLayout.SOUTH);
     dialog.pack();
     // -------------------- Info-Window End ---------------------------------
// --------------- create Error-Window1 (Dialog) -------------------------
// *use ok2button*
     derror.setSize(400,600);
     derror.addWindowListener(
            new WindowAdapter()
               public void windowClosing(WindowEvent e)
                derror.setVisible(false);
     derror.setVisible(false);
     JPanel ep = new JPanel();
     ep.setLayout(new BoxLayout(ep,BoxLayout.Y_AXIS));
     Label text1 = new Label("       Filetyp has to be  \".ATT\"  !!!");
     text1.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 18));
//     Button ok2button = new Button();
     ok2button.setFont(new Font("Arial", Font.PLAIN, 20));
     ok2button.setLabel("OK");
     ok2button.addActionListener(new CMeinActionLauscher());
     ep.add(text1);
     Panel epanel2 = new Panel();
     epanel2.setLayout(new FlowLayout());
     epanel2.add(ok2button);
     derror.setLayout(new BorderLayout());
     derror.add(ep,BorderLayout.CENTER);
     derror.add(epanel2,BorderLayout.SOUTH);
     derror.pack();
     // -------------------- Error-Window1 End --------------------------------
  // --------------- create Error-Window2 (Dialog) -------------------------
// *use ok3button*
   doperr.setSize(400,600);
     doperr.addWindowListener(
            new WindowAdapter()
               public void windowClosing(WindowEvent e)
                doperr.setVisible(false);
     doperr.setVisible(false);
     JPanel op = new JPanel();
     op.setLayout(new BoxLayout(op,BoxLayout.Y_AXIS));
     JLabel optext1 = new JLabel("Operanderror occured !!!");
     optext1.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 18));
     System.out.println("operror: "+operror.getText());
     operror.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 18));
     JLabel optext2 = new JLabel("Korrektur vom Entwickler anfordern !!!");
     optext2.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 18));
//     Button ok3button = new Button();
     ok3button.setFont(new Font("Arial", Font.PLAIN, 20));
     ok3button.setLabel("OK");
     ok3button.addActionListener(new CMeinActionLauscher());
     op.add(optext1);
     op.add(operror);
     op.add(optext2);
     Panel opanel2 = new Panel();
     opanel2.setLayout(new FlowLayout());
     opanel2.add(ok3button);
     doperr.setLayout(new BorderLayout());
     doperr.add(op,BorderLayout.CENTER);
     doperr.add(opanel2,BorderLayout.SOUTH);
     doperr.pack();
  // -------------------- Error-Window2 End --------------------------------
  class CMeinActionLauscher implements ActionListener
    public void actionPerformed(ActionEvent e)
      String label;
      boolean result = false;
      Object source = e.getSource();
      label = e.getActionCommand();
      System.out.println("label: "+label);
      if(label.equals("Programm beenden"))
         System.exit(0);
      if(label.equals("Öffnen"))
         DateiLaden();
      if(label.equals("Info"))
          dialog.setBounds(450,400,400,260);
          dialog.setVisible(true);
          dialog.pack();
      if(label.equals("Beschreibung Software-Id-Verwaltung"))
//          doku.setBounds(550,350,950,600);
          doku.setBounds(400,350,950,600);
          try
              System.out.println("url: "+url);
              JEditorPane htmlPane = new JEditorPane( url );
              htmlPane.setEditable( false );
              htmlPane.setContentType("text/html");
              htmlPane.putClientProperty(JEditorPane.W3C_LENGTH_UNITS, Boolean.TRUE);
              htmlPane.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 18));
              htmlPane.validate();
              htmlPane.repaint();
              doku.add( new JScrollPane(htmlPane) );
              System.out.println("url: "+url);
          } catch( IOException eio )
                System.err.println( "Error displaying " + url );
          doku.setVisible(true);
//          doku.pack();
      if(label.equals("SYSCON-Kdo erzeugen"))
         KdoErzeugen();
        if (source == ok2button)
            derror.setVisible(false);
            derror.dispose();
        if (source == ok3button)
            doperr.setVisible(false);
            doperr.dispose();
        if (source == okbutton)
            dialog.setVisible(false);
            dialog.dispose();
  }For the ok2button I could use JOptionPane.showMessageDialog but how to do it for th otherones ?

Similar Messages

  • How to dispose the modal dialog box

    hi all
    can any one please tell me how to supress the modal dialog box.
    Means iam triggering the a new pop up (modal dialog box) after this
    when iam click ok or cancel buttons on this modal dialog box it is not returing to
    the screen from where it is tiggering. Can any one tell how to achieve this.
    what r the statements i have to write for this in the PAI.

    HI,
    in PAI u have to write like..
    CASE OK_CODE.
    WHEN 'OK'.
    UR CODE.........
    WHEN 'CANC'.
       SET SCREEN 0.
       LEAVE SCREEN.
    OR
       LEAVE TO SCREEN XXX. " UR CALLING SCREEN NUMBER
    ENDCASE.
    Pls close the thread if the problem is solved and reward to all helpful answers.
    Regards
    SAB

  • Modal dialog missing the close button

    My AI extension (CS6) is set to be a ModalDialog (from the Bundle Manifest Editor UI Window Type).  It displays as a dialog correctly, but there is no close button in the title bar.  Is this something that needs to be done in code or am I missing something else?
    I don't mind adding my own close button in the dialog if I need to, but it seems the title bar close button should be there.

    Modal Dialogs have no close button.
    You need to add it yourself.
    Harbs

  • How can I control modal dialogs in Applescript without a mouse?

    I am trying to use a Griffin PowerMate button to select between two options in an Applescript modal dialog and cannot seem to figure out how to do this. I can set a default button, but I want the user to select between two options (shifting the highlighted button) via the PowerMate. Does anyone have a suggestion?
    I can program the PowerMate to send/emulate a particular keystroke, but I do not know how to make the standard Applescript dialog respond to a keystroke, only a mouse action. I'm trying to create a mouseless interface.
    In short, I want the dialog respond to "Twist to the left and press the button to select A, Twist to the right and press the button to select B." Thoughts?
    Thank you.

    Your System Preferences > Keyboard Shortcuts > Full Keyboard Access preference will need to be set to "all controls", but it also depends on where the particular button is located in the dialog.  The tab key will highlight the buttons from left to right, shift-tab will highlight the buttons from right to left, and the spacebar will "press" the currently highlighted button.  In addition, the escape key will choose the Cancel button (if there is one), and the return key will choose the default button (if a default has been set the button itself will be lit).

  • How to display non modal dialog box in a Dll call from TestStand implemented in visual c

    Dear Jason F.
    Applications Engineer
    National Instruments
    Hello
    I did the same way you told me
    the non modal dialog appeared and
    system hangs and
    giving the error message
    ""SeqEdit.exe-Application Error
    The instruction at �0x047fc5b0� referenced memory at �0x047fc5b0�. The memory could not be �read� ""
    please solve my problem
    and thanks for yours early response
    you can email me at
    [email protected]

    Hi Mkehret,
    Does your dialog have ActiveX controls on it? If your DLL dialog uses ActiveX controls and is not programmed in a certain manner it can hang because of a conflict in the threading model used by the TestStand Engine that is calling into your DLL and the model that is required by the MFC ActiveX Container. If you are using ActiveX controls in your dialog, you need to make special considerations for the threading model MFC dialogs that use ActiveX controls need in order to work properly. The example under \Examples\MFCActiveXContainerDlg illustrates how to appropriately handle this situation as well as explaining why it is necessary.
    Note: The above example displays the dialog as modal, but this is irrelevant to the problem I am describing.
    Again for information on properly creating a dialog class object and displaying it as non-modal refer to the information on MSDN that I referred you to in this post:
    http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=506500000008000000E98A0000&USEARCHCONTEXT_CATEGORY_0=_8_&USEARCHCONTEXT_CATEGORY_S=0&UCATEGORY_0=_8_&UCATEGORY_S=0
    If your dialog does not use ActiveX controls or after trying the programming method illustrated in the "MFCActiveXContainerDlg" example TestStand still hangs when calling your DLL, try calling your DLL from another environment just to make sure whether the DLL works at all. If the DLL works properly when called by another environment (e.g. VB, VC++, LabVIEW, or CVI), please submit a MINIMAL and REPRODUCEABLE example source project for your DLL for us to look at (please exclude all unnecessary code not required to reproduce the specific problem of displaying the dialog, and include all files necessary to build your dll with any
    specific instructions needed to do so).
    Jason F.
    Applications Engineer
    National Instruments
    www.ni.com/ask

  • How to create non-modal dialog box?

    I'm trying to create a non-modal dialog box. The purpose is to show an alarm for the user but should leave the calling VI continuing to run. I have created such a thing -- the problem is that I can't figure out how to get the dialog box to go away! It stops running but the window just hangs around. See the attached VIs and image.
    Thanks in advance for your help,
    Chad
    Attachments:
    alarm_ui.png ‏11 KB
    alarm_ui-2.vi ‏11 KB
    message_to_user.vi ‏11 KB

    Ok, I've attached the files. Thanks for looking at this.
    Chad
    Attachments:
    alarm_ui-2.vi ‏11 KB
    message_to_user.vi ‏11 KB

  • How to make awt modal dialog to NOT appear on top of existing windows

    Hi,
    I am working on a program that displays awt modal dialog box when it needs some action from the user. My problem is that the modal dialog box cann't be top window as there is one VC++ window that needs to be always top window. Another requirement I must satisfay is that there should not be any flickling. I've tried with setAlowaysOnTop(false), dialog.toBack(), transferFocus(), etc but with no avail. Any help will be greatly appreciated. Thank you in advance.

    Note: This thread was originally posted in the Swing forum, but moved to this forum for closer topic alignment.

  • How to create a modal dialog, which I can still interact with document when the dialog is show.

    HI,
        Now, I am developing an automation plugin, and want to create a modal dialog, which I still can interact with document when the dialog is show.
        I find photoshop has some modal dialog have this function, such as the dialog of Customize Proof Condition and the dialog of Color Settings. Are these dialogs not modal dialog?
         Thanks!

    The whole point of a modal dialog is that you cannot interact with other things while it is active.
    And Photoshop does not support plugins accessing the rest of Photoshop while any plugin UI is active.

  • How to open a modal dialog on another modal dialog?

    Hi,
    I am developing a plugin for Acrobat XI. The plugin adds a menu item. On clicking the menu item a dialog is opened.
    The dialog have some text and two buttons. One of the button closes the dilaog and the other button opens another dialog. All the dialogs are modal.
    I am using DialogBox  method to create both dialog boxes.
    I am able to open the first dialog window using the above method (Please refer FirstModalDialog.jpg) but only the components of second dialog is displayed without any window (SecondModalDialog.jpg).
    Can anyone tell me what am I doing wrong??
    Thanks

    I've never seen this effect, but here are a couple of things to try.
    1. Try bypassing the first dialog and just showing the second with the same code already used for that SECOND. (Reason: to test if it is invisible for some other reason unrelated to it being the second dialog).
    2. Drop the dialog code into a freestanding app, make the miminum changes to get it to compile, test. (Reason: to see if this is related to Acrobat, or to dialog handling).

  • How to create a dialog window with no button that opens along with the main window?

    When the main window is open, the dialog window opens up immediately and can be closed by key press. At other times, when the next step, ie: decision, comes to, the another dialog window pops up again and is again closed by key press. Does anyone know how to do? Use the sub-Vi? notification method? occurrence method?
    And another thing: how to create a reusable dialog window with no button so that different messages can be sent to it and it can closed by key press. And how to pass the string to the title of the dialog window programmatically?

    For your functionality (If I understand it right), nothing needs to be in the event structure. Pressing any key just triggers the event, thus finishing the VI (there is no while loop).
    Could you tell me what you mean my "it won't run properly"? Make sure that the front panel of the subVI is closed before starting the main VI. Remember that the subVI is set to "open when called" and "close afterwards if originally closed". So, if you had the panel open already, it won't of course close when finished!
    (Actually, the problems is worse when you have the subVI panel open when starting the main VI. you get a catch22 and labVIEW locks up because (1) the subVI is set to dialog and grabs all attention but (2) it has not been
    called, thus the event cannot be triggered. So don't do that!!!! As a quick workaround, add the modification shown in the attached image to ensure the panel of the subVI is closed.)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    CloseNoButtonDialog.gif ‏3 KB

  • 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

  • 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.

  • How to remove the default icons from the toolbar of modal dialog box screen

    Hello Friends,
    Iam calling a screen from function module using CALL SCREEN statement.
    The screen is of type Modal Dialog Box. I created some input fields and buttons in the screen. When the screen is displayed, I can see the tool bar at the bottom along with the input fields and buttons in the screen.
    These icons are Continue(Enter), Check, Cancel. How can I supress this??
    I mean in my screeen I want only my input fields and buttons but not the default toolbar. How to do that?
    Regards,
    Raju

    Hi Raju,
    Try this...
    First try to capture the F-codes of ur button apppearing on the dialog box and then exclude it from the PF-status by passing it to itab.
    types: begin of tab_type,
            fcode like rsmpe-func,
           end of tab_type.
    data: tab type standard table of tab_type with
                   non-unique default key initial size 10,
          wa_tab type tab_type.
    clear tab.
    move 'DELE' to wa_tab-fcode.
    append wa_tab to tab.
    move 'PRIN' to wa_tab-fcode.
    append wa_tab to tab.
    set pf-status 'STA3' excluding tab.
    Cheers,
    Simha.
    Reward all the helpful answers..

  • How to make a dalog process custom events when blocked by modal dialog

    Hi,
    I would like to understand the way modal dialogs block other dialogs so that I can properly solve an issue I'm having with two modal dialogs, one blocking the other.
    I have an application, netbeans platform based, that opens a JDialog, NewDiskDlg, with it's modal property set to true. This dialog is responsible for starting a thread that will process a given number of files, from time to time, depending on some conditions, this thread will send events to the NewDiskDlg.
    When this thread is started, the NewDiskDlg creates a new JDialog, also with the modal property set to true. Both dialogs have the same parent, the main window. And this works as I expected, the second dialog, ActiveScanningDlg, opens on top of the NewDiskDlg and, until the thread stops, the dialog stays visible.
    When the thread stops an event is sent to this two dialogs signaling that the job has been completed, and here is my problem. The second dialog, the one that is visible when the event arrives, receives the event and executes the dispose() method, releasing control to the NewDiskDlg in the back, but the NewDiskDlg does not receive the event and does not process it correctly.
    I understand the no input can be sent to a blocked window, but does that include calling upon the window's methods?
    I've been looking for some help on this but my search terms are not good enough to provide me with any useful information. I've also read the topic on the focus system that is present in the Java Tutorial but I feel that that is not what I should be looking at.
    The following code is a snippet of the important parts that I described:
    NewDiskDlg has the following methods to process the events
        public void readingStarted(ReadingEvent evt) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    scanningDlg.showCentered();
        public void readingFile(ReadingEvent evt) {
            //DO NOTHING
        public void readingStopped(ReadingEvent evt) {
            Lookup.getDefault().lookup(MediaReader.class).removeListener(this);
            if (!showAgain) {
                dispose();
        public void readingAborted(ReadingEvent evt) {
            JOptionPane.showMessageDialog(this, "", "", JOptionPane.ERROR_MESSAGE);//TODO: i18n on the error messagens
            Lookup.getDefault().lookup(MediaReader.class).removeListener(this);
        }ActiveScanningDlg processes the events like this:
        public void readingStarted(ReadingEvent evt) {
            //DO NOTHING
        public void readingFile(ReadingEvent evt) {
            jpbReadingProgress.setString(evt.getCurrentFileName());
        public void readingStopped(ReadingEvent evt) {
            Lookup.getDefault().lookup(MediaReader.class).removeListener(this);
            dispose();
        public void readingAborted(ReadingEvent evt) {
            readingStopped(evt);
        }This is an example on how the events are sent:
        private void fireReadingFile(ReadingEvent evt) {
            for (ReadingListener l : listeners) {
                l.readingFile(evt);
        }

    Hi,
    You have to check the Tolerance limits set for the following tolerance keys. In case if any where the limit is breached the systems blocks the Invoice as 'R - Invoice verification'. Please check the limits set for all these keys.
    AP - item amount variance (if you have activated the item check)
    DQ and DW - for Quantity variance
    PP - price variance with the order price
    ST - date variance
    VP - Moving average price variance
    Regards,
    Kathir

  • How to customize URL in modal dialog script?

    Hi All,
    I am using JSLink to open Modal dialog, want to customize the url by adding '&DefaultView=Email' to URL in script. How to do this in below script:
    (function () {
    // Create object that have the context information about the field that we want to change it output render
    var pictureFiledContext = {};
    pictureFiledContext.Templates = {};
    pictureFiledContext.Templates.Fields = {
    //"Picture" is the column name.
    "Picture": { "View": pictureFiledTemplate }
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(pictureFiledContext);
    function pictureFiledTemplate(ctx) {
    var url= ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
    var itemID=ctx.CurrentItem.ID;
    var itemTitle=ctx.CurrentItem.Title;
    return "<img alt='"+url+"' src='"+url+"' complete='complete' onclick=\"openModalDialog('EditForm.aspx?ID="+itemID+"','"+itemTitle+"')\" />";
    function openModalDialog(url,title)
    var options = {
    title: "Item-"+title,
    width: 600,
    height: 600,
    url: url
    SP.UI.ModalDialog.showModalDialog(options);
    return false;
    Thanks in advance!

    You should be able to do it like this:
    function openModalDialog(url,title)
    var options = {
    title: "Item-"+title,
    width: 600,
    height: 600,
    url: url + "&DefaultView=Email"
    Brandon Atkinson
    Blog: http://brandonatkinson.blogspot.com

Maybe you are looking for

  • Handling Type in Free Goods Item (IS-OIL)

    Hello, Could anyone give me a suggestion how to enable Handling Type field (VBAP-OIHANTYP) for free goods line item (Item Cat TANN)  in Sales Order? Currently this field was disable and not allow to enter any value. Thank you

  • Can time capsule be use simultaneously as a wireless hard drive and time machine backup?

    Hello, I currently have a macbook pro retina and have about 600 gig of content. I am tired of hauling around an external hard drive with him to hold it all. I was thinking of getting a Time Capsule but wanted to know if it can serve as both an extern

  • Extension does not exist : File - XI - IDOC

    Hello, I have an IDOC MATMAS03 with an extension, so called MATMASA03.ZMATMASX IDX2 - metadata upload done more than once ! OK mapping from file to IDOC: test ok (Name of Interface ZMATX.MATMAS03.ZMATMASX) config: test of communication from file syst

  • "a new version number" for updates

    Hi, in iba2.0 there for updates there is a new field for: "new version number". default is 1.0. it the support it said the number must be higher than in the store. actually I don't see a version number at my book page in the store. however - since it

  • Airport Extreme WEP WPA

    I'm trying to set up my PC lap top to connect to my airport extreme. It wants my WEP or WPA #. How do I find those numbers.