Java-Application to front

O

Oliver Hirschi

Hi

How can I programatically take my java-application under MacOSX to
front?
I have a JFrame and I think I tested all kinds of methods to do this:
"toFront, setVisible, invalidate, validate, setenable, etc."

Under Win it works well as follow:
------------------------------------
// disable and minimize Frame
this.setVisible(false);
m_oApp.getFrame().setEnabled(false);
m_oApp.getFrame().setExtendedState(Frame.ICONIFIED);

// SWITCH
SwitchSend oSwitchSend = new SwitchSend(m_oApp, m_oJob);
oSwitchSend.pmm_CallSwitch(m_oObPubForm_Layout, m_oObPubForm_Extract);

// enable and reactivate Frame
m_oApp.getFrame().setExtendedState(Frame.NORMAL);
m_oApp.getFrame().setEnabled(true);
this.setVisible(true);
this.requestFocus();
 
O

Oliver Wong

Oliver Hirschi said:
Hi

How can I programatically take my java-application under MacOSX to front?
I have a JFrame and I think I tested all kinds of methods to do this:
"toFront, setVisible, invalidate, validate, setenable, etc."

toFront is the standard way, but from what I understand, the OS is free
to ignore the request, or implement it in ways other than simply bringing
the window the the front (in Windows XP, for example, it'll cause its
corresponding entry in the taskbar to flash). Think of toFront as a
"request" to be brought to front, rather than a direct order to do so.

See
http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Window.html#toFront()

- Oliver
 
O

Oliver Hirschi

Oliver Wong said:
toFront is the standard way, but from what I understand, the OS is
free to ignore the request, or implement it in ways other than simply
bringing the window the the front (in Windows XP, for example, it'll
cause its corresponding entry in the taskbar to flash). Think of
toFront as a "request" to be brought to front, rather than a direct
order to do so.

See
http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Window.html#toFront()

I have seen this and it seems that there is only the way to do this, to
implement a nativ library for each OS and a jni-interface.

by-the-way: On win 2000 there is the behaviour i want (the application
comes really to front). On win xp, i can get the behaviour when I reset
the system flag "Prevent applications from stealing focus" with the
powertoy TweakUI from microsoft.

Oli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,266
Messages
2,571,077
Members
48,772
Latest member
Backspace Studios

Latest Threads

Top