> 1.I have created a frame.
> In that I am using Runtime.getRuntime.exec(cmd /c start netscp6 file:///c:
[quoted text clipped - 4 lines]
> How can I avoid the minimize form of the second process?
> Can we switch between the two running processes using some java-code.
There is one way (I can think of) to achieve most of that.
But it is a bit tricky, and requires the full and complete
knowledge/understanding and *permission* of the end
user (it will require an applet, probably signed).
Does that work for your purposes?
> 2. If I close my main frame window then the netscape browser-process should
> be closed.
> How I can achieve this ?
I am not sure on that one, perhaps there is a way to stop
the process you started, I am not that familiar with it.
But using an applet you could achieve that as well
(or at the very least, invoke some JS that prompts the
user to close the browser)
> A piece of code always wanted.
A large chunk of money always wanted.
( Since it came up.. ;)

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
smita b - 24 Jun 2005 07:22 GMT
I am using frame not applet in my applicatin.
I am using java-code as:-
public class tryfocus1 extends JFrame implements ActionListener
{
JButton open,close;
JPanel jp=new JPanel();
Process child;
public tryfocus1()
{
super("Main Window");
getContentPane().setLayout(new BorderLayout());
open=new JButton("Open netscape");
open.setActionCommand("open");
open.addActionListener(this);
jp.add(open);
close=new JButton("Close process");
close.setActionCommand("close");
close.addActionListener(this);
jp.add(close);
getContentPane().add(jp,BorderLayout.CENTER);
setSize(800,600);
setVisible(true);
addWindowListener(new r1());
}
public void actionPerformed(ActionEvent e)
{
if(e.getActionCommand().equals("open"))
{
System.out.println("Clicked on open");
String s="file:///c:/javascript/1.htm";
try{
child=Runtime.getRuntime().exec("cmd /c start netscp6 "+s); // working
in minimize form.
System.out.println("Netscape running process "+child);
//printing process name
}catch(Exception e1){}
}
if(e.getActionCommand().equals("close"))
{
System.out.println("Child: "+child);
//printing same process name
try{
child.destroy();
// not doing anything
}catch(Exception c){}
}
}
public static void main(String args[])
{
tryfocus1 s=new tryfocus1();
}
}
class r1 extends WindowAdapter
{
public void windowClosing(WindowEvent r)
{
System.exit(0);
}
}
Is there any way to run code successfully.
Can I move control to other processes running using java-code.
Andrew Thompson - 24 Jun 2005 17:04 GMT
> I am using frame not applet in my applicatin.
Cool. What I meant was ..
1) Leave the application as a frame, but..
2) *Also* add an applet to '1.htm'
...
> Is there any way to run code successfully.
3) Get the applet to communicate with the application
(there are a number of ways to have the applet and application
talk to each other, for example, a socket.)
> Can I move control to other processes running using java-code.
You can transfer control either which way.
E.G.The application is about to close down, so the
browser is no longer needed...
- It talks down it's socket and tells the applet 'I am closing'.
- The applet then calls a Javascript function using LiveConnect.
- The JS function either closes the browser (or more polite
and technically easier) prompts the user to close it.
So, my suggestion is
- Keep the application, but..
- Also add a signed applet to help you communicate between
the browser and the application.
Make sense?

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
> Hello
>
[quoted text clipped - 7 lines]
> is showing the netscape browser correctly.
> How can I avoid the minimize form of the second process?
Java is a bit reluctant in showing new windows when the console or the main
frame is not on top. My guess is you should wait a while before minimizing
your frame.
> Can we switch between the two running processes using some java-code.
What exactly do you want?
> 2. If I close my main frame window then the netscape browser-process should
> be closed.
> How I can achieve this ?
Process#destroy()
> Is there any child-parent relationship between processes.
Not in the Java API.
smita b - 04 Jul 2005 13:16 GMT
I don't want to prompt user that close the browser.It should get closed
automatically when I am closing my frame-application.
Is there is any way to destroye that process which has been started in frame-
application.
Using processname.destroy() it is not working.
How can I achieve this?
Boudewijn Dijkstra - 04 Jul 2005 17:10 GMT
>I don't want to prompt user that close the browser.It should get closed
> automatically when I am closing my frame-application.
I didn't say that you should. When I said: "My guess is you should wait a
while before minimizing your frame," I meant that you could do that
programmatically.
> Is there is any way to destroye that process which has been started in
> frame-
> application.
>
> Using processname.destroy() it is not working.
What is it doing in stead?
smita b - 07 Jul 2005 11:28 GMT
>Process#destroy()
Process.destroy() not working.
Andrew Thompson - 07 Jul 2005 17:01 GMT
>>Process#destroy()
>
> Process.destroy() not working.
Process.destroy() just lazy.
Suggest - flog it severely. [ ;-) ]
( If that fails, you might try posting a SHORT self contained
code sample of exactly what you are doing, from start to end. )

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane