Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to stop a jframe from being moved

Reply
Thread Tools

How to stop a jframe from being moved

 
 
clusardi2k@aol.com
Guest
Posts: n/a
 
      08-31-2012
How can I prevent/stop a jframe from being moved on the monitor.

Thank you,
 
Reply With Quote
 
 
 
 
Eric Sosman
Guest
Posts: n/a
 
      08-31-2012
On 8/31/2012 10:06 AM, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> How can I prevent/stop a jframe from being moved on the monitor.


What a horrible idea!

There are lots of ways. A few of the more sensible:

- Turn off the monitor.

- Uninstall the drivers for all user interaction devices.

- Turn off the computer.

- Electrocute the user.

A few of the less sensible:

- Use a javax.swing.Timer to forcibly reposition the JFrame
every delta-T milliseconds, thus negating the user's attempt
to move it. (For extra credit, play a sound clip of a
maniacal laugh.)

- See if there's a way to listen for window movement events,
and forcibly reposition when/if they occur. Doesn't look
like WindowListener will do this, but maybe you can hack
up some weird combination of WindowFocusListener and
MouseAdapter to get the notification you need, possibly
using the JFrame's glass pane.

- Maybe if you suppress the window decorations there won't
be a "move window" handle.

- Maybe using full-screen exclusive mode would help with some
of the approaches mentioned above.

> Thank you,


Two words you're unlikely to hear from your users.

The single most important reason to have a windowing system in
the first place is to allow multiple applications to share display
space and input devices. When you say "*My* application always
owns this chunk of screen real estate," you are also saying "*My*
application's need for that bit of screen is greater than that
of any other application, *even those I've never imagined.*" The
ancient Greeks called this attitude "ὕβρις," and displaying ὕβρις
was an excellent way to get yourself punished by the dwellers
on Olympus ...

--
Eric Sosman
(E-Mail Removed)d
 
Reply With Quote
 
 
 
 
clusardi2k@aol.com
Guest
Posts: n/a
 
      08-31-2012
Using the following event produces a jerky effect. Do you have something better!

private void formComponentMoved(java.awt.event.ComponentEvent evt)
{

this.setLocationRelativeTo(my_modal_frame_obj)
}

Thanks,
 
Reply With Quote
 
clusardi2k@aol.com
Guest
Posts: n/a
 
      08-31-2012
I also get the below exception trace when the project starts:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at Toy_Package.Toy_Obj.formComponentMoved(Toy_Obj.jav a:1859)
at Toy_Package.Toy_Obj.access$000(Toy_Obj.java:25)
at Toy_Package.Toy_Obj$2.componentMoved(Toy_Obj.java: 770)
at java.awt.AWTEventMulticaster.componentMoved(AWTEve ntMulticaster.java:169)

....

Thanks,
 
Reply With Quote
 
Andreas Leitgeb
Guest
Posts: n/a
 
      08-31-2012
Eric Sosman <(E-Mail Removed)> wrote:
> On 8/31/2012 10:06 AM, (E-Mail Removed) wrote:
>> How can I prevent/stop a jframe from being moved on the monitor.

> What a horrible idea!
> There are lots of ways. A few of the more sensible:
> - Turn off the monitor.
> - Uninstall the drivers for all user interaction devices.
> - Turn off the computer.
> - Electrocute the user.


How about the legal way?
OP should add a subparagraph 12.4.2 to their software's EULA,
that simply forbids the licencee("user") to move certain/all
of the application's windows.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How Can I Get One JFrame To Appear Above Another JFrame clusardi2k@aol.com Java 2 08-27-2012 03:01 PM
start a new JFrame from an existing one, and when old JFrame closes new one does not jakester Java 3 04-02-2007 11:13 PM
FWD: Help: Control lost doesn't raise event after being moved to dynamically loaded user control Tonix ASP .Net 0 08-24-2004 05:26 AM
Help: Control lost doesn't raise event after being moved to dynamically loaded user control Thanh Nguyen ASP .Net 0 04-01-2004 02:23 AM



Advertisments