aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Capture Click on border of JFrame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Capture Click on border of JFrame" Watch "Capture Click on border of JFrame" New topic
Author

Capture Click on border of JFrame

Mahendra Kariya
Greenhorn

Joined: Aug 25, 2008
Posts: 26


I want to capture mouse clicks on the border of a JFrame.

Here's Why:
I have successfully disabled "Print Screen" of my window. Here's my code.



But, try this scenario. Click on the Title Bar of JFrame. Before releasing the mouse button, click "Print Screen". This will take the screen shot. So, now I need to capture the mouse click on the borders of the JFrame. How can I do this?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
??? Put a Listener on the content pane which catches the action and does nothing, then put a listener for the same event on the frame ???
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
unless there's been a change in recent releases, the only way to add a listener to the titlebar
was to set the L&F to java's default, allowing java to build the titlebar (and it's not a good looking L&F)

if you don't want a screen dump of your app, how are you controlling say notepad opening alongside,
(or in front, if full screen), and, with notepad having focus, the screen is printed.
Mahendra Kariya
Greenhorn

Joined: Aug 25, 2008
Posts: 26

Michael Dunn wrote:
if you don't want a screen dump of your app, how are you controlling say notepad opening alongside,
(or in front, if full screen), and, with notepad having focus, the screen is printed.


I am setting the state to ICONIFIED whenever the focus is lost.
Mahendra Kariya
Greenhorn

Joined: Aug 25, 2008
Posts: 26

Campbell Ritchie wrote:??? Put a Listener on the content pane which catches the action and does nothing, then put a listener for the same event on the frame ???


How do you propose to do this? Can you give some code snippets?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
How are you handling my clicking of the
'take picture' button of my phone.
Mahendra Kariya
Greenhorn

Joined: Aug 25, 2008
Posts: 26

Michael Dunn wrote:How are you handling my clicking of the
'take picture' button of my phone.

Certain things can't be stopped completely. In such cases, rules and regulations comes into picture. In the organization where my application will be deployed, using any kind of cameras is strictly prohibited. Anyone doing so will lose his job.

And anyways, I am looking for some technical guidance here. The management is there to handle the rest of the cases. So, let us focus on the question I asked.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> So, let us focus on the question I asked.

1) I told you the answer to the asked-problem earlier.

2) I can still run another .jar file with a delayed robot.createScreenCapture().

and, there must be numerous ways in other programming languages to do the same.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Capture Click on border of JFrame