JOptionPane dialog - always toFront

Is there any way to insure that a dialog issued from an application will
always come to front when executed from within an app?
I tried using the toFront() method of frame with mixed results...
If nothing is happening on desktop it seems to work but if I'm doing something
else it doesn't. I need this dialog to grab attention when executed
thanks for any help - JP

If you want the dialog to "stop" the application untill the user interacts in any way with the dialog and press some kind of "Acept" or "Cancel" button mke it modal:
new JDilog(frame_parent, true)
this line makes a modal (it's modal because of the second argument) dialog wich will be allways on top of the Frame frame_parent until it's disposed.
Hope it helps.
Abraham

Similar Messages

  • Custom Runtime Error Dialog Always showing

    Hi,
    (TestStand 2.0.1f1)
    Using the Callback based on the example C:\TestStand\Examples\Callbacks\PostStepRuntimeErrorCallback\ErrorHandlerExample.seq.
    The error dialog always appears. I was expecting from the comment in the Set ErrorReport Flag that the Dialog would not appear again. (Comment: If this flag is set, TestStand does not send a UIMsg_BreakOnRunTimeError event to the GUI. This step sets the flag to prevent the GUI from displaying a runtime error dialog because this callback has already displayed a runtime error dialog to the user.)
    When you use the default Error Reporting, you can check a checkbox so that Dialogbox is not seen again for the same execution. I was expecting the same thing from the SequenceFil
    ePostStepRuntimeError callback.
    Any clues as to whats going on.
    See attached example.
    Regards
    Ray Farmer
    Regards
    Ray Farmer
    Attachments:
    RuntimeError1.seq ‏52 KB

    Hi,
    In the Programmer Help for DisplayRunTimeErrorDialogEx method it says
    "dontShowAgainForExecution Boolean Returns whether the user wants this dialog box to appear again if another run-time error occurs in the current execution. If this value is true, set Execution.RTEOptionForThisExecution to specify what to do on a run-time error for this execution."
    Now I have tried setting each of the RTE Options (except the Display Dialog) to try get the same effect as not using the Callback for runtime errors when it comes to ignoring all further errors. Nothing seems to work as expected. So whats the engine doing extra thats not detailed in the Programmer Help or the examples provided.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • JOptionPane show Message Dialog always on top found a Solution

    just thought of a solution for the age old java problem with message boxes / dialogs / input .
    It's funny when you google it you'll find like a million people asking for a solution but none or very few that gives an answer that works.
    this is probly not a new solution but i came up with this yesterday and thought i would "share".
    dunno why the java developers hasnt made a always on top function for this since there seems to be a very high demand for it.
    this hax will hopefully work at all times.
    hope google will find this thread, i searched for a solution yesterday and found none? which is surprising and im a pro googler too.
    import javax.swing.*;
    public class main{
         public static void main(String args[]){
              JFrame j=new JFrame();
              j.setAlwaysOnTop(true);
              j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              j.setVisible(true);
              j.setVisible(false);
              JOptionPane.showMessageDialog(j,"hi");
              System.exit(0);
    }

    I didn't realize it was an "age old problem." The JOptionPane's showXXX methods just show an ordinary modal dialog. If you want to set the alwaysOnTop property of said dialog then you just need to obtain a reference and call the method in question.
    JOptionPane op = new JOptionPane("hi",JOptionPane.INFORMATION_MESSAGE);
    JDialog dialog = op.createDialog("Message Dialog");
    dialog.setAlwaysOnTop(true); //<-- this line
    dialog.setModal(true);
    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    dialog.setVisible(true);No need for an intermediate frame.

  • In Dual Monitor setup, with Thunderbird not in main monitor, the some dialogs always shows in other monitor

    I have a three monitor set up. I have Thunderbird running in the right monitor. My main monitor is the middle one. Dialogs, such as Spell check, Activity Monitor always show up in the main window (not the one with Thunderbird) in the upper left hand corner.
    It happens on Windows Vista and Windows 7 Professional.
    I have Thunderbird version 24.3.0

    Some dialogs when moved, stay moved. Others do not. The ones that frustrate me are those that are Centered and therefore show up split across my two monitors.

  • Customized KeyboardFocusManager problems with JOptionPane-Dialogs

    Hi,
    I have a problem I'm not able to solve: With Java 1.4.2 unter Linux, as well as all newer Java Versions (1.4, 1.5, 1.6) under Windows, dialogs created by JOptionPane.showXXXDialog do not react to keyboard events like <Tab> any more when using a customized KeyboardFocusManager. Java 1.5 and 1.6 under Linux work fine.
    Here is what I did:
    I have a JFrame and want some customized focus control when navigating through the Frame with <Tab>. Therefore I've implemented a class
    public class EfaFrameFocusManager extends DefaultKeyboardFocusManagereand said in the main JFrame:
    EfaFrameFocusManager myFocusManager = new EfaFrameFocusManager(this,FocusManager.getCurrentKeyboardFocusManager());
    FocusManager.setCurrentKeyboardFocusManager(myFocusManager);The constructor of my EfaFrameFocusManager stores the JFrame (this) and the original KeyboardFocusManager (2nd arg) for later use. Within my own FocusManager, I've implemented the method
    public void processKeyEvent(Component cur, KeyEvent e)which is checking whether the desired Frame (efaFrame) is currently active or not. If it is active, it's performing my customized operations which is working well. If it is not active (e.g. because a dialog created with JOptionPane.showConfirmDialog() is open), it should perform default actions. So I said within processKeyEvent:
    if (!efaFrame.isActive()) { // efaFrame is the previous "this" arg
      fm.processKeyEvent(cur,e); // fm is the previously stored CurrentKeyboardFocusManager
      return;
    }Instead of invoking processKeyEvent on the original KeyboardFocusManager fm, I also tried super.processKeyEvent(cur,e);, but without any change in behavior.
    As I said before, this is working well under Java 1.5 and 1.6 with Linux.
    However, it is not working unter Windows (any Java version I tried, including 1.4, 1.5 and 1.6) and also not unter Linux with Java 1.4. With these combinations, dialogs created by JOptionPane.showXXXDialog(...) do not respond to the <Tab> key. I do see that my own FocusManagers processKeyEvent method is invoked, and I also see that it invokes the one of the original FocusManager, but the Dialog doesn't react.
    What am I doing wrong?
    Nick.

    I have a JFrame and want some customized focus control when navigating
    through the Frame with <Tab>. sounds like you should be doing this via a FocusTraversalPolicy
    http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html#customFocusTraversal

  • Growing a JOptionPane dialog vertically

    I am writing a simple JPanel for use within message dialogs.
    Just wanted to add "more details" functionality really, for error dumps etc.
    I've so far used this with JOptionPane:
         DetailsPanel detailsPanel = new DetailsPanel();
         detailsPanel.setMessage("Some error occurred");
         detailsPanel.setMessageDetails("Error dump details, stack trace, blah blah...");
         JOptionPane.showMessageDialog(frame, detailsPanel, "ERROR", JOptionPane.ERROR_MESSAGE);
    However, when the button is clicked to display the extra details, the dialog doesn't resize to account for the extra text. I'm using a GridBagLayout manager, but previously had a BorderLayout. Neither seem to work. Have tried adding to a frame manually, same effect. Tried explicitly resizing the panel and parent, revaliding, invalidating, repainting blah blah.
    Am I missing something obvious? Thanks for any help. Andy.
    Here is the class:
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    * Displays a string message and allows user to expand "more details" for
    * error output etc.
    * Can be used in conjunction with javax.swing.JOptionPane:
    *           DetailsPanel details = new DetailsPanel();
    *           details.setMessage("Something bad happened");
    *           details.setMessageDetails("Error code 12345 -- system dump, stack trace...");
    *           JOptionPane.showMessageDialog(someParentComponent, details, "ERROR", JOptionPane.ERROR_MESSAGE);
    * @version 1.00 21/05/02
    * @author Andy Carter ([email protected])
    public class DetailsPanel extends JPanel implements ActionListener
         private static final String MORE_DETAILS = "Details >>";
         private static final String LESS_DETAILS = "<< Details";
         private boolean detailsHidden = true; // default
         private JLabel messageLabel; // used to display a message
         private JButton detailsButton; // used to control whether or not "more details" are visible
         private JTextArea detailsTextArea; // used to display "more details" about the message
         private JScrollPane detailsScrollPane; // used to allow scrolling over the text-area
         private JPanel internalPanel; // used for a better layout
         * Default constructor.
         * Sets up...
         public DetailsPanel()
              super();
              /* Set up the controls: */
              messageLabel = new JLabel();
              detailsButton = new JButton(MORE_DETAILS); // because detailsHidden == true
              detailsButton.addActionListener(this);
              detailsTextArea = new JTextArea();
              detailsTextArea.setEditable(false); // user can copy to clipboard but not edit the text
              detailsScrollPane = new JScrollPane();
              detailsScrollPane.setViewportView(detailsTextArea);
              detailsScrollPane.setVisible(false);
              /* Set the layout for and add all the components: */
              setLayout(new GridBagLayout());
              GridBagConstraints constraints = new GridBagConstraints();
              constraints.anchor = GridBagConstraints.WEST;
              constraints.gridx = 0;
              constraints.gridy = 0;
              add(messageLabel, constraints);
              constraints.gridy = 1;
              add(detailsButton, constraints);
              constraints.gridy = 2;
              add(detailsScrollPane, constraints);
         * Sets the message to be displayed.
         * @param message java.lang.String
         public void setMessage(String message)
              messageLabel.setText(message);
         * Gets the message to be displayed.
         * @return java.lang.String
         public String getMessage()
              return messageLabel.getText();
         * Sets the extra details about the message.
         * displayed by
         * @param message java.lang.String
         public void setMessageDetails(String message)
              detailsTextArea.setText(message);
         * Gets the extra details about the message.
         * @return java.lang.String
         public String getMessageDetails()
              return detailsTextArea.getText();
         * Fired when the an action is performed on the "more details" button.
         * Makes any extra details about the message visible.
         public void actionPerformed(ActionEvent e)
              /* Toggle whether or not details are hidden: */
              detailsHidden = !detailsHidden;
              detailsScrollPane.setVisible(!detailsHidden);
              /* Set the text of the button to indicate the current state: */          
              String newButtonText = detailsHidden ? MORE_DETAILS : LESS_DETAILS;
              detailsButton.setText(newButtonText);

    Pass in the java.awt.Window reference in the DetailsPanel constructor. Then, when the user clicks the "Details" button, call window.pack( ). This will make the frame/dialog resize.
    From your code:
    private Window window ;
    public DetailsPanel(JFrame window)
    super();
    this.window = window ;
    String newButtonText = detailsHidden ? MORE_DETAILS : LESS_DETAILS;
    detailsButton.setText(newButtonText);
    window.pack( ) ;
    }

  • Dialog always visible in top ???

    hi,
    i would like to display a dialog not modal, but always visible in top, even when its looses focus and other "nomal" dialogue are displayed, as a "color palette" dialogue or something like that, can you please tell which class is more suitable for this purpose, and if somebody has always coded this kind of dialog, i am interrested, thanks for your help

    Specify the "parent" JFrame when creating the JDialog.

  • Dialog always in front

    Hello,
    how can I create a Dialog, that has always the focus and is always in front until it is closed.
    Greetings from Cologne!
    Marcel!

    You want a modal dialog...see http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Dialog.html
    You can use a constructor that allows you to set modal to true or call setModal(true)

  • Mnemonic in JOptionPane dialogs

    In the dialogs opening with JOptionPane.showConfirmDialog(...) There are mnemonics 'Y' & 'N' set for Yes & No options resp.
    Yes option can be chosen with Alt+Y & No option with Alt+N
    Is there any WorkAround that by just pressing 'Y' option Yes is selected. (like there with option dialogs in windows).

    Here you go ... I have written the code for you ..
    package ramanujam.test;
    import javax.swing.*;
    import java.awt.event.*;
    public class TestKeyOnPane extends JOptionPane implements ActionListener, KeyListener
          * Create Constants for users to get notified of the button clicked
              public static final int YES_BUTTON_PRESSED = 0;
              public static final int NO_BUTTON_PRESSED = 1;
              public static final int CANCEL_BUTTON_PRESSED = 2;
              public static final int OK_BUTTON_PRESSED = 3;
              public static final int CUSTOM_BASE_VALUE = 4;
              private int selectedButtonValue = -1;
              StringBuffer usedMnemonics = null;
              private JButton[] bOptionsX;
          *Inner Action Listener to take care of Property Change Notification
         class PropertyActionListener implements ActionListener
              public void actionPerformed(ActionEvent ae)     {
                   setValue(ae.getSource());
    *private KeyListener to setValue on enter key to the respective value and
    * -1 on exit.
    class PropertyKeyListener extends KeyAdapter
         private JButton[] bInnerObj;
         public PropertyKeyListener(JButton[] bInnerObjParam)
              bInnerObj = bInnerObjParam;
         public void keyPressed(KeyEvent ke)
              int code = ke.getKeyCode();
              /*               if(code == KeyEvent.VK_ENTER)
                                  for(int i=0;i<bInnerObj.length;i++)
                                       if(bInnerObj.hasFocus())
                                            bInnerObj[i].doClick();
                                            break;
              for (int i = 0; i < bInnerObj.length; i++)
                   char cc[] = {(char) code};
                   String str = new String(cc);
                   if (bInnerObj[i].getText().startsWith(str))
                        bInnerObj[i].doClick();
                        break;
         * Constructor - to match that of parent class
         * Creates a MojoActionOptionPane with a test message.
         public TestKeyOnPane()
              this("MojoActionOptionPane Message",PLAIN_MESSAGE,OK_OPTION,null,new Object[]{"OK"},null);
         *Creates a instance of MojoActionOptionPane to display a message using the plain-message  message type
         *and the default options delivered by the UI.
         *@param message - The message to be displayed
         public TestKeyOnPane(Object message)
              this(message,PLAIN_MESSAGE,OK_OPTION,null,new Object[]{"OK"},null);
         *Creates an instance of MojoActionOptionPane to display a message with the specified message
         *type and the default options,
         *@param message The message to be displayed
         *@param messageType The Type of message to be displayed
         public TestKeyOnPane(Object message, int messageType)
              this(message,messageType,OK_OPTION,null,new Object[]{"OK"},null);
         *Creates an instance of MojoActionOptionPane to display a message with the specified message type
         *and options.
         *@param message The message to be displayed
         *@param messageType The Type of message to be displayed      
         *@param optionType The Type of User Action Options to be displayed
         public TestKeyOnPane(Object message, int messageType, int optionType)
              this(message,messageType,optionType,null,new Object[]{"OK"},null);
         *Creates an instance of MojoActionOptionPane to display a message with the specified message type,
         *options, and icon. 
         *@param message The message to be displayed
         *@param messageType The Type of message to be displayed
    *@param optionType The Type of User Action Options to be displayed
         *@param icon The Icon to be displayed on the option pane
         public TestKeyOnPane(Object message, int messageType, int optionType, Icon icon)
    this( message, messageType, optionType, icon,new Object[]{"OK"},null);
         *Creates an instance of MojoActionOptionPane to display a message with the specified message type,
         *icon, and options.
         *@param message The message to be displayed
         *@param messageType The Type of message to be displayed
    *@param optionType The Type of User Action Options to be displayed
         *@param icon The Icon to be displayed on the option pane
         *@param options     A Collection of values from which the user can select     
         public TestKeyOnPane(Object message, int messageType, int optionType, Icon icon, Object[] options)
    this(message, messageType, optionType, icon, options,options[0]);
         *Creates an instance of MojoActionOptionPane to display a message with the specified message type,
         *icon, and options, with the initially-selected option specified. 
         *@param message The message to be displayed
         *@param messageType The Type of message to be displayed
    *@param optionType The Type of User Action Options to be displayed
         *@param icon The Icon to be displayed on the option pane
         *@param options     A Collection of values from which the user can select
         *@param initialValue The Default Selected Value for the OptionPane
         public TestKeyOnPane(Object message, int messageType, int optionType, Icon icon, Object[] options, Object initialValue)
    super(message, messageType,optionType,icon,options,initialValue);
              setOptions(options);
    setInitialValue(initialValue);
         * Event Handler to take care of enter,escape or any other case
         * Here, we check the button clicked, we set the clicked buttons
         * index using the caption of the button.
         * @see setSelectedButtonValue()
         * method.
              public void actionPerformed(ActionEvent ae)
                   String actionCommand = ae.getActionCommand();
                   if(actionCommand.equalsIgnoreCase("OK"))
                        setSelectedButtonValue(OK_BUTTON_PRESSED);
                   else if(actionCommand.equalsIgnoreCase("CANCEL"))
                        setSelectedButtonValue(CANCEL_BUTTON_PRESSED);
                   else if(actionCommand.equalsIgnoreCase("YES"))
                        setSelectedButtonValue(YES_BUTTON_PRESSED);
                   else if(actionCommand.equalsIgnoreCase("NO"))
                        setSelectedButtonValue(NO_BUTTON_PRESSED);
                   else
                        int temp = CUSTOM_BASE_VALUE+findIndexOfCustomButton(actionCommand);
                        setSelectedButtonValue(temp);
         protected int findIndexOfCustomButton(String title)
              for(int i=0;i<options.length; i++)
                   String strTitle = ((JButton)options[i]).getText();
                   if(strTitle.equalsIgnoreCase(title))
                        return i;
              return -1;
         * Read only method that returns an int corresponding to the value of the button
         * clicked by the user
         * @return int The index of the selected button.
         * @see setSelectedButtonValue()
         * If the default YES, NO , CANCEL or OK buttons are used with the OptionPane,
         * the indices for the same defined by the constants in this class are used.
         * the indices 0 to 3 are reserved for the default buttons.
         * To get the indices for the custom buttons, the return value is decided by
         * its index in the options array + a base value 4, that is used to avoid
         * any possible ambiguity with the default button index.
         public int getSelectedButtonValue()
              return this.selectedButtonValue;
    * Invoked when a key has been pressed.
    public void keyPressed(java.awt.event.KeyEvent ke)
              int code = ke.getKeyCode();
              /*               if(code == KeyEvent.VK_ENTER)
                                  for(int i=0;i<bInnerObj.length;i++)
                                       if(bInnerObj[i].hasFocus())
                                            bInnerObj[i].doClick();
                                            break;
              for (int i = 0; i < this.options.length; i++)
                   char cc[] = {(char) code};
                   String str = new String(cc);
                   if (bOptionsX[i].getMnemonic() == code || ((char)bOptionsX[i].getMnemonic()) == Character.toUpperCase(cc[0]))
                        bOptionsX[i].doClick();
                        break;
         * Invoked when a key has been released.
    public void keyReleased(java.awt.event.KeyEvent e) {}
         * Invoked when a key has been typed.
         * This event occurs when a key press is followed by a key release.
    public void keyTyped(java.awt.event.KeyEvent e) {}
         *This method sets the Mnemonics for the buttons
         *@param buttons - Array of JButtons for which mnemonics are to be set
         *@return void
         protected void setMnemonics(JButton[] buttons)
              * 1. Get the button array
              * 2. Check if they are the default buttons.
              * 3. If they are, then set the first character as the mnemonic, since Yes, No, Cancel
              * and OK do not have common first characters.
              * 4. Else, if the buttons are custom defined, then get the first non ambiguous
              * character from the button's text and set that as the mnemonic          
              usedMnemonics = new StringBuffer();     
              int buttonsLen = buttons.length;
              String strArr[] = new String[buttonsLen];
              defaultMnemonicSetter:for(int i=0;i<buttonsLen;i++)
                   strArr[i] = buttons[i].getText();
                   if(strArr[i].equalsIgnoreCase("OK") || strArr[i].equalsIgnoreCase("Cancel") || strArr[i].equalsIgnoreCase("Yes") || strArr[i].equalsIgnoreCase("No"))
                        buttons[i].setMnemonic(strArr[i].charAt(0));
                        usedMnemonics.append(strArr[i].charAt(0));
                   else
                        char charAt0[] = {strArr[i].charAt(0)};
                        String strAt0 = new String(charAt0);
                        customMnemonicSetter :for(int j=0;j<strArr[i].length();j++)
                             char charAt0j[] = {strArr[i].charAt(j)};
                             String strAt0j = new String(charAt0j);
                             if(usedMnemonics.toString().indexOf(strAt0j) == -1)
                                  buttons[i].setMnemonic(charAt0j[0]);
                                  usedMnemonics.append(charAt0j);
                                  break customMnemonicSetter;                     
                             else
                                  continue customMnemonicSetter;
         *method that takes care of Adding actionListeners to
         *the buttons that are created by the OpionPane based on options
         *specified by the user
         *@param options[] - Array of type Object that holds the Button Options
         public void setOptions(Object options[])
              int len = options.length;
              Object optionsCopy[] = new Object[len];
              JButton buttonsCopy[] = new JButton[len];
              bOptionsX = new JButton[len];
              for(int i = 0; i < len; i++)
                   String optionTitle = options[i].toString();
                   JButton bBuff = new JButton(optionTitle);
                   bBuff.addActionListener(this);
                   bBuff.addActionListener(new PropertyActionListener());
                   optionsCopy[i] = bBuff;     
                   buttonsCopy[i] = bBuff;
                   bOptionsX[i] = bBuff;
                   //bBuff.addKeyListener(new PropertyKeyListener(buttonsCopy));
                   bBuff.addKeyListener(this);
              setMnemonics(buttonsCopy);
              buttonsCopy = null;
              super.setOptions(optionsCopy);
              optionsCopy = null;
         * private mutator to set the value of the selected button
         * @param value - the value to be set
         * @see getSelectedButtonValue()
         private void setSelectedButtonValue(int value)
              this.selectedButtonValue = value;

  • How to get handle to JOptionPane dialog

    Hi,
    I'm working on a gui application which can generate dialogs when errors occur.
    The problem I have, is the following :
    Somewhere in the process, we show an info message this way :
    JOptionPane.showMessageDialog((Component)parent, "This request may take up to 30 seconds...");Later on, another thread can generate an error message to inform the user that there was an error while processing the request. In this case, the first info dialog should be removed automatically (in case the user didn't close it yet).
    From the thread, I have access to the parent object which is a JInternalFrame object.
    Is there any way I can access the info dialog from the JInternalFrame object?
    Thanks very much for your help!

    check out [url http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/ProgressMonitor.html]javax.swing.ProgressMonitor which I think would fit your needs better than JOptionPane.
    However, if you still want to use JOptionPane, check out it's [url http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JOptionPane.html]API spec, which includes how to access the JDialog directly (see the bottom of the class description).

  • More and more JOptionPane dialogs

    weirdest problem I've ever had.. so far..
    applet works fine in applet viewer.. and in browser
    thing is.. I have a button to save to database.. works fine.. when saved I used a JOptionPane to show a message with something like "save completed" all works..
    problem starts when you leave the page.. go to another page.. there the applet gets loaded with diffrent parameters.. and then save that one.. now you'll get 2 JOptionPanes.. with the same message..
    go to some other page and save again and you'll get 3.. etc..
    JOptionPane.showMessageDialog(null, "De flowchart is opgeslagen!", "Opgeslagen", JOptionPane.INFORMATION_MESSAGE);that's the optionpane.. gets called when the loop for saving to database is done..
    **EDIT**
    hmm.. this is interesting.. same problem 3 years ago
    http://forum.java.sun.com/thread.jspa?forumID=421&threadID=514751
    Edited by: Nizzle on Nov 27, 2007 2:21 PM

    Hi SLaGFYmanny
    Could you please start a new thread for your question instead of posting in an existing thread?
    Then you can provide more information like your operating system and installed extensions and installed plugins.
    *[[/questions/new start a new thread]]
    *[[/kb/Using+the+Troubleshooting+Information+page]]
    You can try basic steps like these in case of issues with web pages:
    Reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
    *Hold down the Shift key and left-click the Reload button
    *Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    *Press "Command + Shift + R" (Mac)
    Clear the cache and cookies only from websites that cause problems.
    "Clear the Cache":
    *Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox/Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe Mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Do you think JOptionPane dialogs force garbage collection afterwards?

    I ask because I've made a nested static class to implement my own file selection tool; the problem is that each time I call it the old JPanel is being recalled and so the components get re-added to it each time it's called, resulting in n versions of each file for every n times you open it.
    I'm running myDialog.dispose() upon exiting, so is my only option now manual garbage collection? How could I force it to be garbage collected? Because System.gc() seems to have no effect.

    Strictly speaking there is no way to force garbage collection, so, no, JOptionPane will not be doing it.
    You almost certainly have a leak in your code. Post it and we may be able to help.

  • How to set dialog to tofront with out using modal?

    i'm using toFront() method in my application in focusgained & window activated but it is not working on solaris.what to do?

    Prepaid cards are not available in New Zealand since the iTMS isn't available there. The only way you could purchase from the iTunes Music Store would be of someone in a country that has one were to purchase a card in that country, send it to you, and allow you to set up an account using their mailing address.

  • Custom Dialogs - JOptionPane

    Hi Guys,
    I was after a quick bit of advice. I've written a small routine which handles the JOptionPane dialog when a user wants to delete some files/folders from within my app. I originally had a "showConfirmDialog" type dialog, but I also needed a "Yes to All" button too (for multiple selections). In essence its a YES_NO_CANCEL_OPTION - with an added "Yes to All" choice. I couldn't find a YES_YESTOALL_NO_CANCEL option in the "optionType" parameter in the Docs.
    Heres what I've got...
    protected int deleteFileCheck(File theFile) {
    String fileOrFolder;
    fileOrFolder = theFile.isDirectory() ? "folder" : "file";
    Object[] options = {"Yes", "Yes to All", "No", "Cancel"};
    return JOptionPane.showOptionDialog(null,theFile.toString()
    + "\n" + "Are you sure you want to delete this "
    + fileOrFolder + "?",
    "Delete files from this project",
    JOptionPane.DEFAULT_OPTION,
    JOptionPane.WARNING_MESSAGE,
    null, options, options[0]);
    which returns -1 for "close", 0 for "yes", 1 for "yes to all", 3 for "no" and 4 for "cancel". This seems to work okay.
    Is this the best way to do this??
    I'm just double checking really...
    Many thanks in advance.

    Thanks for replying. I'll try to address your questions.
    - Why restrict the design to having only one instance
    of the frame? What purpose or requirement does that
    fulfill?The app has a single JFrame that serves as the main window for the application. It implements an MDI desktop. Since the app is capable of handling multiple documents, there's no need for other instances of the main JFrame.
    You're still free to invoke another instance of the app, but that will be in its own JVM with its own singleton.
    - I think you pointed out your problem without
    realizing it - why is the frame being passed around
    to a bunch of methods? Who controls the frame? The app has many classes that subclass JDialog. JDialog's constructor expects a reference to the Frame or Dialog that owns it. I could use null here, but it's a personal preference to include it if possible.
    The frame controls itself. For example, when the user takes some action that requires adding a new JInternalFrame, the code calls MyMainClass.getMDIDesktop().addInternalFrame() (assuming getMDIDesktop() is left as a static method; if not, the call becomes MyMainClass.getInstance().getMDIDesktop().addInternalFrame()).
    - Should the controller of the frame provide
    it on demand (accessor) instead of handing it off to
    everyone to use for their own purposes? I guess I don't understand how what you're suggesting is substantially different than what I'm proposing. The (singleton) controller of the frame (which happens to be the frame itself) provides a reference (via .getInstance()) to whoever needs it -- rather than passing it explicitly.
    - Who's creating all these dialogs such that they
    need their own reference to the frame - why isn't it
    the same class that controls the frame?The reference is often just to establish parentage, but also to allow various dialogs access to methods to create new internal frames/update existing internal frames/etc.

  • Fronting standard dialogs

    My custom dialogs (derived from JDialog) have a window listener which overrides the windowActivated and windowDeactivated methods. These methods call toFront, and my dialog always stays on top of its owner.
    My problem is how to do something similar with standard dialogs. I often call JOptionPane.showMessageDialog and JColorChooser.showDialog, and they work great, except that they are not fronted when their owners are fronted. These dialogs don't have an addWindowListener method like JDialog, so I can't solve my problem like I do with my custom dialogs. I hope you can give me a hint on how to keep standard dialos fronted.
    Thanks.

    demo:
    import java.awt.*;
    import javax.swing.*;
    public class MyApplet extends JApplet {
        public void init() {
            JTextArea area = new JTextArea();
            for(Component comp = this; comp != null; comp = comp.getParent()) {
                for(Class cls = comp.getClass(); cls != null; cls=cls.getSuperclass()) {
                    area.append(cls.toString());
                    if (cls.getSuperclass() != null)
                        area.append(" --> ");
                area.append("\n");
            getContentPane().add(new JScrollPane(area));
    }

Maybe you are looking for

  • Order By in a Group

    Hi All, I have a drill down report of Product Sales. The top level of the drill down is the Product with total sales for that Product, then when you click on it, it shows a drill down of the Sales for that Product for each different store. In the 'Gr

  • Desktop turns to blue every time I change user

    Hi, I have Yosemite installed on my MacBook Pro late 2013 and every time that I change from one user to other the picture that I had choose for desktop turns back to solid blue. This is quite annoying :-( and it also happened when it had Mavericks on

  • Synchronized???

    I have a question about synchronized. Doesn't synchronized "lock" an object if one thread is using it so multiply threads aren't able use it all at once. import javax.swing.*; import java.awt.*; import java.awt.event.*; import package1.*; class C1 {

  • ViewState Property

    Hi, VB.NET 2013 | ASP.NET 4.5 I have a website and are exporting most of the code into a seperate DLL file and I need to know how to use the ViewState property in a DLL (not Web Form) as a public shared property. Visual Studio keeps saying I need to

  • Add folder in Store business document

    Hi Experts, We have the option to attach PDF, TIF, DOC and XLS files to an accounting document by clicking on services to object icon->Create->Store business documents. A window with a folder-"Accounting documents" comes up, under this folder is ment