Results 1 to 3 of 3
  1. #1
    Bab
    Bab is offline Member
    Join Date
    Mar 2009
    Posts
    1
    Rep Power
    0

    Default How to create custom Input Dialog

    Hi

    This is Bab, I am developing a Map tool.. I got a problem here.. I just want to creat a dailg box and that has to ask me for the name of the map and once I press the Ok button then it must go..I did this one using two ways.
    1-> JOptionPane.showInputDailog()
    2-> JFace Input Dialog

    In the first one ,I am not able to control the window.. Actually the dialog has to appear only in one condition.. But once it enters to the loop then for every time it is asking for the input data even though it comes out from the loop(My input method is based on onmouseclick())

    if I use the second one it is showing an error like "Invalid access to thread"

    My requirement..

    Create a dailog that should not effect my input window..

  2. #2
    trax is offline Member
    Join Date
    Mar 2009
    Posts
    42
    Rep Power
    0

    Default

    Try this code , it is a input dilaog in jface

    InputDialog dialog = new InputDialog(parent.getShell(),"Dialog Title","Dialog Message",null , null);
    dialog.open();

  3. #3
    vogella is offline Member
    Join Date
    Aug 2009
    Location
    Heidelberg
    Posts
    47
    Rep Power
    0

    Default

    The "invalid access to threads" is usually that you try to update the UI directly.

    Put your update in code similar to the following:

    Java Code:
    new Thread(new Runnable() {
          public void run() {
             while (true) {
                try { Thread.sleep(1000); } catch (Exception e) { }
                Display.getDefault().asyncExec(new Runnable() {
                   public void run() {
                      ... do any work that updates the screen ...
                   }
                }
             }
          }
       }).start();

Similar Threads

  1. Creating a Number Input Dialog in SWT
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-02-2008, 07:53 PM
  2. Input Verification Dialog Demo
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 06-26-2008, 07:43 PM
  3. Creating a dialog to input user/password
    By prfalco in forum New To Java
    Replies: 4
    Last Post: 02-18-2008, 07:03 AM
  4. JOptionPane - input dialog
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-17-2007, 09:09 AM
  5. Multiple Line Input Dialog Box
    By johnt in forum AWT / Swing
    Replies: 2
    Last Post: 05-31-2007, 09:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •