How to implements a modal message dialog

Hi~~
I am developing a game and I need to show a question dialog .Player can start game after answering this question, but I find it difficult to implement it. Can anyone know how to implement it?
thank..

Look at the API for JOptionPane.showXXXXDialog()

Similar Messages

  • ADF: How to display exceptions on message dialogs

    Hi,
    Is it possible to display error messages and exceptions on message dialog (such as mandatory fields check) or another page instead of the default messages area in the page.
    Regards,
    Ahmad Esbita

    Hi,
    I think you will need to write a custom component to do it.
    When i've used ADF 10.1.2 with Struts i've created a Taglib to generate a javascript alert with error messages.
    You can do the same thing with ADF Faces, if don't have another solution.
    Regards

  • How to display a modal message while processing in a thread.

    I have difficulty in display a modal dialog while in processing in a background.
    I have created the following class.
    package fedex.screen.component;
    import java.awt.*;
    // This infobox is a modal dialog which display static text and stay
    // on screen without blocking proceeding code from execution and can
    // only close by issuing close method.
    public class ProcessInfoBox implements Runnable
         // Display dialog box
         private InfoBox dialog = null;
         // Thread to enable showing of Dialog Box
         private Thread thread = new Thread(this);
         // Determine if to close dialogbox
         private boolean isFinish = false;
         public ProcessInfoBox(Frame frame) {
              dialog = new InfoBox(frame,"Performing Operation","Processing...");
    thread.setPriority(Thread.MAX_PRIORITY);
         public void setTitle(String title) {
              dialog.setTitle(title);
         public void setText(String text) {
              dialog.getMessageLbl().setText(text);
         // The reference return will be ProcessInfoBox.InfoBox
         public InfoBox getInfoBox() {
              return dialog;
         // Thread method
         public void run() {
              dialog.setVisible(true);
              // If true return from thread and exit.
              while ( isFinish == false )
                   try
                        Thread.sleep(500); // 500 msec
                   catch ( InterruptedException e )
         // Start showing dialog
         final public void show() {
              thread.start();
              isFinish = false;
         final public void hide() {
              isFinish = true;
              dialog.setVisible(false);
         // Dialog box which show text.
         public class InfoBox extends Dialog
              private Label messageLbl = new Label("Processing ...");
              public InfoBox(Frame frame, String title, String message) {
                   super(frame,title,true);
                   initInfoBox();
              public Label getMessageLbl() {
                   return messageLbl;
              private void initInfoBox() {
                   setLayout(new BorderLayout());
                   add(messageLbl,BorderLayout.CENTER);
                   setSize(250,150);
    FormUtility.centerForm(this);
         public static void main(String[] args) {
              Frame frame = new Frame("BigMac");
              frame.setSize(600,600);
              frame.setVisible(true);
              ProcessInfoBox box = new ProcessInfoBox(frame);
              box.show();
              for ( int i = 1; i < 10000; i++ )
                   System.out.println(i);
              box.hide();
    To test the code I used the following section to test
    The main method in the class is used. In the simple
    example, the message did correctly update itself while
    i is increment. However, when I try on more complex
    application, the message just stalk there without
    updating itself as it is hanging.
    I have try to set piority to highest but without effect.
    Is there anything to rectify the situation
    thank

    The "please wait" dialog is a modal dialog. When u
    show it, the following code can not executed!
    That's the problem

  • How to implement validations in message mapping?

    Hi experts,
    I have a simple requirement:
    I have a simple synchronous scenario:
    SOAP -> XI -> RFC
    In a message mapping, one of the fields in the source message is of type String.
    However, the target application (RFC) does not expect a non-numeric characters in this string.
    My question is how can I perform the validation in XI and tell the sender that this field contains Non-numeric characters?
    Please help.
    Thanks.
    Ron

    > Ron,
    >
    > >>With a RunTime Exception thrown, how can I tell
    >  the sender an error has occured?
    >
    > Sure. You can do this with out a BPM. You need to
    > configure alerts for this. If you configure ALERTS
    > and SCOTT, this will send an email of the errors
    > occuring in your scenario.
    >
    > For configuring and trouble shooting alerts check
    > these
    >
    > https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/
    > 2327
    > https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/
    > 2328
    >
    > Regards,
    > Jai Shankar
    Hi Jai
    I already have alerts configured.
    But what I had in mind is to send a response to the sender (The sender is waiting for a reply since this is synchronous), instead of telling the sender through an alternative means such as email, sms, etc.
    Is this possible?

  • How to implement Tool TIP in Table Control

    Hello Everyone,
    Can you please tell me how to implement a tooltip messages in table control columns.
    The Tooltip contains a simple message like "Doublde click on column.
    Thanks in advance.
    Edited by: Suruchi Razdan on Jun 6, 2011 7:57 AM

    Hello,
    In table Control->first Header Row has chance to maintain the Tooltip option.
    In table control columns maintain Double click options in attributes .
    Regards,
    Praveen

  • 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 implement select all files (Ctrl-A) in open file dialog??

    I successfully created file open dialog. However, in most windows file open dialog,
    if you press "Ctrl-A," it will select all the files in the directory. If you press "Ctrl"
    key with arrow key, it will highligh the files you want. ie. It allows users to open
    more than one files at the same time. How to implement it in Java??

    For doing this, you have to enable the file multiselection.
    If you have created a JFileChooser as :
    JFileChooser fileChooser = new JFileChooser();
    Add the following statement to set the multiselection property.
    fileChooser.setMultiSelectionEnabled(true);
    Manish.

  • How to make the length of Message Dialog follows the length of text

    Hi all.
    I am making a Message Dialog From JOptionPane because i do not want to use some static methods of JOptionPane (JOptionPane.Show ...)
    My source codes following :
    public static void showMessageDialog(String message) {
              JOptionPane optionPane = new JOptionPane();
              JDialog dialog = optionPane.createDialog(null, "Message");
              optionPane.setMessage(message);
              optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
              JButton btnOk = new JButton("OK");
              optionPane.setOptions(new Object[] { btnOk });
              dialog.setVisible(true);
    }It runs well but having a problem. When message is a long text --> JDialog can not show all text, dialog's length does not resize automatically following message's length.
    Have a the way to make it ? How to solve ?
    Thanks in advance !
    Diego
    Edited by: ThuCT on Feb 1, 2010 3:28 AM

    Add a dialog.pack() call. See SSCCE below.
    i do not want to use some static methods of JOptionPane (JOptionPane.Show ...)Why? In this case the built-in static method handles the size as expected.
    public class TestJOptionPaneSizeAdaptsToMessageLength {
       public static void main(String... args) {
           String message = "This is a very long message, I say long but really it is a very very long one, and when I say long I do mean it!!! ";
           message += message;
           message += message;
           message += message;
           showMessageDialog(message);
    //       showMessageDialogUsingStaticJOptionPaneMethod(message);
       public static void showMessageDialog(String message) {
            JOptionPane optionPane = new JOptionPane();
            JDialog dialog = optionPane.createDialog(null, "Message");
            optionPane.setMessage(message);
            optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
            JButton btnOk = new JButton("OK");
            optionPane.setOptions(new Object[] { btnOk });
            dialog.pack();
            dialog.setVisible(true);
       public static void showMessageDialogUsingStaticJOptionPaneMethod(String message) {
            JOptionPane.showMessageDialog(null, message);
    }Edited by: jduprez on Feb 1, 2010 11:39 AM
    I have to admit, I am a zealous fan of the built-in JOptionPane.showXxx methods :o)

  • How to implement Scroling Messages in Forms 6i

    Dear Friends,
    I have a requirement as stated below.
    I have to fetch data from table and display on the forms as a scroling message ( like messages appearing on the webpage , moving from right to left ) in forms 6i application.
    I dont have any idea about how to implement it iam not sure if it is possible or not
    If you have any idea how to acheive this please suggest me
    Regards,
    Khader

    Write Code in When-New-form instance
    if id_null(create_timer('SCROLL_TIMER', 200, REPEAT)) then
         null;
    end if;
    When-Timer-expired
    DECLARE
         TimerName varchar2(40) := get_application_property(TIMER_NAME);
    BEGIN
         if TimerName = 'SCROLL_TIMER' then
              scroll_view('CNv_SCROLL', 0, mod(get_view_property('CNv_SCROLL', VIEWPORT_Y_POS_ON_CANVAS)+1, 37));
    end if;
    END;
    Create a Stacked CNV_SCROLL on you canvas
    and write any text in CNV_Scroll
    I hope your problem will solve.

  • How to implements the single thread modal?

    how to implement the singlethread modal in servler/jsp?

    Do you mean 'model?' and 'servlet?' and are you referring to the interface with that name? which your servlet class just has to declare that it implements?

  • 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

  • How to change the Button content as CamelCasing in Windows phone 8.1 Message dialog

    This was already raised in
    Stack over flow, While showing the native Message dialog in Windows phone, i cant change the captions as camel case of command buttons. Is this a bug with windows phone 8.1(WinRT) are is there any workaround to fix this issue?
    Sankar

    This isn't recommended and violates the system style.
    If you want a custom dialog you need to use a different control. The MessageDialog always lower cases the buttons to match the system style and is not generally customizable.
    If you use a ContentDialog you can customize it fairly extensively, and it doesn't try to fix the case of its buttons. You'll probably want to create your own ContentDialog class (there's a template under Add.New Item...) with your desired contents, but here's
    a quick content-free example:
    ContentDialog cd = new ContentDialog();
    cd.Title = "My Title";
    cd.PrimaryButtonText = "CoNtInUe";
    cd.SecondaryButtonText = "sToP";
    await cd.ShowAsync();
    Also note that the guidelines
    for message dialogs suggest using clear and specific verbs rather than generic OK/Cancel.

  • How to use Sharepoint Modal Popup loader in Sharepoint-Hosted Apps

    Hi,
    I have a requirement to use a modal popup as loader in SharePoint-Hosted Apps. I have used this like following-
    SP.UI.ModalDialog.showWaitScreenWithNoClose(
    'Please Wait',
    'while we retrieve...',
    '400',
    '600');
    But it does not work if we have "SP.Js" and "SP.runtime.js" included in the page. If we remove the mentioned script, then only modal works, but other functionality related to "Sp.Js" does not work.
    Please let me know if there is any solution for the problem.
    Thanks in Advance.

    Hi,
    Chk out this link also
    http://stackoverflow.com/questions/4015159/using-jquery-to-display-a-modal-please-wait-dialog-box-message
    http://bernado-nguyen-hoan.com/2012/04/23/how-to-close-sharepoint-modal-wait-screen-after-postback-when-page-is-in-dialog-mode/
    http://sharepoint.stackexchange.com/questions/24391/how-do-i-show-a-loading-div-when-opening-a-modal-dialog-from-a-customaction
    http://blog.collabware.com/2012/10/30/tips-tricks-sharepoint-2010-modal-dialogs/
    Thanks
    Jaison A
    http://infomoss.blogspot.in

  • JOptionPane's message dialog over JDialog not recognizing mouse click

    I have a JOptionPane's message dialog like JOptionPane.showMessageDialog() which comes over a JDialog. When I try to click the OK button of this message dialog, nothing is happening. But, Enter key and Escape keys are working on it.
    Can any one give a solution?

    Hi,
    here are the steps how it goes.
    Step 1:
    private void generateMessageDialog(
            String message,
            int messageType,
            String messageTypeText,
            Component parentFrame)
            JOptionPane optionPane = new JOptionPane();
            optionPane.setMessage(message);
            optionPane.setMessageType(messageType);
            JDialog dialog = optionPane.createDialog(parentFrame, 
    messageTypeText);
            dialog.show();
    }If an exception occurs while connecting to my server, this method will be called to generate an error dialog.
    I have another thread which monitors the connection to server every 2500 ms. If the connection is lost, this thread will automatically generates a logon dialog. This dialog is a custom dialog that contains login fields.
    Step 2:
    public void run()
            int previousState = -1;
            while(previousState != CErrorCodes.SESSION_INVALID && previousState != CErrorCodes.NO_CONNECTION_TO_SERVER)
                int currentState = isConnected();
                // Check if a logoff action is pending
                if (currentState == CErrorCodes.REQUEST_SUCCEEDED)
                    if (getClientController().isLogOffPending())
                        break;
                previousState = currentState;
                try
                    sleep(2500);
                catch (InterruptedException e)
                    break;
    // generate the logon  dialog
            getClientController().getLogOnDialog();
    }If step 2 is executed before step 1, then the dialog generated by step 1 will come over the logon dialog generated by step 2. In this case, the ok button of the dialog generated in step 1 will not recognize mouse click. but enter or escape works. Both the dialogs are modal.
    Please let me know if you need furthur info. I look forward for your rep.
    Edited by: MallikMajety on Nov 8, 2007 6:02 AM

  • How to implement WindowLifecycleListener

    I am using JDev 11.1.1.5.
    I am trying to catch browser close event and invoke some action on the server side.
    I read several posts on OTN discussion forums arguing how to do this, but have not been able to find any good solution.
    It seems implementing WindowLifecycleListener may be a good solution, but there is few information for it on internet and I have not succeeded to make it work.
    Here is how I implemented it.
    public class MyWindowLifecycleListener implements WindowLifecycleListener{
      public void processWindowLifecycle(ExternalContext extContext, WindowLifecycleEvent event) {
        if (event.getNewLifecycleState().equals(Window.LifecycleState.CLOSED)){
          System.out.println("Window closed");
    }And in the managed bean,
          RequestContext.getCurrentInstance().getWindowManager().addWindowLifecycleListener(FacesContext.getCurrentInstance().getExternalContext(), new MyWindowLifecycleListener());But nothing happens on window close.
    Does anyone know how can I make it work?
    Regards,
    Kenji

    Thanks for your responses.
    If you find a fool proof way to implement a solution please be so kind and post it here on the forum.Yes, of course, though I have no confidence...
    In PS2-Calling an ActionListener on browser window close using JS eventQueuing a solution using onbeforeunload is introduced.
    Since I basically don't want users to close window by browser's "x" button, I want to show a warning dialog by "return 'some message';" in onbeforeunload, which makes it impossible to determine whether the page will be actually closed or not at the timing of onbeforeunload.
    Thus this is not a good solution for me.
    Thanks,
    Kenji

Maybe you are looking for

  • How can I bend an object to come from behind a page?

    I am trying to take the branch below and give it a "wrap around" effect so it looks like it is coming from behind the background. Very much like this: Are there any tools I could use to take the existing image and give it that appearance or would I h

  • No DVI Output signal from PC

    Hi, recently i bought and HP P2-1394 model PC, first i was using it with a "normal" monitor, VGA PC input without problems, but last week i bought a new TV with HDMI input the problem is that i can;t configure it well, I'm using DVI-HDMI cable. First

  • Target URLs not loading

    Hello everyone. I'm having a strange issue here that's probably going to turn out to be me just overlooking something really obvious in my HTML ... but anyway, if you can view the link below in your browser, you will see my live test site. Only two o

  • Dynamic Multiple Branching in GP

    Is it possible to dynamically branch out to multiple segment of process. Thanks, Samir

  • Photo resizing and publishing

    I think I know the answer but want to be sure. If I drag a photo file to a page and publish it is automatically resized correct? I just don't mean just in dimensions but also as to file size and resolution. I have many files that are large tiff files