launch ie on java problem

i have a java application that launches an ie browser using exec. my problem is that the ie window that spans out is behind my java application.. can anyone tell me how to make it spawn over my java application? thanks...
[228 byte] By [gigsza] at [2007-10-3 4:34:45]
# 1
or how about this one.. how do you make an application lose focus... the whole application?=)
gigsza at 2007-7-14 22:38:25 > top of Java-index,Java Essentials,Java Programming...
# 2
anyone?
gigsza at 2007-7-14 22:38:25 > top of Java-index,Java Essentials,Java Programming...
# 3

> or how about this one.. how do you make an

> application lose focus... the whole application?

>

> =)

Deepends on what constitutes your application.

You could do it window by window.

Look, for example at JWindow Api where you will find how to create

windows with an owner Window which may or may not help you

r035198xa at 2007-7-14 22:38:25 > top of Java-index,Java Essentials,Java Programming...
# 4
thnks for the reply...anyways i tried using the focus cycles but nothing seemed to be working for me.. =(
gigsza at 2007-7-14 22:38:25 > top of Java-index,Java Essentials,Java Programming...
# 5
or how about this one... how do you simulate an (alt+tab) keyboard press using java?
gigsza at 2007-7-14 22:38:25 > top of Java-index,Java Essentials,Java Programming...
# 6

> or how about this one... how do you simulate an

> (alt+tab) keyboard press using java?

Try awt.Robot. Don't know it it works, though.

Losing focus itelf won't help, it's gaining focus that makes a Window come to front, not losing focus that makes it go to the background. but you can still try frame.toBack().

CeciNEstPasUnProgrammeura at 2007-7-14 22:38:25 > top of Java-index,Java Essentials,Java Programming...
# 7

> > or how about this one... how do you simulate an

> > (alt+tab) keyboard press using java?

>

> Try awt.Robot. Don't know it it works, though.

>

> Losing focus itelf won't help, it's gaining focus

> that makes a Window come to front, not losing focus

> that makes it go to the background. but you can still

> try frame.toBack().

that's basically my problem. i cannot get the focus of the newly spawned ie window... using frame.toBack will cause the applicaiton to go behind all the windows currently running.... hehehe

gigsza at 2007-7-14 22:38:25 > top of Java-index,Java Essentials,Java Programming...
# 8
the robot worked... i guess this is good for now... thank you very much for your help =)robot.keyPress(KeyEvent.VK_ALT);robot.keyPress(KeyEvent.VK_TAB);robot.keyRelease(KeyEvent.VK_TAB);robot.keyRelease(KeyEvent.VK_ALT);
gigsza at 2007-7-14 22:38:25 > top of Java-index,Java Essentials,Java Programming...
# 9

Are you doing somewthing after spawning IE? Because this works the way you want:

public class TestSomething {

public static void main(String[] args) {

JFrame f = new JFrame();

JButton b = new JButton("Hit Me");

b.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent actionEvent) {

try {

Runtime.getRuntime().exec("cmd /c start http://www.google.fr");

} catch (IOException ex) {

ex.printStackTrace();

}

}

});

f.getContentPane().add(b);

f.setVisible(true);

}

}

CeciNEstPasUnProgrammeura at 2007-7-14 22:38:25 > top of Java-index,Java Essentials,Java Programming...
# 10

> Are you doing somewthing after spawning IE? Because

> this works the way you want:

>

> public class TestSomething {

>

>public static void main(String[] args) {

>JFrame f = new JFrame();

>JButton b = new JButton("Hit Me");

>b.addActionListener(new ActionListener() {

> public void actionPerformed(ActionEvent

> actionEvent) {

>

> try {

> Runtime.getRuntime().exec("cmd /c start

> http://www.google.fr");

> } catch (IOException ex) {

>ex.printStackTrace();

>}

> }

>

>});

> f.getContentPane().add(b);

>f.setVisible(true);

>

>

> }

yes some thing very similar

public class Launcher

{

private JFrame frame = null;

private JButton button = null;

public Launcher() throws Exception

{

frame = new JFrame("some title");

frame.setSize(200,200);

frame.setLayout(new FlowLayout());

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

button = new JButton("launch here");

robot = new Robot();

button.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

try

{

Runtime.getRuntime().exec("cmd.exe /c start deploy.js google.com");

}

catch (Exception ex)

{

ex.printStackTrace();

}

}

});

frame.getContentPane().add(button);

frame.setVisible(true);

}

public static void main(String args[]) throws Exception

{

new Launcher();

}

}

i'm not realy sure why it wont work.. the ie will spawn behind the application

gigsza at 2007-7-14 22:38:25 > top of Java-index,Java Essentials,Java Programming...
# 11
i tried running with out the deploy.js and it wrked fine.. maybe it's because of the script inside the file that's causing it to spwn behind....
gigsza at 2007-7-14 22:38:25 > top of Java-index,Java Essentials,Java Programming...