Java programming question

Jaiem's picture

They have: 1,191 posts

Joined: Apr 1999

A programmer recently told me that with Java (not JavaScript), there's no way to force a pop-up window to always open infront of any other open windows.

Seems hard to believe it can't be done in Java.

Is that true??

They have: 19 posts

Joined: Jul 2001

Java doesn't have control of the browser functionality. You'd have to pass a command to page-level Javascript to call window.focus(), which will bring that browser window to the front.

taff's picture

They have: 956 posts

Joined: Jun 2001

Quote: Originally posted by Adrian J. Moreno
Java doesn't have control of the browser functionality. You'd have to pass a command to page-level Javascript to call window.focus(), which will bring that browser window to the front.

This will only keep the pop-up in front as long as it has the focus. Once the focus shifts to the main window, the popup will disappear again to the back.

I can't speak for Java, but I was looking for a JavaScript solution to this some months back. I never was able to find a way to do it.

.....

Jaiem's picture

They have: 1,191 posts

Joined: Apr 1999

What about Java running stand alone? (w/o a browser)

Is there an easy way to make new pop-up window come to the front?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

zerocattle.com/examples/popUp.html

That has the code, explanations and links to tutorials for keeping a browser window on top. To keep it on top, use onBlur to tell it that when it loses focus, give it focus. Smiling

As for Java -- for a stand-alone program, outside of the web? Well that's not a "window" situation. It would be a totally different issue, no? I wish I had pointers, sorry.

Smiling Suzanne

Jaiem's picture

They have: 1,191 posts

Joined: Apr 1999

Suz,

It would be "windows" just not in a browser. I've seen Java applications that open a window here and there. You don't always have to run Java in a browser.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

That's what I mean -- browser windows are controlled with JavaScript. In Java they would be referred to as... ? What? Dialogue boxes like in Windows OS?

JavaScript only controls browser elements, it's not for stand alone applications that don't use browsers, no?

Smiling Suzanne

Jaiem's picture

They have: 1,191 posts

Joined: Apr 1999

OK. Call the pop-ups windows, dialog boxes, little squares, whatever.

But back to the issue: Is there an easy way in Java to make any new pop-up dialog always come to the front of all other open pop-up dialog boxes?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

But I am moving this to the Scripting Forum, where someone may be better able to answer your question.

Smiling Suzanne

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.