ToFront() for JDialog Re-visited

My JDialog is buried behind other windows on Win2K using JDK 1.4.0. After searching the archives on this subject I tried the suggestions and am still having no luck. Below are my code snippets (which use some suggestions in past posts of this same question).
public class MyDialog extends JDialog implements ActionListener {
// Constructor
public MyDialog(Frame f, Object o, ...) {
     super (f, "MyTitle", true);
     // create and add a panel w/ controls
     // Stuff I tried and commented out when it didn't work
     // f.setState(Frame.ICONIFIED);
     // f.setState(Frame.NORMAL);
     // f.setVisible(true);
     // f.toFront();
     // f.requestFocus();
     // toFront();
     // requestFocus();
The caller code:
Frame f = new Frame();
MyDialog dialog = new MyDialog(f, this, ...);
dialog.pack();
dialog.setLocation(400, 400);
f.setState(Frame.ICONIFIED);
f.setState(Frame.NORMAL);
f.setVisible(true);
f.toFront();
f.requestFocus();
dialog.setVisible(true);
dialog.toFront();
dialog.requestFocus();
Any suggestions would make me a happer camper!!
     

V.V.,
You hit on the 'trick' that I FINALLY figured out--
In my code, the caller was already a JFrame (it was the main window for my GUI app). I passed "this" JFrame in to the JDialog constructor instead of a new JFrame AND used a hack mentioned by a previous kind soul to first set the state of the OWNER to 'iconified' and then to 'normal'.
To help out all past and future askers of this same question, I'll give my code (and basic threading model) that seems to be working (SO FAR, at least) under Windows2000 w/ JDK1.4.0.
1) The main window of the GUI app extends JFrame and is
the creator of a MyDialog object:
public class MainWindow extends JFrame implements ActionListener {
     // lots of variables and methods here
     // etc.
     // etc.
public void showDialog(String s, String s2)
     // Use SwingUtilities.invokeLater() since a
     // different thread (one that listens on a
     // blocked socket) will call this method.
     final String sender = s;
     final String name = s2;
     SwingUtilities.invokeLater(new Runnable()
     public void run()
          // do some parsing, etc.
          // blah, blah.
          // blah
          MyDialog md = new MyDialog(this, this, ...);
     // hack to prevent 'md' from being
          // buried behind other open windows
          // it first iconifies the main win and
          // then de-iconifies it
          this.setVisible(true);
          this.setExtendedState(Frame.ICONIFIED);
          this.setExtendedState(Frame.NORMAL);
          this.toFront();
          this.requestFocus();
          md.pack();
          md.setLocation(400, 400);
          md.setVisible(true);
          // Don't know if the following is
          // redundant and unnecessary... will
          // delete and test later
          md.toFront();
          md.requestFocus();
public class MyDialog extends JDialog implements ActionListener {
     // some variables here before the constructor
     public MyDialog(Frame f, MainWindow win, ...)
     // Make this modal.
     super(f, "My Dialog", true);
     // Now create JPanel and controls...
public actionPerformed(ActionEvent e) {
     // code here for processing actions
My intention was to show how I did finally manage to get a JDialog to popup in front of any and all open
windows and do so in a multi-threaded app.
If anyone has a better solution, I'm all ears!!
Thanks to those to led me this far :)     

Similar Messages

  • On the old firefox there was a botton for recent pages visited - how can i do it now

    on the old firefox there was a botton for recent pages visited - how can i do it now ?

    You can also hold down the left mouse button on an enabled B/F button to open that list.

  • Safari is adding a tab for each page visited--how to stop or clear?

    Safari is adding a tab for each page visited--how to stop or clear?

    Each tab, when selected, has a small x on it for deleting--Apple Store

  • The Delete button is part of the Windows l&f for JDialogs, right?

    When I set the look and feel using
    try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    catch (Exception ex) {
    ex.printStackTrace();
    }on a Windows machine, the components look like Windows components, but the Esc button won't exit my dialogs.
    The API documentation lists these keybindings for JDialog in the Windows L&F:
    JDialog (Win32 L&F)
    Navigate out | Alt+F6
    Retract dialog | Esc
    Activate the default button (if defined) | Enter
    So why doesn't the Esc key retract my dialogs? Is there something else I have to do to enable these keybindings?
    Aaron

    Take a look at the bug report shown below:
    http://developer.java.sun.com/developer/bugParade/bugs/4526059.html
    There is a partial workaround with key mapping but it only works if the escape key is pressed before focus is given to any component in the dialog box.
    V.V.

  • I have to find a time stamp for a website visited from an earlier version of an Iphone, how do i do this?

    basically someone has an old iphone and there was inappropiate websites visited on the phone and i was blamed for it.
    I want to know how to find out the exact time and date these were visited and how they were accessed. and to clear my name as they were instead of looking at how this could have happened, they said i hacked into the phone and used it, when i didnt even know they had thier phone in my house at the time.
    thanks for any answers or help.

    I have managed to find the solution to this problem in another thread. I have copied the response from that thread below.
    The solution that worked was to navigate to the preferences file and delete the plist file as described below.
    Peter Bannon
    RE: My iphoto Library is Empty ????? 
    Sep 12, 2005 1:13 PM (in response to Nic Hard)
    Nic Here are some of the standard fixes I think may help in your case: 4. Your iPhoto preferences file may be corrupted.
    (MAKE SURE you QUIT iPhoto first)
    You will find it in your Home directory:
    (Home/your account) >Library>Preferences>com.apple.iPhoto.plist  Remove or trash the preference (.plist file) and restart iPhoto.  If it still doesn't work go on to these remedies, in order.  5. Bad Album data?
    Old Toad says:
    1 - move the Albums folder and the AlbumData.xml file to the desktop.
    2 - launch iPhoto. It if launches successfully you probably have a corrupt album. To locate the bad "apple", pun intended, do the following: 1 - move one of the individual album folders and it's associated data file into the new Albums folder that was created in the iPhoto Library folder.
    2 - launch iPhoto. If it's successful do the same with the next album folder and data file. If iPhoto doesn't launch successfully, that's a bad one and remove it and the data file.
    3 - repeat for each individual album folder in the old Albums folder. 6. Rebuild Library
    QUIT IPHOTO FIRST
    Relaunch while holding down the key combination below for your version
    Option+Shift IPHOTO 2
    CommandOptionShift IPHOTO 4
    Command+Option IPHOTO 5 

  • How to set maximum bound for JDialog

    Hai..
    I want to resize the JDialog ...but it should particular size ....
    In JFrame ,We will define maximum Size using
    setMaximizedBounds(Rectangle bounds)
    like that i want in JDialog....
    give Solution
    Thanks in Advance....

    What you are asking doesn't make much sense because, setMaximizedBounds() only defines the bounds for the window in the maximized state, not the maximum size you can manually resize. And JDialogs don't have a maximized state. So what you are asking is not possible.
    If you want to restrict manual resizes, then use a component listener and restrict the bounds as it's resized.

  • Hi, My places.sqlite file size is 30,720 KB have I reached the maximum size, is there even a maximum size for this. Visited links are no longer changing color.

    Hi,
    My places.sqlite file size is 30,720 KB have I reached the maximum size, is there even a maximum size for this.
    Suddenly the visited links are no longer changing font color, as I am preparing for an exam I need visited questions to change color, to keep track of questions that I have finished. But if I delete a few days of history then again,a few more visited links change color then again it stops, so it seems something is getting full and not able to accommodate any more? Why are my visited links no longer changing color after a certain number of visits? I do have a back up of the places.sqlite file. So I have tried everything from deleting the profile, uninstalling reinstalling, creating a new profile, then copy pasting places.sqlite etc, but as mentioned after a few visits, visited links no longer change color, if I delete a few days of history then again a few visits will again change color and then stop again, so what should I increase so that my visited links quota is increased, I have also tried tweaking about:config and it has had no result. Although I was not really confident that increasing brower.history_max _pages (don't remember exact name, but I am sure you get the idea) is going to help.
    Seems as though my visited links change color, quota is full and only if I delete a few days of history will I get a few more visited links to change color. Can somebody shed some light? As mentioned my places.sqlite file size is 30,720 KB so I think perhaps this has something to do with this? Would really appreciate if someone could help. Thank you.

    There is no maximum for the places.sqlite database and other SQLite database files like I wrote above.<br />
    All SQLite database file have fixed minimum sizes and if they run out of space they are automatically increased in size with a specific chunk size. For places.sqlite this is 10 MB for the minimum and for the chunk.
    *Bug 581606 - Avoid sqlite fragmentation via SQLITE_FCNTL_CHUNK_SIZE

  • Need BADI for checking customers visiting hours in activity

    Hi all,
    I'm looking for a BAdI where I can check the visiting hours of the related customer in an appointment. I've found BAdI CRM_ACTIVITY_H_BADI but it doesn't give me the data about the related customer.
    I would like to write a message when the time of the appointment is not in range of the customer's visiting hours.
    Does anybody have an idea?
    Thanks,
    Diana

    Hi
    you can do this check while saving in badi ORDER_SAVE. method eg check_befor_save.
    i don't think that in any of documents badis you will have customer no, but you will have docs guid.
    then you can do crm_order_read to read partners.
    Regards
    Radek

  • Website data in advanced settings for websites never visited

    How is it possible for website data to be recorded in advanced settings without visiting a website?  Would other websites visited have to be related content popups?  If the iphone 6 plus was used as a hot spot, can other users actions be recorded on the hot spot phone?  Phone is automatically locked after short time.  This user has visited sites previously on a previous iphone but not the phone in question

    In addition to the server (site) that you navigate to, any inserted material on that site that is actually on another server would also be recorded, including images, embedded videos, ads, and other embedded content. Website data for another device using the phone as a hotspot will not be captured on the phone.

  • Where can I find the Preferences for the Most Visited bookmarks folder on my Bookmarks Toolbar? I want to add more.

    In the past, I was able to add up to 15 bookmarks, but when I downloaded Firefox for my new laptop in January, and moved my files from my old computer, this folder only shows 10, and I can't find where to change it.

    Hi,
    I tried that, but it should be a folder in the toolbar (not a bookmark) that opens with a list of the top visited sites. Currently, it reverted back to 10 from 15 on my old computer after I downloaded Firefox to my new laptop in January and moved my files from my old computer to my laptop.
    When I created a new bookmark as you suggested, it opened up a window (not a list in a folder), and I got this message: Firefox can't find the file at place:redirectsMode=2&sort=8&maxResults=20. However, I'm not looking for a window to open. I already have a "Most Visited" folder with the 10 most-visited sites. I just want to increase the number of sites on the list in that folder.
    Thanks,
    Marsha

  • GUI Update for JDialog/JFileChooser

    Hello, Howdy, Greets, Yo and anything else I missed!
    Lets see if I can explain this well...
    I have a JDialog open in the background. One of the choices on the JDialog is to open the JFileChooser. Whenever I open the JFileChooser the JFileChooser opens in front of the JDialog (like it's supposed to). Therefore there is some overlap of the JFileChooser on top of the JDialog.
    When exiting the JFileChooser (a directory is selected), The JFileChooser GUI partially closes. It closes everywhere but where it overlaps the JDialog. So, for a few seconds it has the GUI of the JFileChooser ONLY where it overlaps the JDialog on the screen. Then after some processing (doing what it does with the JFileChooser data), it finishes removing the JFileChooser GUI that overlaps the JDialog.
    I want the JFileChooser to completely disappear at the same time. I've tried every variation I can think of, to no avail:
    dialog.repaint();
    dialog.validateTree();
    dialog.validate();
    jfc.hide();
    jfc.updateUI();
    jfc.revalidate();
    jfc.repaint();
    Here's an example:
    int choice = jfc.showDialog(new JFrame(), "Select Directory");
    // Tried everything here to hide/remove the jfc GUI
    if (choice == JFileChooser.APPROVE_OPTION )
      // do what it does with the selected directory
    }This happens on every look and feel, so that's probably not the problem. Any ideas?

    Thanks for the advice on threads. I got it working by doing the following...
          int state = jfc.showDialog(new JFrame(), "Select Directory");
          if (state == JFileChooser.APPROVE_OPTION )
            defaultDir = jfc.getSelectedFile();
            Thread myThread=new Thread()
              public void run()
                // Do my other stuff here
            myThread.start();       
          }

  • I like to creat shortcuts on my desktop for daily site visits. I used to be able to select it from my mouse cursur but cannot do it now why?

    If I will be visiting a site on regular basis when I used to hit the right part of my mouse where Back,Reload,Bookmark etc was shown there also was a "Create A Shortcut on Desktop" option. It is not there any longer and want to know how can I get that back?
    I do NOT care for the Bookmark or Save feature.

    My guess is that they recently changed how the videos work. I logged in on my MacBook and the stream worked fine, but it is Flash content in a JW Player video player. From what I see on the website. This video player works with html5 as well as Flash so I'm not sure why it isn't working, unless the site has not updated the content for html5 and is only using Flash right now. But you should get the message on the iPad that the content is in Flash and can't be viewed on the iPad.
    I tried it with three different browsers identifying as mobile and as desktop browsers and I get the same results as you no matter what I do. So my assumption is that the site content was recently changed and it has to be updated. But that is just a guess.
    The message about the website having issues when I used iCab Mobile and identified as a desktop browser. The issue has to be on their end.

  • Calling GUI jar from C++ and setting parent for JDialog

    Hi,
    i am calling a GUI jar from in C++ code using ShellExecuteEx API as follows.
    l_sei->cbSize=sizeof(SHELLEXECUTEINFO);
              l_sei->fMask = SEE_MASK_NOCLOSEPROCESS;
              l_sei->hwnd =l_hwndFound;          
              l_sei->lpVerb = "open";
              l_sei->lpFile = "java";     
              l_sei->lpParameters ="test.jar";
              l_sei->lpDirectory = NULL;
              l_sei->nShow = SW_HIDE;
              l_sei->hInstApp = NULL;
              ShellExecuteEx(l_sei);This GUI opens up from the parent application .
    The problem i am facing is the jar runs as an independent application. I want to set application as the parent window for my GUI.
    The frame is a JDialog. Can i set a parent for a JDialog? So that doing Alt+Tab would not open the GUI on any window other than the parent application.
    thanks.

    Well, you can certainly set a parent for a JDialog (an owner, anyway, since it isn't a "parent" in the GUI hierarchy)... but that won't necessarily make the windows task switch together.
    Now, the real problem is that the "parent" needs to be a Java Dialog or Frame object in the same JRE as the dialog, and in order to get what OS-specific task switching features can be provided by AWT, it needs to be set at the Dialog's creation. Since a JDialog does have a native peer at some level, (although I'm not sure if it actually would be a native dialog window), you might be able to use the Java Invocation API instead of ShellExecuteEx to set up the JAR, watch for the JDialog to be created, and then link its peer through native code... but I don't think there's any easy way to do what you want, since Java windows aren't even supposed to be aware of native ones.

  • How to eliminate Status Bar for JDialog

    Hi,
    I have a Jdialog Box with Status Bar ( Default) which says "Java Applet Window". I want to eliminate that in my App. How can I do that?
    Thanks

    I had the same problem after accessing a remote object via RMI in my GUI. As I needed a SecurityManager anyway, I just added permission java.awt.AWTPermission "showWindowWithoutWarningBanner"; to my policy-file - and the nasty status bar was gone.

  • Make jFrame wait for jDialog to finish

    I am making a project in Netbeans i have a main Frame and some Dialog windows that open up if you press some buttons.
    when one window opens i want the main Frame script to pause and wait for it to complete.
    i have tried 3 different ways:
    questionDialog.setVisible(true);
    while (questionDialog.isVisible()) {
        try {
            Thread.sleep(200);
        } catch (Exception e) {
    } but that shows the frame of the dialog box but never loads the inside and the whole application freezes.
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            questionDialog.setVisible(true);
    while (questionDialog.isVisible()) {
        try {
            Thread.sleep(200);
        } catch (Exception e) {
    }that loaded my Dialog box but the script never waits for it to close i assume it is because it waits until "later" to show the dialog box and in that time it skips the while loop.
    Thread t = new Thread(new Runnable() {
        public void run() {
            questionDialog.setVisible(true);
            while (questionDialog.isVisible()) {
                try {
                    Thread.sleep(200);
                } catch (Exception e) {
    t.start();
    System.out.println("Dialog started");
    System.out.println(questionDialog.isVisible());
    try {
        t.join();
    } catch (Exception e) {
    }but that had the same result as the first code it waited but never showed the dialog.
    where am i going wrong how should i go about this?
    Scott.
    EDIT:
    by finish i mean become not Visible. so isVisible() will return false
    Edited by: ratcateme on Nov 20, 2008 3:02 PM

    You don't have to do anything to do that
    questionDialog.setVisible(true), this method will block the thread, it would't keep going until the questionDialog is unvisible, this is the mistake of the way 1 and way 3.
    and the way 2: the while block will be execute before the questionDialog.setVisible(true) is execute, so questionDialog.isVisible() will return false
    my en is very poor, good luck!

Maybe you are looking for

  • Activity/step in the workflow has a blinking red outline

    Symptom Activity/step blinks red in the diagram, and the workflow goes to the Paused state (default behavior.) The workflow Failed flag is set to Yes (true) which can be seen in an Explorer folder or view containing workflows or in the Home page Inst

  • How to select Oracle Home

    Probably an embarrasingly simple question but nevertheless it has me stuck. I just installed Oracle 11gR1 on a windows server 2008 box and now have both Oracle 10gR2 and Oracle 11gR1 installed. The Oracle Home Selector is no longer available from the

  • How do I empty iTunes cache.. what is a .plist?

    Hi, I am using iTunes v7, I have updated my cover-flow and now I keep getting the spinning beach ball, fairly regularly... about every two minutes, and it will spin for a minute or so before coming back... I have read in the forums that emptying the

  • Message queue updates

    Hi, Using server 2003 R2 service peck 2. We're having a problem with a msmq application that works on a slightly different environment with less wsus updates. i need a list of all the updates related to msmq so i could compare the 2 environment. plea

  • OfficeJet 8600 Pro Unable to Connect to Server for eprint BUT is connected to nework

    Just set up my 8600 and everything connected great until I tried to connect to enable web services on the printer.  It says it is unable to connect to serve and asks if I want to enter a proxy.  I dont understand why it cannot connect to server if my