0

We are using LTSP with Thin-Clients. We are using it, to run a Java-Swing-Application. The users should not be able to do anything else, so instead of a Gnome-Session we use a shell-script to start our application.

Nearly everything works perfect but one thing: When the Thin-Client starts, the application starts too but doesn't receive the focus. We have to click once with the mouse inside the application, which is not that good, because the application is designed to be used without a mouse.

I didn't found anything useful, a toFront() on my Main Frame wasn't successful.

Has anyone any better suggestions??

2 Answers 2

1

You can use method java.awt.Window#setAlwaysOnTop(boolean) to grab the focus and after the first user interaction reset the alwayOnTop property.

Sign up to request clarification or add additional context in comments.

Comments

0

You could try to call requestFocus on your JFrame as soon as it becomes visible:

JFrame frame = new JFrame();

frame.addComponentListener(new ComponentAdapter() {
        public void componentShown(ComponentEvent e) {
            ((JFrame) e.getSource()).requestFocus();
        }
    });

frame.setVisible(true);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.