RequestFocus() and modal dialog

requestFocus() only works when the dialog is visible. How can I achive the same effect when using a modal dialog? Is this possible?

You do this =)
    this.addWindowListener(new java.awt.event.WindowAdapter()
      public void windowOpened(WindowEvent e)
        txtfName.requestFocus();
    });

Similar Messages

  • JavaHelp, Frames and Modal Dialogs...recommendations

    Seen a few posts on this, but no answers.
    I've got help buttons scattered throughout my application for users to get context sensitive help.
    Here's the behavior I'm seeing:
    Scenario 1:
    - Initiate JavaHelp from a Frame
    - Bring up a modal dialog
    - JavaHelp is blocked
    - Click on a help button in my dialog
    - A new JavaHelp window appears
    - Close the dialog
    - The new JavaHelp window disappears
    - The original JavaHelp window is now blank
    - When I try to destroy the original JavaHelp window, a NullPointerException is thrown from the windowClosing method
    Scenario 2:
    - Initiate JavaHelp from a modal dialog
    - Close the dialog
    - JavaHelp disappears
    I really want JavaHelp to work like help in other applications:
    - I want one window to come up and work regardless of dialogs opening and closing
    - I want the user to use the JavaHelp while performing a task
    Is there a solution to this?

    Is SE 6 the only solution?
    Anyone know what the version of Java currently shipping with Mac OS X will support?

  • VI does not float if called while modal dialog is running

    In my program I have Floating VIs that popup if certain conditions are met. These Floating VIs allow the Main VI to continue running, but remain front most so the user knows there is an issue.
    There are also other modal dialogs in the application that could be active when an Floating VI is called in the background. When the Floating VI is called it properly shows up behind the modal dialog and in front of the Main VI.
    The problem is that when the modal dialog is dismissed the Floating VI is no longer floating and appears behind the Main VI. Switching focus between VI's will bring either VI to the front. Changing focus to Windows Explorer (clicking on desktop) then back to LabVIEW restores floating behavior to the Floating VI.
    I've attached a crude example that exhibits this behavior.
    LV 2014 32-bit
    WIndows 7 64-bit
    Attachments:
    HiddenFloatingExample.vi ‏10 KB
    FloatingVI.vi ‏7 KB

    I can't offer a solution, but I can verify that the interaction between floating windows and modal dialogs is "hinky" -- though I haven't noticed the effect that you mention.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • ALV Toolbar on modal dialog screen and toolbar on text edit control

    Hello,
    I have created one container and producing ALV Grid output on a modal dialog screen. i do not want the ALV Toolbar to appear on this screen. How can I hide it ?
    ALso I need to hide some buttons on a Text edit control. How can I hide them ?
    Thanks and rgds,
    Anand

    Hi,
    To exclude some Toolbar functions, please do the below
    DATA:
    lt_toolbar_excl TYPE ui_functions.
      Exclude Some toolbar functions
        APPEND cl_gui_alv_grid=>mc_fc_detail         TO lt_toolbar_excl.
        APPEND cl_gui_alv_grid=>mc_fc_info           TO lt_toolbar_excl.
        APPEND cl_gui_alv_grid=>mc_fc_graph          TO lt_toolbar_excl.
        APPEND cl_gui_alv_grid=>mc_fc_view_crystal   TO lt_toolbar_excl.
        APPEND cl_gui_alv_grid=>mc_fc_loc_delete_row TO lt_toolbar_excl.
        APPEND cl_gui_alv_grid=>mc_fc_loc_append_row TO lt_toolbar_excl.
        APPEND cl_gui_alv_grid=>mc_fc_loc_insert_row TO lt_toolbar_excl.
        APPEND cl_gui_alv_grid=>mc_fc_loc_copy_row   TO lt_toolbar_excl.
        APPEND cl_gui_alv_grid=>mc_fc_loc_undo       TO lt_toolbar_excl.
        APPEND cl_gui_alv_grid=>mc_fc_check          TO lt_toolbar_excl.
        APPEND cl_gui_alv_grid=>mc_fc_refresh        TO lt_toolbar_excl.
    And Pass the lt_toolbar_excl to the ALV object
    Display
      CALL METHOD go_alv_grid->set_table_for_first_display
        EXPORTING
          is_variant           = ls_variant
          is_layout            = ls_alv_lay
          is_print             = ls_print
          i_save               = 'A'
          it_toolbar_excluding = lt_toolbar_excl
        CHANGING
          it_sort              = lt_sort
          it_outtab            = gt_user[]
          it_fieldcatalog      = lt_alv_cat.
    Hope this helps you.
    Thanks,
    Ruthra

  • Modal Dialog different in FF and IE

    Hello,
    i have a report (page 5) with a link column and other columns. the link column starts with dynamic action a modal-dialog. the content of this modal dialog comes from page 200.
    On this page 200 there are some text-fields, check boxes, select-lists. All works fine in FF. The user click on the link, the modal-dialog opens, the user click in the text-fields and can enter the text. After the user click a save-button in the modal dialog, a save-process starts and next the modal dialog closed. Now, the user can click the next link in a other row...
    If i use Internet Explorer 8 the user can open the modal dialog and enter the text. After closing the modal dialog and open with a link on an other row the modal dialog open, but the user can't click in the text-fields. The behavior is like a read-only-field. Only the user click on the label from the text-field, then the user can fill in the text. If the page 5 with the report are submitted after every modal dialog shows then it works also in IE.
    Any idea?
    Best regards,
    Carsten

    I will mark your above post as the solution as you indicate that you were able to fix it.
    If you still have questions then you can click the Undo button next to your reply to remove the solution.

  • SQL 2008 R2: Microsoft SQL Server Management Studio cannot shut down because a modal dialog is active. Close the active dialog and try again

    When starting SQL Server 2008 R2 it hangs , and I cannot exit...so when  trying to logoff to reset I get the following "Microsoft SQL Server Management Studio cannot shut down because a modal dialog is active. Close the active dialog and try again"Any
    ideas?

    Big edit...
    I have 2008 R2 SP2 installed on my Windows 7 Machine which is also fully updated.  The marked answer above is clearly not the solution.
    The fix I had posted before did not work.  It appeared to work temporarily, but now I am back to the same invisible dialogue.  I have not been able to identify any pattern by which this is triggered.  I can have an entire day without this
    issue and then it appears the next.
    The invisible modal dialogue is definitely the connection dialogue.  The only way out is to hit the escape key to close it, but then I am no better off without an ability to connect to a server.  The dialogue is still invisible when I re-open it.
    However, even as I type this post, I have just gotten the dialogue to appear after restarting Management Studio, hitting escape, then clicking connect again.  That same pattern failed just minutes ago numerous times.  Again, I can't find any pattern.
    See you in the clock tower.

  • Modal dialog and new form after click on save do not jump to the list form

    Hey
    I want to open a list new form in a modal dialog. After the user click on the “Save” or “Cancel” button modal dialog close and the user not jump to the list view.
    How can I do this?
    Thanks for help.
    Stefan

    If you are using a URL to open the new form then you can add the following parameter to the URL to redirect them to wherever you wish after the form closes: Source=URLToRedirectTo
    For instance if the URL you were using was:
    http://XXX/Lists/ListName/NewForm.aspx you would add the Source parameter as:
    http://XXX/Lists/ListName/NewForm.aspx?Source=URLToRedirectTo

  • Modal dialog limiting the mouse pointer and blocking all application

    I wanted to create a modal dialog that blocks all application in my desktop. Only password field be present and exits only if correct password is typed. I also wanted to limit the mouse pointer within the window of the modal dialog. Will that be possible? i have read modality feature of Mustang(beta) and notes there that system modality is not included. Can anybody there give me an idea how to do tricks on blocking all applications of the desktop? I will be much grateful to anybody who could solve this problem. Thnx in advance...

    tnx Sarcommand ..i give up on that, i understand the risk if that feature is included..
    all i wanted is to make an internet cafe client/server that blocks the client's pc interaction if log time is reached.blocking only the keyboard and mouse.
    i have seen so many softwares sets the cursor position within the dialog bounding box only with user and password there. though my other application runs the mouse is still captured on the dialog even the dialog lost focus.
    if that would not be possible I'll just send notification to the client, a dialog that does not block any application.
    now, im going to try if the client can do som action whenever the server sends alert if the client java app is not the focus. i will post next time what hapens.but if you tried already, if u dont mind posting it so others could know it also..
    tnx so much Sarcommand..

  • In Unix, main JFrame focus not regained after modal dialog exit.

    Hi all,
    I'm new to this forum so hopefully this is the right place to put this question.
    I have a relatively simple GUI application written in Java 6u20 that involves a main gui window (extends JFrame). Most of the file menu operations result in a modal dialog (either JFileChooser or JOptionPane) being presented to the user.
    The problem is that when running on Unix (HPUX), the process of changing focus to one of these modal dialogs occasionally results in a quick flash of the background terminal window (not necessarily that used to launch the Java), and the process of closing the modal dialogs (by any means, i.e. any dialog button or hitting esc) doesn't always return focus to the main extended JFrame object, sometimes it goes to the terminal window and sometimes just flashes the terminal window before returning to the main JFrame window.
    I think the problem is with the Unix window manager deciding that the main focus should be a terminal window, not my Java application, since the problem occurs in both directions (i.e. focus from main JFrame to modal dialog or vice versa).
    In most cases of JOptionPane, I DO specify that the main extended JFrame object is the parent.
    I've tried multiple things since the problem first occured, including multiple calls to a method which calls the following:
    .toFront();
    .requestFocus();
    .setAlwaysOnTop(true);
    .setVisible(true);
    ..on the main JFrame window (referred to as a public static object)...
    just before and after dialog display, and following selection of any button from the dialogs. This reduced the frequency of the problem, but it always tends to flash the terminal window if not return focus to it completely, and when it occurs (or starts to occur then gets worse) is apparently random! (which makes me think it's an OS issue)
    Any help appreciated thanks,
    Simon
    Self-contained compilable example below which has the same behaviour, but note that the problem DOESN'T occur running on Windows (XP) and that my actual program doesn't use auto-generated code generated by a guibuilder:
    * To change this template, choose Tools | Templates 
    * and open the template in the editor. 
    package example;  
    import javax.swing.JOptionPane;  
    * @author swg 
    public class Main {  
         * @param args the command line arguments 
        public static void main(String[] args) {  
            java.awt.EventQueue.invokeLater(new Runnable() {  
                public void run() {  
                    new NewJFrame().setVisible(true);  
    class NewJFrame extends javax.swing.JFrame {  
        /** Creates new form NewJFrame */ 
        public NewJFrame() {  
            initComponents();  
        /** This method is called from within the constructor to 
         * initialize the form. 
         * WARNING: Do NOT modify this code. The content of this method is 
         * always regenerated by the Form Editor. 
        @SuppressWarnings("unchecked")  
        // <editor-fold defaultstate="collapsed" desc="Generated Code">  
        private void initComponents() {  
            jMenuBar1 = new javax.swing.JMenuBar();  
            jMenu1 = new javax.swing.JMenu();  
            jMenuItem1 = new javax.swing.JMenuItem();  
            jMenu2 = new javax.swing.JMenu();  
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);  
            jMenu1.setText("File");  
            jMenuItem1.setText("jMenuItem1");  
            jMenuItem1.addActionListener(new java.awt.event.ActionListener() {  
                public void actionPerformed(java.awt.event.ActionEvent evt) {  
                    jMenuItem1ActionPerformed(evt);  
            jMenu1.add(jMenuItem1);  
            jMenuBar1.add(jMenu1);  
            jMenu2.setText("Edit");  
            jMenuBar1.add(jMenu2);  
            setJMenuBar(jMenuBar1);  
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());  
            getContentPane().setLayout(layout);  
            layout.setHorizontalGroup(  
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)  
                .addGap(0, 400, Short.MAX_VALUE)  
            layout.setVerticalGroup(  
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)  
                .addGap(0, 279, Short.MAX_VALUE)  
            pack();  
        }// </editor-fold>  
        private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {  
            int result = JOptionPane.showConfirmDialog(this, "hello");  
        // Variables declaration - do not modify  
        private javax.swing.JMenu jMenu1;  
        private javax.swing.JMenu jMenu2;  
        private javax.swing.JMenuBar jMenuBar1;  
        private javax.swing.JMenuItem jMenuItem1;  
        // End of variables declaration  
    }

    It won't comfort you much, but I had similar problems on Solaris 10, and at the time we traked them down to a known bug [6262392|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6262392]. The status of this latter is "Closed, will not fix", although it is not explained why...
    It's probably because the entry is itself related to another, more general, bug [6888200|http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=b6eea0fca217effffffffe82413c8a9fce16?bug_id=6888200], which is still open.
    So it is unclear whether this problem will be worked upon (I suspect that yes) and when (I suspect that... not too soon, as it's been dormant for several years!).
    None of our attempts (+toFront(...)+ etc...) solved the issue either, and they only moderately lowered the frequency of occurrence.
    I left the project since then, but I was said that the workaround mentioned in the first bug entry (see comments) doesn't work, whereas switching to Java Desktop instead of CDE reduced the frequency of the issues (without fixing them completely either) - I don't know whether it's an option on HPUX.
    Edited by: jduprez on Jul 9, 2010 11:29 AM

  • Make modal dialog box "Always on Top"

    i know there has been discussion about Frame always on top etc. but i have a slightly different problem.
    I have a Modal Dialog box which goes to the background when the parent window loses focus and gains it back.
    i am working on java version1.4. So the new methof in 1.5 version is of no use. Also i am working on Windows XP SP1.
    Do i have to make the dialogbox extend OptionPane instead of JDialo, which i am doing rt now?
    but OptionPane comes with a baggage and unnecessary code which i have to implement etc.
    Is there any easier way to solve this issue.
    Thanks
    PM

    This solution works for me under J2SDK v1.4.2_03. If you were to use it on a large scale, you'd probably want to develop a bit more of a formalized framework for it.
            final JFrame test_frame = new JFrame("Test");
            test_frame.getContentPane().setLayout(new BoxLayout(test_frame.getContentPane(), BoxLayout.Y_AXIS));
            JPanel panel = new JPanel(new FlowLayout());
            test_frame.getContentPane().add(panel);
            final JDialog[] modal_dialog = new JDialog[]{null};
            final JDialog d = new JDialog(test_frame, "Bah", true);
            JButton close = new JButton("Close");
            d.getContentPane().add(close);
            close.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    d.setVisible(false);
                    modal_dialog[0] = null;
            FocusListener fl = new FocusAdapter()
                public void focusGained(FocusEvent e)
                    if (modal_dialog[0]!=null)
                        modal_dialog[0].requestFocus();
            test_frame.addFocusListener(fl);
            JButton open = new JButton("Open");
            panel.add(open);
            open.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    modal_dialog[0] = d;
                    d.pack();
                    d.setLocationRelativeTo(test_frame);
                    d.setVisible(true);
            test_frame.pack();
            test_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            AWTUtilities.centerWindow(test_frame, null);
            test_frame.setVisible(true);

  • GUI hangs after it fail to pop up a modal dialog

    Hi everyone! I have a swing application that will pop up a log off confirm dialog (modal) when the user click on the "log off" button. It works fine for about 8 hours. Then when I click on the "log off" button, the dialog never pop up and the GUI is freezed, which means it does not react to user mouse click anymore, like a hidden modal dialog is in front. But actually there is no hidden dialog.
    At the same time, my windows XP freeze also. I cannot even open a folder. Then I kill the winrunner, and the XP is able to open a folder, but my GUI is still freeze. No exception behind and all threads are running. I can use some test script to control the GUI, but somehow it just never react to user click.
    Does anyone encounter the same problem and know the possible reason?
    Thanks!

    Hi motes_19:
    I have noteiced this as well in an application that I have created...however, my app doesn't freeze and the OS still runs (Win 2000). I suspect that your problem might be that you aren using the SwingUtilities.invokedLater() or SwingUtilities.invokeAndWait() methods to update your GUI. I am using them and still having some intermitten problems. Hope this helps you...if you have a solution for me, let me know.
    EH

  • Is there a fix for modal dialogs opening behind palettes -cs6 -osx 10.6.8

    Is there a fix for modal dialogs open behind palettes in
    Photoshop cs6 13.0 (createive cloud update) + OSX 10.6.8 Snow Leopard on MacBook Pro? 
    ( I am using 2 monitors where the second monitor is set to be the menu display.  cs4 does not exhibit this bug. )
    Toggling the Application Frame off improves the hiding 'feature' but this does not include the desired continuous floating in front of palettes in all circumstances.
    An example is Blending Options, then chose Stroke, then chose the Color Picker.  After clicking OK, the Blending Options dialog now sits behind the palettes.  One trick is to click on another app, then back to cs6 to force a window redraw.
    It sure would help me if this could be solved.  I am preparing educational videos and this display bug makes things very troublesome.
    Thanks for any help.  If I find a solution, I will post to this thread so everyone can benefit.

    The setting for the graphics check box Does Not make a difference.  If I have a new document window open, then add a layer, then open the blending options > drop shadow > edit the color > the chooser dialog opens, and immediately both dialog windows drop behind the palettes AND any document windows.
    The same behavior for the Preferences dialog > guides > color.
    The quick workaround is to click another app, then back to CS6.  A real pain, of course.
    It is only a factor when opening a second (child) dialog box.
    Other CS6 apps do work correctly (eg. FW AE)
    I have yet to get a handle on this.  Mac OSX 10.6.8    CS6 13.0  x64
    Thanks for your replies, and the long reply time for me was a vaction away from the office.

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

  • Skillbuilders modal dialog - condition for parent page dialog

    Hi
    When using this awesome plugin, I have a dynamic action on my calling page that deals with the selection from the dialog.
    It uses
    Select type:DOM Object
    DOM Object: document
    Condition: javascript expression
    ($v('P110_PROD_SEARCH') == 'BLAH')
    where the js expression is making sure I run the correct dynamic action, particularly when I have a few buttons on the page invoking different variations of the modal dialog.
    My first action is some javascript that interrogates the value of
    this.data.modalPageCloseValue
    this helps me make decisions in later actions on whether to run some pl/sql, for instance
    In light of a recent question of mine regarding a potential APEX bug (Display item with HTML affected by dynamic action and since we can't put conditions on actions - I was wondering if I could incorporate something into my dynamic action condition to stop the entire dynamic action from executing if modalPageCloseValue is null - but it seems to be out of scope?
    Scott

    Scott,
    You're current condition is:
    $v('P110_PROD_SEARCH') == 'BLAH'Just change that to:
    $v('P110_PROD_SEARCH') == 'BLAH' && this.data.modalPageCloseValueRegards,
    Dan
    blog: http://DanielMcghan.us/
    work: http://SkillBuilders.com/APEX/
    twitter: https://twitter.com/dmcghan

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

Maybe you are looking for