Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to prevent JFrame from taking focus away from a CLI?

807588Feb 7 2007 — edited Feb 11 2009
Hi,

I am lack the savvy, and have very likely picked an .. uncommon approach, but is it possible to prevent a JFrame from stealing the focus from my terminal command line interface?

I started developing a text based network simulator, but then discovered the JUNG library, that allowed me to visualize what I was doing with realtime animation. So I added a JFrame to show the graph I was traversing and manipulating. Currently the JFrame is owned by a thread that is created at launch, without displaying the window - as no graph has been loaded yet.

So the JFrame currently annoyingly steels the focus from the app.menu. I see to solutions to make this work better:

1. Display the JFrame with just a label saying "Please load a graph". This way it does not feel like the focus is stolen, but it does introduce the slight delay to display the window.

2. Prevent the focus from being stolen from the CLI. This is currently my preferred solution, however if it is not possible I will settle for the solution above.

So, can anyone help me keeping the focus at the CLI?

Thanks,
Pandemic

Message was edited by: typo
PanDemic

Message was edited by:
PanDemic
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 11 2009
Added on Feb 7 2007
12 comments
2,532 views