Results 1 to 7 of 7

Thread: JDIC - Problem to close a WebBrowser

  1. #1
    Join Date
    Dec 2009
    Posts
    296

    JDIC - Problem to close a WebBrowser

    Hi,
    I am printing a browser (JDIC) embedded in a JPanel or a JFrame, whatever. So far, so good, the html page is displayed well, etc. But everything is complicated by the closure of the frame or the application containing the panel. It appears that the browser does not close well. In fact, when I launch the application from Eclipse, after closing the frame, the famous button "Terminate" from the console is available, a sign that not everything went wrong. I add the browser to a panel, then the panel to a frame, to reproduce the conditions of my application. The passage by a FormLayout avoids the problems of scaling due to the conflict AWT / Swing. In my case, the following is unthinkable:
    frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
    Briefly I have a problem to close my browser. Some one has an idea about this.

  2. #2
    Join Date
    Feb 2008
    Posts
    1,852

    Re: JDIC - Problem to close a WebBrowser

    Hello,
    In my case, the following is unthinkable:
    frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
    Why it is so, I think this is not that difficult. And if this is really where you must put in place a mechanism to close the application. Just think of your code and make the proper changes.

  3. #3
    Join Date
    Dec 2009
    Posts
    296

    Re: JDIC - Problem to close a WebBrowser

    Hello,
    Because this instruction close the JVM, and it is not at all what I want. I need it for the rest of the application. I wish it remains open, but nothing remains of the browser in memory, and the closure of the frame, the browser disappears entirely. I have a locking mechanism of my application, including a method docloser () where I put what I want. And I want just by the appropriate instructions to release the browser entirely.

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Re: JDIC - Problem to close a WebBrowser

    Hello,
    In this case, just do a dispose() on the window or simply:
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    This will free the window and its components. When the button "Terminate" is quite normal that remains active if the JVM is still running because it just kill the process the JVM.

  5. #5
    Join Date
    Dec 2009
    Posts
    296

    Re: JDIC - Problem to close a WebBrowser

    Hello,
    Then the DISPOSE_ON_CLOSE is what is already implemented in my application. In fact, I forgot to put in the sample code I provided, mea culpa, but when you add, the problem remains. I added browser.dispose () method in my docloser (), but it does not change the fatal problem. In theory, when all frames of the application have DISPOSE_ON_CLOSE as a way of closing and that all goes well, the JVM exits normally when closing the last frame. My problem is this: when there is a WebBrowser in frames of the application, the JVM does not close properly at the end. And I wonder if anyone knows why, and how to solve the problem.

  6. #6
    Join Date
    Feb 2008
    Posts
    1,852

    Re: JDIC - Problem to close a WebBrowser

    Hello,
    No, dispose () only release system resources associated with the window and its sub-components. This is not linked to the WebBrowser or another component. If you do not use EXIT_ON_CLOSE you must establish a mechanism to make a System.exit () (or other) when closing the last window, otherwise the thread will continue to run. Just take a brief look at the side of WindowListeners.

  7. #7
    Join Date
    Apr 2008
    Posts
    1,948

    Re: JDIC - Problem to close a WebBrowser

    Hello,
    Have you ever used System.exit () in our code (except for batches if you want to specify a return value). Not even close to the application. There is no problem to have has everywhere because the JVM closes well after all the frames arranged (if they restore resources correctly, we can just test well in freeing a call to System.exit ()). You think it is wrong? The fact is that the WebBrowser is reluctant to close. But if nobody has a walkthrough I'd certainly have to investigate with a profiler to understand what is happening.

Similar Threads

  1. Problem creating Favorites Webbrowser
    By Jagadamba15 in forum Software Development
    Replies: 5
    Last Post: 23-01-2010, 02:41 PM
  2. Encountered a problem and needs to close
    By I'm Member in forum Windows Software
    Replies: 3
    Last Post: 08-09-2009, 10:35 AM
  3. Replies: 3
    Last Post: 22-08-2009, 06:31 PM
  4. How to control WPF Webbrowser
    By Dharmesh Arora in forum Software Development
    Replies: 3
    Last Post: 13-07-2009, 09:58 AM
  5. ps2. exe has encountered a problem and needs to close
    By EllingSon in forum Windows XP Support
    Replies: 1
    Last Post: 19-02-2007, 10:13 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,811,490.54057 seconds with 16 queries