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

Similar Messages

  • Problems with 'background' JFrame focus when adding a modal JDialog

    Hi all,
    I'm trying to add a modal JDialog to my JFrame (to be used for data entry), although I'm having issues with the JFrame 'focus'. Basically, at the moment my program launches the JFrame and JDialog (on program load) fine. But then - if I switch to another program (say, my browser) and then I try switching back to my program, it only shows the JDialog and the main JFrame is nowhere to be seen.
    In many ways the functionality I'm looking for is that of Notepad: when you open the Find/Replace box (albeit it isn't modal), you can switch to another program, and then when you switch back to Notepad both the main frame and 'JDialog'-esque box is still showing.
    I've been trying to get this to work for a couple of hours but can't seem to. The closest I have got is to add a WindowFocusListener to my JDialog and I hide it via setVisible(false) once windowLostFocus() is fired (then my plan was to implement a similar functionality in my JFrame class - albeit with windowGainedFocus - to show the JDialog again, i.e. once the user switches back to the program). Unfortunately this doesn't seem to work; I can't seem to get any window or window focus listeners to actually fire any methods, in fact?
    I hope that kind of makes sense lol. In short I'm looking for Notepad CTRL+R esque functionality, albeit with a modal box. As for a 'short' code listing:
    Main.java
    // Not all of these required for the code excerpt of course.
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.GraphicsEnvironment;
    import java.awt.Rectangle;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.ComponentAdapter;
    import java.awt.event.ComponentEvent;
    import java.awt.event.FocusEvent;
    import java.awt.event.FocusListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.awt.event.WindowFocusListener;
    import java.awt.event.WindowListener;
    import java.beans.PropertyChangeEvent;
    import java.beans.PropertyChangeListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JSplitPane;
    import javax.swing.UIManager;
    import javax.swing.plaf.basic.BasicSplitPaneDivider;
    import javax.swing.plaf.basic.BasicSplitPaneUI;
    public class Main extends JFrame implements ActionListener, WindowFocusListener, WindowListener, FocusListener {
         static JFrame frame;
         private static int programWidth;
         private static int programHeight;
         private static int minimumProgramWidth = 700;
         private static int minimumProgramHeight = 550;
         public static SetupProject setupProjectDialog;
         public Main() {
              // Setup the overall GUI of the program
         private static void createSetupProjectDialog() {
              // Now open the 'Setup Your Project' dialog box
              // !!! Naturally this wouldn't auto-open on load if the user has already created a project
              setupProjectDialog = new SetupProject( frame, "Create Your Website Project", true );
              // Okay, for this we want it to be (say) 70% of the progamWidth/height, OR *slightly* (-25px) smaller than the minimum size of 700/550
              // Change (base on programWidth/Height) then setLocation
              int currProgramWidth = getProgramWidth();
              int currProgramHeight = getProgramHeight();
              int possibleWidth = (int) (currProgramWidth * 0.7);
              int possibleHeight = (int) (currProgramHeight * 0.7);
              // Set the size and location of the JDialog as needed
              if( (possibleWidth > (minimumProgramWidth-25)) && (possibleHeight > (minimumProgramHeight-25)) ) {
                   setupProjectDialog.setPreferredSize( new Dimension(possibleWidth,possibleHeight) );
                   setupProjectDialog.setLocation( ((currProgramWidth/2)-(possibleWidth/2)), ((currProgramHeight/2)-(possibleHeight/2)) );
               else {
                   setupProjectDialog.setPreferredSize( new Dimension( (minimumProgramWidth-25), (minimumProgramHeight-25)) );
                   setupProjectDialog.setLocation( ((currProgramWidth/2)-((minimumProgramWidth-25)/2)), ((currProgramHeight/2)-((minimumProgramHeight-25)/2)) );
              setupProjectDialog.setResizable(false);
              setupProjectDialog.toFront();
              setupProjectDialog.pack();
              setupProjectDialog.setVisible(true);
         public static void main ( String[] args ) {
              Main frame = new Main();
              frame.pack();
              frame.setVisible(true);
              createSetupProjectDialog();
            // None of these get fired when the Jframe is switched to. I also tried a ComponentListener, but had no joy there either.
         public void windowGainedFocus(WindowEvent e) {
              System.out.println("Gained");
              setupProjectDialog.setVisible(true);
         public void windowLostFocus(WindowEvent e) {
              System.out.println("GainedLost");
         public void windowOpened(WindowEvent e) {
              System.out.println("YAY1!");
         public void windowClosing(WindowEvent e) {
              System.out.println("YAY2!");
         public void windowClosed(WindowEvent e) {
              System.out.println("YAY3!");
         public void windowIconified(WindowEvent e) {
              System.out.println("YAY4!");
         public void windowDeiconified(WindowEvent e) {
              System.out.println("YAY5!");
         public void windowActivated(WindowEvent e) {
              System.out.println("YAY6!");
         public void windowDeactivated(WindowEvent e) {
              System.out.println("YAY7!");
         public void focusGained(FocusEvent e) {
              System.out.println("YAY8!");
         public void focusLost(FocusEvent e) {
              System.out.println("YAY9!");
    SetupProject.java
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowEvent;
    import java.awt.event.WindowFocusListener;
    import java.awt.event.WindowListener;
    import java.io.IOException;
    import java.net.URL;
    import javax.imageio.ImageIO;
    import javax.swing.JDialog;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    public class SetupProject extends JDialog implements ActionListener {
         public SetupProject( final JFrame frame, String title, boolean modal ) {
              // Setup the JDialog
              super( frame, title, modal );
              setDefaultCloseOperation( JDialog.DISPOSE_ON_CLOSE );
              // Bad code. Is only temporary
              add( new JLabel("This is a test.") );
              // !!! TESTING
              addWindowFocusListener( new WindowFocusListener() {
                   public void windowGainedFocus(WindowEvent e) {
                        // Naturally this now doesn't get called after the setVisible(false) call below
                   public void windowLostFocus(WindowEvent e) {
                        System.out.println("Lost");
                        setVisible(false); // Doing this sort of thing since frame.someMethod() always fires a null pointer exception?!
    }Any help would be very much greatly appreciated.
    Thanks!
    Tristan

    Hi,
    Many thanks for the reply. Isn't that what I'm doing with the super() call though?
    As in, in Main.java I'm doing:
    setupProjectDialog = new SetupProject( frame, "Create Your Website Project", true );Then the constructor in SetupProject is:
    public SetupProject( final JFrame frame, String title, boolean modal ) {
              // Setup the JDialog
              super( frame, title, modal );
              And isn't the super call (since the class extends JDialog) essentially like doing new JDialog(frame,title,modal)?
    If not, that would make sense due to the null pointer exception errors I've been getting. Although I did think I'd done it right hence am confused as to the right way to handle this,if so.
    Thanks,
    Tristan
    Edited by: 802573 on 20-Oct-2010 08:27

  • Window Loses Focus After Modal Dialog is Dismissed

    hi,
    I need a JDialog to be opened when i click on a button in JFrame.and it should be modal so that user must not get control to its parent window and rest of the windows can be accessed.
    So, i tried setting property like setModalityType(Dialog.ModalityType.DOCUMENT_MODAL), but still unable to access all the windows not only its parent until the dialog gets closed.
    Another issue i was facing is when i close out the dialog i need to get the parent to Front of other windows in application. But in my case it was not happening.After closing the dialog, i am getting the last focussed window to front but not its parent. I tried calling getParent().toFront() in windowClosing() Listener of that dialog, But still not able to solve the problem.
    Hope someone understands my problems and give me solution.
    Hoping for quick response and thanks in advance.

    shrikanthhyd wrote:
    I need a JDialog to be opened when i click on a button in JFrame.and it should be modal so that user must not get control to its parent window and rest of the windows can be accessed.
    So, i tried setting property like setModalityType(Dialog.ModalityType.DOCUMENT_MODAL), but still unable to access all the windows not only its parent until the dialog gets closed.Perhaps you can fix this by calling the first dialog either without a parent or not as a JDialog but rather as a JFrame. Then the second dialog's modality will not impinge on the visibility of the original parent window. For instance:
    import java.awt.Dimension;
    import java.awt.Window;
    import java.awt.Dialog.ModalityType;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JDialog;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.SwingUtilities;
    class SwingFu2
        private JPanel mainPanel = new JPanel();
        public SwingFu2()
            mainPanel.setPreferredSize(new Dimension(400, 400));
            JButton showDlg1Btn = new JButton("Show Dialog 1");
            showDlg1Btn.addActionListener(new ActionListener()
                @Override
                public void actionPerformed(ActionEvent e)
                    showDlg1Action(e);
            mainPanel.add(showDlg1Btn);
        private void showDlg1Action(ActionEvent e)
            Window frame = SwingUtilities.getWindowAncestor((JButton)e.getSource());
            JPanel dlg1Panel = new JPanel();
            dlg1Panel.setPreferredSize(new Dimension(300, 300));
            JButton showDlg2Btn = new JButton("Show Dialog 2");
            showDlg2Btn.addActionListener(new ActionListener()
                @Override
                public void actionPerformed(ActionEvent e)
                    showDlg2Action(e);
            dlg1Panel.add(showDlg2Btn);
            //JDialog dialog1 = new JDialog(null, "Dialog 1", ModalityType.MODELESS); // either of these will work
            JFrame dialog1 = new JFrame("Dialog 1");  // either of these will work
            dialog1.getContentPane().add(dlg1Panel);
            dialog1.pack();
            dialog1.setLocationRelativeTo(null);
            dialog1.setVisible(true);
        private void showDlg2Action(ActionEvent e)
            Window window = SwingUtilities.getWindowAncestor((JButton)e.getSource());
            JPanel dlg2Panel = new JPanel();
            dlg2Panel.setPreferredSize(new Dimension(200, 200));
            JButton showDlg2Btn = new JButton("Show Dialog 2");
            showDlg2Btn.addActionListener(new ActionListener()
                @Override
                public void actionPerformed(ActionEvent e)
                    showDlg2Action(e);
            dlg2Panel.add(showDlg2Btn);
            JDialog dialog2 = new JDialog(window, "Dialog 2", ModalityType.DOCUMENT_MODAL);
            dialog2.getContentPane().add(dlg2Panel);
            dialog2.pack();
            dialog2.setLocationRelativeTo(null);
            dialog2.setVisible(true);
        public JPanel getMainPanel()
            return mainPanel;
        private static void createAndShowUI()
            JFrame frame = new JFrame("SwingFu2");
            frame.getContentPane().add(new SwingFu2().getMainPanel());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        public static void main(String[] args)
            java.awt.EventQueue.invokeLater(new Runnable()
                public void run()
                    createAndShowUI();
    Another issue i was facing I don't know on this one. Good luck.

  • Focus Problem -- Two Non Modal Dialogs

    Hi ,
    In my applet, when user does something which is not allowed, I display an error message box (JOptionPane dialog - modal).
    There is another dialog box (non modal) that user
    can open to view search results and put it aside the
    applet window to do some parallel work.
    Now when error message dialog appears, the search
    dialog box also pops up even if the user
    has put this behind the applet window (by clicking browser window or applet, the search dialog goes behind the window).
    Can you please let me know, how can I get rid
    of this search dialog (non-modal) popup. I mean
    search dialog should remain open but should not
    come infront (ie should not get focus) when modal
    error message dialog pops up.
    NOTE: I don't want to make search dialog
    a modal dialog.
    Thanx,
    [email protected]

    Thanks for the reply michael. I forgot to mention particularly during my post that i am facing this problem on Solaris system. Running the same application on windows is working fine. I can't make other non-modal dialogs visibility to false because they should be visible on the screen all the time throught out the application life cycle and making it visible/non-visible doesn't get sense in my application. Does anybody is facing the same problem with Solaris system? Plz help.
    Hitesh

  • Distiller Server "Could not open file" modal dialog

    We're running Distiller Server 8, and I've got a dilemma that I'm hoping is solvable.
    This is installed on a Windows 2008 server, with jobs coming into watched folders from our OPI server. Periodically, we get a dialog box that says Acrobat Distiller "Could not open the file: P:\OPI_Data\PDF_Processing\Index_PDFs\out\<filename>". The path specifics will vary, but it's always a path to a file in process... not to a config file or anything like that.
    The big problem is that this pops up as a modal dialog and Distiller won't process any more files until someone clicks "OK". On the console. On a server. In the datacenter. We run two shifts, and I'm getting really tired of phone calls at midnight saying "Distiller is hung... can you fix it?"
    Is there a way to run Distiller Server in silent mode? Some way to tell it "If you have a problem, just fail that job and move on"? Having to have a server administrator connect in and click a dialog box is just silly.

    That seems to have done the trick, thanks.  I don't really like doing forces unless someone who knows more than I recommends it, as I see way too many threads where that has complicated things tremendously.

  • IDBase_UI_Dialog::Destructor not always called when dialog exits?

    Hi,
    We're having an intermittent issue with one of our dialogs on CC 2014 on Mac 10.8.  It's a Moveable Modal dialog and sometimes when it is closed, the next time it opens the dialog come up but IDialog::Open returns immediately rather than blocking as you would expect for a Modal dialog.
    Having used the trace, what appears to be happening is that when the dialog is closed, when it works properly the last thing that InDesign does is:
    DVModalDialogWindow::Destructor
    DVWindow::ReleaseWindow deleting drover OS_Window for 3b50e600
    IDBase_UI_Dialog::Destructor
    but when it doesn't work, these three lines do not appear in the trace.  Could we be doing something that would cause this?
    Can anyone shed some light on this?
    Thanks,
    Dan Tate

    I have found a workaround for this: when the IDialog::Open returns immediately, the IDialog::IsOpen returns true, so I can trap it.  If I then call IDialog::SetDeleteOnClose(true) and then IDialog::Close, then the dialog does close properly and opens correctly the next time.
    I'd still like to know why I am getting into this state in the first place though.
    For further information, this seems to happen less frequently (if at all) on CC 2014 10.1, but happens fairly regularly on 10.0 - was anything changed in this area between the two versions?
    Thanks,
    Dan Tate

  • Disk image space not regained after deleting...

    Using my Powerbook I created backups and a 300gb disk image as a pseudo partition on a 1TB Time Capsule. This was prior to owning my MBP. I then used the same Time Capsule to make backups for my new MBP. I went back to my Powerbook to try to regain that 300gb's by deleting the disk image. I stuck it in the trash and deleted... But no space was regained and now the disk image is obviously gone. I'm afraid, as I think more carefully about it, that I needed to erase the disk image, once mounted, in Disk Utility (which is where the disk image was created in the first place). I'm also afraid that I'm now going to have to reformat the entire drive, erasing all back ups from both the PB and MBP, to regain the space? If anyone knows anything about this or has any advice it would be greatly appreciated.
    Thanks for your time!
    Andrew

    Thank you, Bob.
    Ok, here's where I'm at...
    I ran a Drive Genius 2 scan on the TC with my MBP and cancelled it after about 5 percent was completed. It was going to take all day and I didn't think it was going to do anything. To my surprise when I went back to my desktop and got info on the TC it showed over 500gb available, whereas before it showed 116gb available... so somehow I regained more than just my 300gb disk image worth of space back. Weird. (Although, I now understand how those figures can sometimes be misleading.) This rough figure would tell me that the MBP is also recognizing the Powerbook back ups as well even though they are not visible in Finder.
    Next, I connected with my PB and Finder showed only 116gb available... which wasn't too surprising. I then ran the same procedure with Drive Genius, this time only to about .65 percent complete and when I went to get info it showed that I had 805gb available. HA! So I guess it is not recognizing the MBP backups but that's no big deal. I won't be making anymore back ups with the PB anyway.
    Well, thanks for your help, Bob. I always learn something when I come to Discussions!
    Andrew

  • Main viewer window not displaying after Yosemite upgrade

    I just upgraded tp Yosemite. Also upgraded Aperture (v3.6). Opened up Aperture. After it finished upgrading my library I noted that thumbnail images on viewer display OK but there is no image showing on the large viewer. Tried selecting different thumbnails. No success. Tried quitting and restart app. Nothing. Any ideas?

    Thanks. I tried all three of the repair options but no success. However, after restart things started working correctly. Possibly it was the combination of repairs and restart that fixed it.

  • Modal dialog does not close until function finish

    Hello
    I am a modal dialog (yes/no buttons). When user selects YES, a function is executed. My problem is: Dialogo does not close until function finish.
    Many thanks for your help.
    This is the call to show modal dialog:
    boolean myRes;
    dlgYesNo.setTitle(" SINCRONIZE");
    dlgYesNo.setPreguntaUp("�Do you want to sincronize?");
    dlgYesNo.show();
    myRes = dlgYesNo.respDialogo();
    if (!myRes) return; // User selects NO
    sincronizeData(); //MODAL DIALOG DOES NOT CLOSE UNTIL THIS FUNCTION FINISH!!!
    This is the class to create modal dialog:
    public class DialogoYesNo extends java.awt.Dialog {
    /** Creates new form DialogoYesNo */
    public DialogoYesNo(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();
    this.setSize(200,125);
    this.setResizable(false);
    Dimension d = this.getToolkit().getScreenSize();
    this.setLocation((d.width-getSize().width)/2, (d.height-getSize().height)/2);
    /** 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.
    private void initComponents() {
    btYes = new java.awt.Button();
    lblDialogCentro = new java.awt.Label();
    lblDialogUp = new java.awt.Label();
    btNo = new java.awt.Button();
    lblDialogDown = new java.awt.Label();
    setLayout(null);
    addWindowListener(new java.awt.event.WindowAdapter() {
    public void windowClosing(java.awt.event.WindowEvent evt) {
    closeDialog(evt);
    btYes.setLabel("Si");
    btYes.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    btYesActionPerformed(evt);
    add(btYes);
    btYes.setBounds(30, 80, 60, 24);
    lblDialogCentro.setAlignment(java.awt.Label.CENTER);
    lblDialogCentro.setText("a");
    add(lblDialogCentro);
    lblDialogCentro.setBounds(10, 40, 180, 20);
    lblDialogUp.setAlignment(java.awt.Label.CENTER);
    add(lblDialogUp);
    lblDialogUp.setBounds(10, 30, 180, 20);
    btNo.setLabel("No");
    btNo.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    btNoActionPerformed(evt);
    add(btNo);
    btNo.setBounds(110, 80, 60, 24);
    lblDialogDown.setAlignment(java.awt.Label.CENTER);
    add(lblDialogDown);
    lblDialogDown.setBounds(10, 50, 180, 20);
    pack();
    private void btYesActionPerformed(java.awt.event.ActionEvent evt) {
    // Add your handling code here:
    respuesta = true;
    setVisible(false);
    dispose();
    private void btNoActionPerformed(java.awt.event.ActionEvent evt) {
    // Add your handling code here:
    respuesta = false;
    setVisible(false);
    dispose();
    /** Closes the dialog */
    private void closeDialog(java.awt.event.WindowEvent evt) {
    // Add your handling code here:
    * @param args the command line arguments
    public static void main(String args[]) {
    new DialogoYesNo(new java.awt.Frame(), true).show();
    public void setPreguntaUp(String p){       
    lblDialogUp.setVisible(true);
    lblDialogDown.setVisible(true);
    lblDialogCentro.setVisible(false);
    lblDialogUp.setText(p);
    public void setPreguntaDown(String p){
    lblDialogUp.setVisible(true);
    lblDialogDown.setVisible(true);
    lblDialogCentro.setVisible(false);
    lblDialogDown.setText(p);
    public void setPreguntaCentro(String p){
    lblDialogUp.setVisible(false);
    lblDialogDown.setVisible(false);
    lblDialogCentro.setVisible(true);
    lblDialogCentro.setText(p);
    public void centrarPantalla(){
    Dimension d = this.getToolkit().getScreenSize();
    this.setLocation((d.width-getSize().width)/2, (d.height-getSize().height)/2);
    public boolean respDialogo(){
    return respuesta;
    // Variables declaration - do not modify
    private java.awt.Button btNo;
    private java.awt.Label lblDialogCentro;
    private java.awt.Button btYes;
    private java.awt.Label lblDialogUp;
    private java.awt.Label lblDialogDown;
    // End of variables declaration
    private boolean respuesta = false;
    }

    Hello
    This case works fine using following line to execute code after modal dialog:
    new Thread(new Runnable(){ public void run() { netCodeFunction(); }}).start();
    Regards

  • Apple TV does not work after trying to update software. Main light keeps blinking and on the screen shows itunes icon and a usb cable. What does that means?

    My Apple TV does not work after trying to install the new software update. The main light keeps blinking rapidly and on the screen it shows the itunes icon and a USB cable. What does that mean?

    The Apple TV is in recovery mode. Try to restore the Apple TV. Follow the link for instructions on the restore process.
    http://support.apple.com/kb/HT4367

  • HT4623 my phone main button not working after installed new version software 7.0.6

    my phone main button not working after installed new version software 7.0.6

    Arrange some liquid like petrol spirit and w 40
    two drops in to home button.
    30 times press slowly slowly and then restart your apply iphone.
    You will get ready.
    I am sure. Thanking you...

  • JDEV Application does not comeup after spalsh screen

    Hi,
    Interested in JDeveloper, I recently installed JDeveloper from OTN website and after install and the first start, It checked for udpates and Then I installed udpated (10.1.3.1.0). After that it asked me to rename some file, but I missed the step and then exited and restarted. After that the App never comes up and in the task manager I see the jdev.exe takes up 50% of the processor and does nothing.
    How do I troubleshoot this. Is there a log that I can look into?
    I do not see any support info or trouble shooting guide except this forum. Any help is appreciated.
    Venkat V

    having had a very similar experience on 10.1.2, I downloaded 10.1.3.1
    I did install some extensions. I then started running a tutorial. switched off and went home.
    next day Jdev wouldnt get past splash screen.
    deleted entire jdeveloper folder/subfolder .. re extracted from original downloaded zip.
    still won't get past the splash screen. running from console get the following:
    java.lang.NullPointerException
    at javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:117)
    at javax.swing.UIDefaults.getUI(UIDefaults.java:721)
    at javax.swing.UIManager.getUI(UIManager.java:860)
    at javax.swing.JPanel.updateUI(JPanel.java:104)
    at javax.swing.JPanel.<init>(JPanel.java:64)
    at javax.swing.JPanel.<init>(JPanel.java:87)
    at javax.swing.JPanel.<init>(JPanel.java:95)
    at javax.swing.JRootPane.createGlassPane(JRootPane.java:482)
    at javax.swing.JRootPane.<init>(JRootPane.java:313)
    at javax.swing.JFrame.createRootPane(JFrame.java:247)
    at javax.swing.JFrame.frameInit(JFrame.java:228)
    at javax.swing.JFrame.<init>(JFrame.java:195)
    at oracle.ide.IdeCore$StartupWindow.<init>(IdeCore.java:1450)
    at oracle.ide.IdeCore.startupImpl(IdeCore.java:1075)
    at oracle.ide.Ide.startup(Ide.java:674)
    at oracle.ideimpl.Main.start(Main.java:49)
    at oracle.ideimpl.Main.main(Main.java:25)
    not sure what else to do

  • Matlab 2007b main window focus

    Hi,
    I'm having an issue with focusing the main window in Matlab 2007b. The window focuses as expected if I click it to bring it into focus. However, if I use cmd-tab, Matlab comes to the forefront, including the main window, but the main window is not focused. I can click it to bring it into focus, but cmd-` doesn't work.
    I don't recall this happening before I upgraded from 10.5 to 10.5.1. I also find it extremely strange that I cannot find any information about this on Google, Usenet, or Mathworks's website. Anyone have any suggestions or ideas on how to fix this. I'm a heavy cmd-tab user, so this is a huge deal.
    Thanks.

    I forgot to check my Matlab installation before tossing my previous system folder after an "Archive and Install", so Matlab isnt working for me. Perhaps it could be something with the X11 environment taht's giving the windows the wrong focus? Native Aqua applications all seem to cmd-tab fine for me. When I open an xterm intance and cmd-tab between X11 and safari, when I go back to X11 it does bring the xterm window into focus, but it doesnt bring it to the front.

  • Non main JFrame

    If i wanted to make a non main JFrame what is the basic structure for it to open as a new frame not as an internal frame? How would i call this Frame at an event?

    Sorry been feeling ill and I seem to not write what i mean and not remember things i already know. I meant to take the elements of the JFrame into it but i did it just after you answered with some tweeking anyway. Calling and passing values to it should be done like a normal class construction method. Thanks for helping me out anyway

  • My sound system does not work AFTER installing pc to tv wireless connection

    my sound system does not work after installing hp pc to tv wireles device when I am using lap top for other purposes.

    Hi,
    You don’t install VS2010 on the client PC, then where did the Form Invoice not work? When you run it from another version of VS? Or when you run the application with application.exe?
    Based on your description, one form works well, another form does not. I assume that two forms are in two different projects, then please check the .Net Framework used by the two projects. If they are different, you can use the
    one used by the Form contact for Form Invoice.
    Because this issue is a project issue, I recommend you to consult it on some application forum such as Windows Forms General forum for better support.
    VS General Question forum mainly discusses
    the usage of Visual Studio IDE such as
    WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help
    System and Visual Studio Editor.
    Thanks,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for