Alpha2k
Alpha2k

Reputation: 2241

Run jar without losing focus

Im using windows task manager to run a .jar every 5 minutes. Its a simple JFrame declared as public class myClock extends javax.swing.JFrame that simply shows the actual time (HH:MM).

I have 2 screens: the main screen and the secondary screen.

When the clock runs it starts on the secondary screen on a corner. While watching a movie or playing a game in full screen on main screen, if the task runs, whatever it is on main screen as fullscreen gets minimized, clock displays on secondary screen and gets the focus.

Is there any way to:

  1. Disable the JFrame of getting the focus on the clock or
  2. Lock the focus on the program i chose to avoid getting it minimized

Upvotes: 3

Views: 181

Answers (1)

camickr
camickr

Reputation: 324207

Disable the JFrame of getting the focus on the clock or

When you create your frame you can use:

frame.setFocusableWindowState(false);

Upvotes: 3

Related Questions