• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Capture Click on border of JFrame

 
Greenhorn
Posts: 26
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
 
Marshal
Posts: 71615
312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
??? 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 ???
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 26
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 26
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you handling my clicking of the
'take picture' button of my phone.
 
Mahendra Kariya
Greenhorn
Posts: 26
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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.
 
Run away! Run away! Here, take this tiny ad with you:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic