Two Laptop Bag
The moose likes Beginning Java and the fly likes Event dispatch Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Event dispatch" Watch "Event dispatch" New topic

Event dispatch

Alex Wolf

Joined: Aug 24, 2004
Posts: 16

I have a window that I want to keep in the back at all times behind all windows. It should ignore mouse clicks, or not ever get to be the front. infact the whole program should be in the background at all times.

how would i go about this?
i have tried adding a mouselistener with mouseClicked( MouseEvent e ) { JFrame.toBack(); }
but thats already too late... because then the window comes to the front and covers all running applications windows before it is sent back and its not what I want.

I think I want to somehow stop the EventDispatcher to not dispatch the event at all... but I need help.
Alex Wolf

Joined: Aug 24, 2004
Posts: 16


tried implements AWTEventListener but eventDispatched never gets called...
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

If by "behind all windows" you mean behind all other applications, there's unfortunately nothing you can do in 100% Java. Events that bring applications to the front -- as opposed to moving individual windows within a single application -- are handled by the OS window system, not by the application.

Some OSs may have an API call that means "show this application on the desktop, but only show it in the very back", but there's no way to do that from Java itself.

[Jess in Action][AskingGoodQuestions]
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
This doesn't sound like a beginner question. In case that you need more help beyond Ernest's comments above, or if you have another similar question, you may want to visit the GUI forum where these kinds of issues are discussed. This particular forum discusses very general Java topics, so I think you will find more help there.

Keep Coding!


Java API Documentation
The Java Tutorial
Alex Wolf

Joined: Aug 24, 2004
Posts: 16
gotcha. thanks for the info both of you.
subject: Event dispatch
It's not a secret anymore!