Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in Opening HTML Page in Internet Explorer from my Swing Application  RSS feed

 
Manikandan Adaikkalavan
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am opening a HTML file in Internet Explorer from my swing application.I am using the code given below
...........
private final static String WIN_FLAG = "url.dll,FileProtocolHandler";
private final static String WIN_PATH = "rundll32";
............
String cmd = WIN_PATH + " " + WIN_FLAG + " " + url;
// url is HTML file Path
Process p = Runtime.getRuntime().exec( cmd );
...........
Here there are two things i need to address ...
1)The HTML file is opening up,but it always opens behind the swing application,that makes me every time to maximize the HTML file after it being opened up.I want to open it in front of the Swing Application.I need to implement "Always On Top" functionality for the html page.
2)Whenever i trigger action to open different HTML page,it opens in new Internet Explorer window.I need to open it in same IE window.

how to solve out these problems ??? any help would be greatly appreciated .Thanks in advance.

- Manikandan
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't a Java problem, these are both "features" of Internet Explorer...

As to a solution to the problem of IE launching behind your app, this is because IE is set up this way... you may be able to call toBack() on your application to have it move behind IE after it tries to launch the browser...

As far as the launching a new browser for each web page, I think that IE has some kind of option under Internet Options that says something like "Launch shortcuts in new browser window"... I know the wording of this has changed under different versions of IE, but this controls whether each request launches a new window or just updates the current window.

-Nate
 
Manikandan Adaikkalavan
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i need to have these two things to be done.
In IE , Tools > Internet Options >> i tried
"Reuse windows for launcing options" .
But still the page opening behind the swing application.
any help ?? itz very urgent ....
Thanks in advance.
Manikandan
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you also see this paragraph of my post?

As to a solution to the problem of IE launching behind your app, this is because IE is set up this way... you may be able to call toBack() on your application to have it move behind IE after it tries to launch the browser...


The "reuse windows for launching" option was to fix the problem of launching a new window with every request...

-Nate
 
Manikandan Adaikkalavan
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I tried toBack() method.The application and the HTML Page both gets minimized sometimes.
Moreover ,i noted the following features in Windows2000.
1.Whenever none of the IE windows is opened and if we open a HTML page in WindowsExplorer, it shows the HTML page infront.
2.But if we already have html page opened in IE window,and if we open another HTML page,it opens html page but in minimized position.
I tested similiarly - opening the html pages in my application.
SO by default, this is the feature in Windows2000.
i think we can't change this feature throu' our application.
am i right ?
Thanks,
Manikandan
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes... You can't change the behavior of IE through your program...

I also looked up toBack() and it won't help you out in this case... toBack() only moves your frame to the back of all the frames in the current JVM... Since IE is running outside of the JVM it won't go behind it... I ran into a problem similiar to this in the project I am working on here...

-Nate
 
Manikandan Adaikkalavan
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nate for your replies.
 
Manikandan Adaikkalavan
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nate,
I got one solution in bring up the HTML page infront of the swing application in IE.
before that, in windows 2000 , whenever we opened a html file, and that file being in opened condition,if we try to open that file again,it will show that file infront of all windows.
This strikes me.And i called the method(which opens html file via swing application) twice.
The following code will explain....
/*
openURL()is the method which i am calling to open html file
*/
BrowserLauncher.openURL(urlHelp);
try
{
Thread.sleep(200);
}
catch(Exception e)
{
e.printStackTrace();
}
BrowserLauncher.openURL(urlHelp);

Now in IE , i am able to get the HTML file in front.
Thanks,
Manikandan
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!